Skip to content

Commit

Permalink
feat(core): remove deprecated workspace generator command
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed Oct 10, 2023
1 parent fce2c08 commit 4f95de6
Show file tree
Hide file tree
Showing 18 changed files with 1 addition and 329 deletions.
66 changes: 0 additions & 66 deletions docs/generated/cli/workspace-generator.md

This file was deleted.

16 changes: 0 additions & 16 deletions docs/generated/manifests/menus.json
Original file line number Diff line number Diff line change
Expand Up @@ -7582,14 +7582,6 @@
"children": [],
"disableCollapsible": false
},
{
"name": "workspace-generator",
"path": "/nx-api/nx/documents/workspace-generator",
"id": "workspace-generator",
"isExternal": false,
"children": [],
"disableCollapsible": false
},
{
"name": "connect-to-nx-cloud",
"path": "/nx-api/nx/documents/connect-to-nx-cloud",
Expand Down Expand Up @@ -8782,14 +8774,6 @@
"isExternal": false,
"disableCollapsible": false
},
{
"id": "workspace-generator",
"path": "/nx-api/workspace/generators/workspace-generator",
"name": "workspace-generator",
"children": [],
"isExternal": false,
"disableCollapsible": false
},
{
"id": "run-commands",
"path": "/nx-api/workspace/generators/run-commands",
Expand Down
20 changes: 0 additions & 20 deletions docs/generated/manifests/nx-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -1686,17 +1686,6 @@
"tags": ["enforce-module-boundaries"],
"originalFilePath": "generated/cli/workspace-lint"
},
"/nx-api/nx/documents/workspace-generator": {
"id": "workspace-generator",
"name": "workspace-generator",
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
"file": "generated/packages/nx/documents/workspace-generator",
"itemList": [],
"isExternal": false,
"path": "/nx-api/nx/documents/workspace-generator",
"tags": [],
"originalFilePath": "generated/cli/workspace-generator"
},
"/nx-api/nx/documents/connect-to-nx-cloud": {
"id": "connect-to-nx-cloud",
"name": "connect-to-nx-cloud",
Expand Down Expand Up @@ -2830,15 +2819,6 @@
"path": "/nx-api/workspace/generators/new",
"type": "generator"
},
"/nx-api/workspace/generators/workspace-generator": {
"description": "Generates a workspace generator.",
"file": "generated/packages/workspace/generators/workspace-generator.json",
"hidden": false,
"name": "workspace-generator",
"originalFilePath": "/packages/workspace/src/generators/workspace-generator/schema.json",
"path": "/nx-api/workspace/generators/workspace-generator",
"type": "generator"
},
"/nx-api/workspace/generators/run-commands": {
"description": "Generates a target to run any command in the terminal.",
"file": "generated/packages/workspace/generators/run-commands.json",
Expand Down
20 changes: 0 additions & 20 deletions docs/generated/packages-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -1667,17 +1667,6 @@
"tags": ["enforce-module-boundaries"],
"originalFilePath": "generated/cli/workspace-lint"
},
{
"id": "workspace-generator",
"name": "workspace-generator",
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
"file": "generated/packages/nx/documents/workspace-generator",
"itemList": [],
"isExternal": false,
"path": "nx/documents/workspace-generator",
"tags": [],
"originalFilePath": "generated/cli/workspace-generator"
},
{
"id": "connect-to-nx-cloud",
"name": "connect-to-nx-cloud",
Expand Down Expand Up @@ -2798,15 +2787,6 @@
"path": "workspace/generators/new",
"type": "generator"
},
{
"description": "Generates a workspace generator.",
"file": "generated/packages/workspace/generators/workspace-generator.json",
"hidden": false,
"name": "workspace-generator",
"originalFilePath": "/packages/workspace/src/generators/workspace-generator/schema.json",
"path": "workspace/generators/workspace-generator",
"type": "generator"
},
{
"description": "Generates a target to run any command in the terminal.",
"file": "generated/packages/workspace/generators/run-commands.json",
Expand Down
66 changes: 0 additions & 66 deletions docs/generated/packages/nx/documents/workspace-generator.md

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions docs/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -1868,11 +1868,6 @@
"tags": ["enforce-module-boundaries"],
"file": "generated/cli/workspace-lint"
},
{
"name": "workspace-generator",
"id": "workspace-generator",
"file": "generated/cli/workspace-generator"
},
{
"name": "connect-to-nx-cloud",
"id": "connect-to-nx-cloud",
Expand Down
2 changes: 0 additions & 2 deletions docs/shared/reference/sitemap.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,6 @@
- [report](/nx-api/nx/documents/report)
- [list](/nx-api/nx/documents/list)
- [workspace-lint](/nx-api/nx/documents/workspace-lint)
- [workspace-generator](/nx-api/nx/documents/workspace-generator)
- [connect-to-nx-cloud](/nx-api/nx/documents/connect-to-nx-cloud)
- [reset](/nx-api/nx/documents/reset)
- [repair](/nx-api/nx/documents/repair)
Expand Down Expand Up @@ -644,7 +643,6 @@
- [remove](/nx-api/workspace/generators/remove)
- [convert-to-monorepo](/nx-api/workspace/generators/convert-to-monorepo)
- [new](/nx-api/workspace/generators/new)
- [workspace-generator](/nx-api/workspace/generators/workspace-generator)
- [run-commands](/nx-api/workspace/generators/run-commands)
- [fix-configuration](/nx-api/workspace/generators/fix-configuration)
- [npm-package](/nx-api/workspace/generators/npm-package)
Expand Down
22 changes: 0 additions & 22 deletions e2e/plugin/src/nx-plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,28 +358,6 @@ describe('Nx Plugin', () => {
});
});

