Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ng add]: support for dev dependencies #15409

Closed
dirkluijk opened this issue Aug 22, 2019 · 5 comments
Closed

[ng add]: support for dev dependencies #15409

dirkluijk opened this issue Aug 22, 2019 · 5 comments
Labels
area: @angular/cli feature Issue that requests a new feature
Milestone

Comments

@dirkluijk
Copy link

dirkluijk commented Aug 22, 2019

🚀 Feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [X] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Description

For our library, we want to provide schematics for the ng add command. However, this automatically installs our library as dependency. Shouldn't there be a way to install it to the devDependencies?

We do add our library to the devDependencies our selves (using schematics), but that results in the following warning:

Installed packages for tooling via npm.
    ✅️ Added "foo" into devDependencies
    🔍 Installing packages...
UPDATE package.json (980 bytes)
npm WARN The package foo is included as both a dev and production dependency.

Describe the solution you'd like

  • Support for an additional dev option: ng add mylib --dev.
  • Update the npmInstall() task with an additional dev: boolean argument.

This could be done in a backwards compatible way.

Alternative solution

  • Let ng add perform an npm install --no-save
  • Change the package.json ourselves

This might be breaking.

@mgechev
Copy link
Member

mgechev commented Aug 22, 2019

This feature makes sense to me. Especially with ng deploy there could be more and more dev dependencies that folks want to add to their projects.

Thanks for the PR as well!

@alan-agius4 alan-agius4 added area: @angular/cli feature Issue that requests a new feature labels Aug 22, 2019
@ngbot ngbot bot modified the milestone: Backlog Aug 22, 2019
@dirkluijk
Copy link
Author

dirkluijk commented Aug 22, 2019

There are several articles out there, about how to write your own ng-add schematic, but what I understand is that you don't need to run the addPackageJsonDependency() yourself? At least not for the package that is installed right?

@alan-agius4
Copy link
Collaborator

Hi all, this has been addressed via #15815

@alan-agius4
Copy link
Collaborator

You don't need to run addPackageJsonDependency() because it will be added to the dependencies via https://github.com/angular/angular-cli/blob/master/packages/angular/cli/tasks/npm-install.ts

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: @angular/cli feature Issue that requests a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants