question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add devDependencies for custom templates

See original GitHub issue

Is your proposal related to a problem?

Hey 👋good job on the recent release.

I’m really keen to make a custom template for CRA but want to add dev dependencies. Are there plans to add support for this is the near-ish future? Happy to throw up a PR if you’re busy with other stuff.

I made a fork of CRA a while ago so I could add custom templates but a community-supported effort is much more appealing!

Describe the solution you’d like

Simply adding another key to template.json for "devDependencies".

Where dependencies start to be installed here, there could be a function to wrap the reusable stuff (building up args, spawning process etc.) that could take an dependency type and the relevant slice of template.json.

Describe alternatives you’ve considered

Nothing at the moment as the template feature is obviously very new.

Additional context

This could potentially open up the possibility of adding peerDependencies too but I haven’t really worked with them directly before, so not sure if this is useful/appropriate.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:10
  • Comments:26 (15 by maintainers)

github_iconTop GitHub Comments

3reactions
mrmckebcommented, Dec 18, 2019

Hi @tomvalorsa, the CRA team have historically been against having devDependencies in the templates, as most users run tests/etc on the CI anyway, so there’s rarely a time where you would only want to install one set of dependencies.

That being said, things change, and we’re always open to discussion if people have good reasoning for change.

@lukaszfiszer is right, you can use separate configs for things like husky - but we’re open to allowing more keys to be added to the template.json file.

I’d personally be in favour of adding a “additional keys” property, which would allow things like eslint and prettier keys - and would exclude dependency keys (as they would need to be processed). Or we could whitelist config keys - but that would be a slippery slope I think. Maybe we could call the key additionalKeys or packageConfigs?

3reactions
lzm0x219commented, Dec 6, 2019

I want to support not only devDependencies, but also a complete package.json configuration

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding dependencies to a package.json file - npm Docs
To add dependencies and devDependencies to a package.json file from the command line, you can install them in the root directory of your...
Read more >
How to make a custom create-react-app template
Run npx create-react-app your-app --template file: relative/file/path/my-template-folder to create a project based off of your newly created ...
Read more >
Writing Templates - Electron Forge
To use the custom template, run the init command and point the template at the file that contains the ForgeTemplate implementation. Previous.
Read more >
yarn add
Adding dependencies. In general, a package is simply a folder with code and ... This means running yarn add [package-name] to install it...
Read more >
Addon dependencies - Writing addons - Ember CLI Guides
Addon dependencies · the addon's dependencies are installed in dependencies · dependencies that are only used for the dummy app are installed in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found