describe('workspace-generator', () => {
let custom: string;

it('should work with generate wrapper', () => {
custom = uniq('custom');
const project = uniq('generated-project');
runCLI(`g @nx/plugin:plugin workspace-plugin --no-interactive`);
runCLI(
`g @nx/plugin:generator ${custom} --project workspace-plugin --no-interactive`
);
runCLI(
`workspace-generator ${custom} --name ${project} --no-interactive`
);
expect(() => {
checkFilesExist(
`libs/${project}/src/index.ts`,
`libs/${project}/project.json`
);
});
});
});

describe('--directory', () => {
it('should create a plugin in the specified directory', async () => {
const plugin = uniq('plugin');
Expand Down
1 change: 0 additions & 1 deletion packages/nx/src/command-line/examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ export const examples: Record<string, Example[]> = {
'Open the project graph of the workspace in the browser, highlight the projects affected, but exclude project-one and project-two',
},
],
'workspace-generator': [],
list: [
{
command: 'list',
Expand Down
17 changes: 0 additions & 17 deletions packages/nx/src/command-line/generate/command-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,6 @@ export const yargsGenerateCommand: CommandModule = {
},
};

/**
* @deprecated(v17): Remove `workspace-generator in v17. Use local plugins.
*/
export const yargsWorkspaceGeneratorCommand: CommandModule = {
command: 'workspace-generator [generator]',
describe: 'Runs a workspace generator from the tools/generators directory',
deprecated:
'Use a local plugin instead. See: https://nx.dev/deprecated/workspace-generators',
aliases: ['workspace-schematic [schematic]'],
builder: async (yargs) =>
linkToNxDevAndExamples(withGenerateOptions(yargs), 'workspace-generator'),
handler: async (args) => {
await (await import('./generate')).workspaceGenerators(args);
process.exit(0);
},
};

function withGenerateOptions(yargs: Argv) {
const generatorWillShowHelp =
process.argv[3] && !process.argv[3].startsWith('-');
Expand Down
31 changes: 0 additions & 31 deletions packages/nx/src/command-line/generate/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,34 +417,3 @@ export async function generate(cwd: string, args: { [k: string]: any }) {
}
});
}

/**
* Wraps `workspace-generator` to invoke `generate`.
*
* @deprecated(v17): Remove `workspace-generator in v17. Use local plugins.
*/
export async function workspaceGenerators(args: Arguments) {
const generator = process.argv.slice(3);

output.warn({
title: `Workspace Generators are no longer supported`,
bodyLines: [
'Instead, Nx now supports executing generators or executors from ',
'local plugins. To run a generator from a local plugin, ',
'use `nx generate` like you would with any other generator.',
'',
'For more information, see: https://nx.dev/deprecated/workspace-generators',
],
});

const nxJson: NxJsonConfiguration = readNxJson();

const collection = nxJson.npmScope
? `@${nxJson.npmScope}/workspace-plugin`
: 'workspace-plugin';

args._ = args._.slice(1);
args.generator = `${collection}:${generator}`;

return generate(process.cwd(), args);
}
6 changes: 1 addition & 5 deletions packages/nx/src/command-line/nx-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ import {
yargsFormatCheckCommand,
yargsFormatWriteCommand,
} from './format/command-object';
import {
yargsGenerateCommand,
yargsWorkspaceGeneratorCommand,
} from './generate/command-object';
import { yargsGenerateCommand } from './generate/command-object';
import { yargsInitCommand } from './init/command-object';
import { yargsListCommand } from './list/command-object';
import {
Expand Down Expand Up @@ -88,7 +85,6 @@ export const commandsObject = yargs
.command(yargsShowCommand)
.command(yargsViewLogsCommand)
.command(yargsWatchCommand)
.command(yargsWorkspaceGeneratorCommand)
.command(yargsWorkspaceLintCommand)
.scriptName('nx')
.help()
Expand Down
Loading

0 comments on commit 4f95de6

Please sign in to comment.