fix(deps): using the right package manager to install in nest generate
#1910
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #1115
What is the new behavior?
Using the right package manager to install packages (detecting by lock files)
Does this PR introduce a breaking change?
Other information
As described in angular/angular-cli#24305, running the same schematic in
angular-cli
works correctly (using the right package manager)nest g
andng g
are basicly the same, so we can fix this problem in cli level just likeangular-cli
.If you look into angular's codebase (https://github.com/angular/angular-cli/blob/489d4df0ed17481492728624735a235f25a418db/packages/angular/cli/src/command-builder/schematics-command-module.ts#L116), the
packageManager
option is predefined inangular-cli
and passed into aNodeWorkflow
.In
nest-cli
, we directly use a binary file from@angular-devkit/schematics-cli
to run our schematics.nest-cli/lib/runners/schematic.runner.ts
Line 15 in bfd3d8b
So we just need to implement that auto-detecting logic in this file.
See PR: angular/angular-cli#24305