-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(angular): generate @nx/angular in devDependencies and move to dep…
…endencies when using runtime helpers (#27405) <!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> New workspaces are generated with `@nx/angular` as a production dependency even though the generated code does not use any runtime helper from it. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> New workspaces should be generated with `@nx/angular` as a development dependency. When generating a new MF host or dynamic MF application (host or remote), the `@nx/angular` package should be moved to the production dependencies because the generated code uses some runtime helpers from it. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #27333 (cherry picked from commit 1ae3c2d)
- Loading branch information
1 parent
022754c
commit c009c74
Showing
6 changed files
with
75 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/angular/src/generators/setup-mf/lib/move-angular-plugin-to-dependencies.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { readJson, writeJson, type Tree } from '@nx/devkit'; | ||
|
||
export function moveAngularPluginToDependencies(tree: Tree): void { | ||
const packageJson = readJson(tree, 'package.json'); | ||
if (packageJson.dependencies?.['@nx/angular']) { | ||
return; | ||
} | ||
|
||
packageJson.dependencies ??= {}; | ||
packageJson.dependencies['@nx/angular'] = | ||
packageJson.devDependencies['@nx/angular']; | ||
delete packageJson.devDependencies['@nx/angular']; | ||
|
||
writeJson(tree, 'package.json', packageJson); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters