Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(node): update node migrations to use forEachExecutorOptions (#9471)
Co-authored-by: Chau Tran <ctran@Chaus-MacBook-Pro.local>
- Loading branch information
1 parent
2f3d80e
commit ba2dfc4
Showing
3 changed files
with
43 additions
and
34 deletions.
There are no files selected for viewing
21 changes: 11 additions & 10 deletions
21
packages/node/src/migrations/update-13-8-5/rename-build-to-webpack.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 |
---|---|---|
@@ -1,20 +1,21 @@ | ||
import { | ||
formatFiles, | ||
getProjects, | ||
readProjectConfiguration, | ||
Tree, | ||
updateProjectConfiguration, | ||
} from '@nrwl/devkit'; | ||
import { forEachExecutorOptions } from '@nrwl/workspace/src/utilities/executor-options-utils'; | ||
|
||
export default async function update(host: Tree) { | ||
const projects = getProjects(host); | ||
|
||
for (const [name, config] of projects.entries()) { | ||
if (config?.targets?.build?.executor !== '@nrwl/node:build') continue; | ||
|
||
config.targets.build.executor = '@nrwl/node:webpack'; | ||
|
||
updateProjectConfiguration(host, name, config); | ||
} | ||
forEachExecutorOptions( | ||
host, | ||
'@nrwl/node:build', | ||
(_, projectName, targetName) => { | ||
const projectConfiguration = readProjectConfiguration(host, projectName); | ||
projectConfiguration.targets[targetName].executor = '@nrwl/node:webpack'; | ||
updateProjectConfiguration(host, projectName, projectConfiguration); | ||
} | ||
); | ||
|
||
await formatFiles(host); | ||
} |
25 changes: 13 additions & 12 deletions
25
packages/node/src/migrations/update-13-8-5/rename-execute-to-node.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 |
---|---|---|
@@ -1,20 +1,21 @@ | ||
import { | ||
formatFiles, | ||
getProjects, | ||
readProjectConfiguration, | ||
Tree, | ||
updateProjectConfiguration, | ||
} from '@nrwl/devkit'; | ||
import { forEachExecutorOptions } from '@nrwl/workspace/src/utilities/executor-options-utils'; | ||
|
||
export default async function update(host: Tree) { | ||
const projects = getProjects(host); | ||
export default async function update(tree: Tree) { | ||
forEachExecutorOptions( | ||
tree, | ||
'@nrwl/node:execute', | ||
(_, projectName, targetName) => { | ||
const projectConfiguration = readProjectConfiguration(tree, projectName); | ||
projectConfiguration.targets[targetName].executor = '@nrwl/node:node'; | ||
updateProjectConfiguration(tree, projectName, projectConfiguration); | ||
} | ||
); | ||
|
||
for (const [name, config] of projects.entries()) { | ||
if (config?.targets?.serve?.executor !== '@nrwl/node:execute') continue; | ||
|
||
config.targets.serve.executor = '@nrwl/node:node'; | ||
|
||
updateProjectConfiguration(host, name, config); | ||
} | ||
|
||
await formatFiles(host); | ||
await formatFiles(tree); | ||
} |
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