Skip to content

Commit

Permalink
fix(devkit): executor-to-plugin-migrator should add // targets hint
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed May 3, 2024
1 parent 21d7e92 commit 7f6abce
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ class ExecutorToPluginMigrator<T> {
} else {
delete projectConfig.targets[targetName];
}

if (!projectConfig['// targets']) {
projectConfig[
'// targets'
] = `to see all targets run: nx show project ${projectName} --web`;
}

updateProjectConfiguration(this.tree, projectName, projectConfig);

return `${projectFromGraph.data.root}/**/*`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
joinPathFragments,
type ProjectConfiguration,
type ProjectGraph,
readJson,
readNxJson,
readProjectConfiguration,
type Tree,
Expand Down Expand Up @@ -413,8 +414,14 @@ describe('Eslint - Convert Executors To Plugin', () => {
// project.json modifications
const updatedProject = readProjectConfiguration(tree, project.name);
const targetKeys = Object.keys(updatedProject.targets);
['lint'].forEach((key) => expect(targetKeys).not.toContain(key));

expect(targetKeys).not.toContain('lint');
const projectJsonForProject = readJson(
tree,
`${project.root}/project.json`
);
expect(projectJsonForProject['// targets']).toEqual(
'to see all targets run: nx show project myapp --web'
);
// nx.json modifications
const nxJsonPlugins = readNxJson(tree).plugins;
const addedTestEslintPlugin = nxJsonPlugins.find((plugin) => {
Expand Down

0 comments on commit 7f6abce

Please sign in to comment.