diff --git a/docs/generated/cli/workspace-generator.md b/docs/generated/cli/workspace-generator.md deleted file mode 100644 index e09c418438748a..00000000000000 --- a/docs/generated/cli/workspace-generator.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: 'workspace-generator - CLI command' -description: 'Runs a workspace generator from the tools/generators directory' ---- - -# workspace-generator - -**Deprecated:** Use a local plugin instead. See: https://nx.dev/deprecated/workspace-generators - -Runs a workspace generator from the tools/generators directory - -## Usage - -```shell -nx workspace-generator [generator] -``` - -Install `nx` globally to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpm nx`. - -## Options - -### dryRun - -Type: `boolean` - -Default: `false` - -Preview the changes without updating files - -### generator - -Type: `string` - -Name of the generator (e.g., @nx/js:library, library) - -### help - -Type: `boolean` - -Show help - -### interactive - -Type: `boolean` - -Default: `true` - -When false disables interactive input prompts for options - -### quiet - -Type: `boolean` - -Hides logs from tree operations (e.g. `CREATE package.json`) - -### verbose - -Type: `boolean` - -Prints additional information about the commands (e.g., stack traces) - -### version - -Type: `boolean` - -Show version number diff --git a/docs/generated/manifests/menus.json b/docs/generated/manifests/menus.json index 5c640605218d62..26a8567a181634 100644 --- a/docs/generated/manifests/menus.json +++ b/docs/generated/manifests/menus.json @@ -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", @@ -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", diff --git a/docs/generated/manifests/nx-api.json b/docs/generated/manifests/nx-api.json index 228eaf00234a9d..53f73c83729ad7 100644 --- a/docs/generated/manifests/nx-api.json +++ b/docs/generated/manifests/nx-api.json @@ -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", @@ -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", diff --git a/docs/generated/packages-metadata.json b/docs/generated/packages-metadata.json index 667fc7768181f7..98284e85a016be 100644 --- a/docs/generated/packages-metadata.json +++ b/docs/generated/packages-metadata.json @@ -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", @@ -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", diff --git a/docs/generated/packages/nx/documents/workspace-generator.md b/docs/generated/packages/nx/documents/workspace-generator.md deleted file mode 100644 index e09c418438748a..00000000000000 --- a/docs/generated/packages/nx/documents/workspace-generator.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: 'workspace-generator - CLI command' -description: 'Runs a workspace generator from the tools/generators directory' ---- - -# workspace-generator - -**Deprecated:** Use a local plugin instead. See: https://nx.dev/deprecated/workspace-generators - -Runs a workspace generator from the tools/generators directory - -## Usage - -```shell -nx workspace-generator [generator] -``` - -Install `nx` globally to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpm nx`. - -## Options - -### dryRun - -Type: `boolean` - -Default: `false` - -Preview the changes without updating files - -### generator - -Type: `string` - -Name of the generator (e.g., @nx/js:library, library) - -### help - -Type: `boolean` - -Show help - -### interactive - -Type: `boolean` - -Default: `true` - -When false disables interactive input prompts for options - -### quiet - -Type: `boolean` - -Hides logs from tree operations (e.g. `CREATE package.json`) - -### verbose - -Type: `boolean` - -Prints additional information about the commands (e.g., stack traces) - -### version - -Type: `boolean` - -Show version number diff --git a/docs/generated/packages/workspace/generators/workspace-generator.json b/docs/generated/packages/workspace/generators/workspace-generator.json deleted file mode 100644 index 3dc5351d26f8db..00000000000000 --- a/docs/generated/packages/workspace/generators/workspace-generator.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "workspace-generator", - "factory": "./src/generators/workspace-generator/workspace-generator", - "schema": { - "cli": "nx", - "$id": "SchematicsNxWorkspaceSchematic", - "title": "Create a custom generator", - "description": "Create a custom generator.", - "type": "object", - "properties": {}, - "required": [], - "presets": [] - }, - "aliases": ["workspace-schematic"], - "description": "Generates a workspace generator.", - "implementation": "/packages/workspace/src/generators/workspace-generator/workspace-generator.ts", - "hidden": false, - "path": "/packages/workspace/src/generators/workspace-generator/schema.json", - "type": "generator" -} diff --git a/docs/map.json b/docs/map.json index 95f28d9b0ebabb..09b0f444ad7be6 100644 --- a/docs/map.json +++ b/docs/map.json @@ -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", diff --git a/docs/shared/reference/sitemap.md b/docs/shared/reference/sitemap.md index cc8fc339724dd3..c117c7ad5272f1 100644 --- a/docs/shared/reference/sitemap.md +++ b/docs/shared/reference/sitemap.md @@ -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) @@ -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) diff --git a/e2e/plugin/src/nx-plugin.test.ts b/e2e/plugin/src/nx-plugin.test.ts index 97e3e653af116c..372c471b5fa3bd 100644 --- a/e2e/plugin/src/nx-plugin.test.ts +++ b/e2e/plugin/src/nx-plugin.test.ts @@ -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'); diff --git a/packages/nx/src/command-line/examples.ts b/packages/nx/src/command-line/examples.ts index 811b0b36979972..6dfd01facd937d 100644 --- a/packages/nx/src/command-line/examples.ts +++ b/packages/nx/src/command-line/examples.ts @@ -225,7 +225,6 @@ export const examples: Record = { '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', diff --git a/packages/nx/src/command-line/generate/command-object.ts b/packages/nx/src/command-line/generate/command-object.ts index 99cfe33723a0ed..707b68bace404b 100644 --- a/packages/nx/src/command-line/generate/command-object.ts +++ b/packages/nx/src/command-line/generate/command-object.ts @@ -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('-'); diff --git a/packages/nx/src/command-line/generate/generate.ts b/packages/nx/src/command-line/generate/generate.ts index d560d98bcb3c24..1d46352662f371 100644 --- a/packages/nx/src/command-line/generate/generate.ts +++ b/packages/nx/src/command-line/generate/generate.ts @@ -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); -} diff --git a/packages/nx/src/command-line/nx-commands.ts b/packages/nx/src/command-line/nx-commands.ts index beed4e67b4d912..7fe5aec64d6b74 100644 --- a/packages/nx/src/command-line/nx-commands.ts +++ b/packages/nx/src/command-line/nx-commands.ts @@ -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 { @@ -88,7 +85,6 @@ export const commandsObject = yargs .command(yargsShowCommand) .command(yargsViewLogsCommand) .command(yargsWatchCommand) - .command(yargsWorkspaceGeneratorCommand) .command(yargsWorkspaceLintCommand) .scriptName('nx') .help() diff --git a/packages/workspace/generators.json b/packages/workspace/generators.json index ff28dc9d80fe63..ee73b5fcd72ad3 100644 --- a/packages/workspace/generators.json +++ b/packages/workspace/generators.json @@ -19,12 +19,6 @@ "schema": "./src/generators/convert-to-monorepo/schema.json", "description": "Convert a Nx project to a monorepo." }, - "workspace-generator": { - "factory": "./src/generators/workspace-generator/workspace-generator", - "schema": "./src/generators/workspace-generator/schema.json", - "aliases": ["workspace-schematic"], - "description": "Generates a workspace generator." - }, "run-commands": { "factory": "./src/generators/run-commands/run-commands#runCommandsSchematic", "schema": "./src/generators/run-commands/schema.json", @@ -69,12 +63,6 @@ "description": "Create a workspace.", "hidden": true }, - "workspace-generator": { - "factory": "./src/generators/workspace-generator/workspace-generator", - "schema": "./src/generators/workspace-generator/schema.json", - "aliases": ["workspace-schematic"], - "description": "Generates a workspace generator." - }, "run-commands": { "factory": "./src/generators/run-commands/run-commands#runCommandsGenerator", "schema": "./src/generators/run-commands/schema.json", diff --git a/packages/workspace/src/generators/workspace-generator/schema.d.ts b/packages/workspace/src/generators/workspace-generator/schema.d.ts deleted file mode 100644 index e53f1202a2dbcc..00000000000000 --- a/packages/workspace/src/generators/workspace-generator/schema.d.ts +++ /dev/null @@ -1 +0,0 @@ -export interface Schema {} diff --git a/packages/workspace/src/generators/workspace-generator/schema.json b/packages/workspace/src/generators/workspace-generator/schema.json deleted file mode 100644 index e283eecab5db78..00000000000000 --- a/packages/workspace/src/generators/workspace-generator/schema.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "cli": "nx", - "$id": "SchematicsNxWorkspaceSchematic", - "title": "Create a custom generator", - "description": "Create a custom generator.", - "type": "object", - "properties": {}, - "required": [] -} diff --git a/packages/workspace/src/generators/workspace-generator/workspace-generator.ts b/packages/workspace/src/generators/workspace-generator/workspace-generator.ts deleted file mode 100644 index 989684a49091e1..00000000000000 --- a/packages/workspace/src/generators/workspace-generator/workspace-generator.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Schema } from './schema'; -import { Tree, stripIndents } from '@nx/devkit'; - -export default async function (host: Tree, schema: Schema) { - const message = stripIndents`Workspace Generators are no longer supported. Instead, - Nx now supports executing generators or executors from local plugins. To get - started, install @nx/plugin and run \`nx g plugin\`. - - Afterwards, or if you already have an Nx plugin, you can run - \`nx g generator --project {my-plugin}\` to add a new generator. - - For more information, see: https://nx.dev/deprecated/workspace-generators`; - - throw new Error(message); -} diff --git a/packages/workspace/src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin.ts b/packages/workspace/src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin.ts index e2fa6a3b7c5b2a..1fccc50251f34e 100644 --- a/packages/workspace/src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin.ts +++ b/packages/workspace/src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin.ts @@ -11,7 +11,6 @@ import { readProjectConfiguration, Tree, updateJson, - writeJson, } from '@nx/devkit'; // nx-ignore-next-line import * as path from 'path';