Skip to content

Ability to select package manager when creating project, and locally (per-project) #9542

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

Closed
torinthiel opened this issue Feb 7, 2018 · 3 comments

Comments

@torinthiel
Copy link

Versions

Angular CLI: 1.6.3
Node: 8.9.4

Desired behavior

When running ng new I get a message that I can switch the package manager to yarn. However this is a global change. What I would like is to add an option, e.g. --package-manager=yarn, so that I can set the package manager for this specific new project. I'd also like this selection to be stored on a per-project basis, either in .angular-cli.json or possibly guessed from existence of yarn.lock. The former requires a change in file structure, but is more future-proof, as the cli already supports cnpm as well,

Rationale for the latter - assume I'd like to work on several projects, when some of them are using yarn, and others are using npm. Using the wrong package manager will cause issues, as it will install different packages. Currently it requires switching between package managers on a global basis.

Rationale for the former: The choice of the package manager is a project choice, not a global choice. A global default is fine, as most people will have a strong preference, but just allow for the choice to be made when it really matters.

@clydin
Copy link
Member

clydin commented Feb 8, 2018

Currently, the only time the CLI uses the package manager is during the execution of ng new. This is why it is a global only setting. If a project requires a specific package manager, the --skip-install option can be used with ng new and then after creation the particular package manager (npm/yarn/cnpm/pnpm/etc.) can be used to install.

If in the future, the package manager is used for more than ng new, then the initial one-time workflow would most likely be similar to the following if the global default is undesirable for the project:

ng new <project> --skip-install
cd <project>
ng set packageManager=yarn
yarn

@clydin clydin closed this as completed Feb 8, 2018
@torinthiel
Copy link
Author

torinthiel commented Feb 8, 2018

#2651 (comment) says otherwise. I've checked node_modules/@angular/cli in a new project, and npm appears in 74 places, mostly in README and comments, so is the comment outdated (It's over a year old)?

@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 Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants