From 4697b06fd10925fc859e6f1ca441df3dc76db4a1 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Fri, 13 Oct 2023 11:55:35 -0400 Subject: [PATCH 1/9] chore(repo): set rust-toolchain to stable (#19603) --- rust-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain b/rust-toolchain index 6c623f78cb3433..870bbe4e50e634 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.70 \ No newline at end of file +stable \ No newline at end of file From 5a6adb717cd1559f8c863e26264e2bdec606c7cd Mon Sep 17 00:00:00 2001 From: Colum Ferry Date: Fri, 13 Oct 2023 17:07:02 +0100 Subject: [PATCH 2/9] feat(angular): use consistent artifact generation for generators (#19601) --- .../angular/generators/directive.json | 24 +++++++---- .../packages/angular/generators/pipe.json | 24 +++++++---- .../angular/generators/scam-directive.json | 37 +++++++++------- .../angular/generators/scam-pipe.json | 35 +++++++++------ .../packages/angular/generators/scam.json | 37 +++++++++------- .../src/generators/directive/directive.ts | 20 ++++----- ...rectiveFileName__.directive.spec.ts__tpl__ | 8 ---- .../files/__fileName__.spec.ts__tpl__ | 8 ++++ ...ctive.ts__tpl__ => __fileName__.ts__tpl__} | 2 +- .../directive/lib/normalize-options.ts | 39 ++++++++++++----- .../directive/lib/validate-options.ts | 8 +--- .../src/generators/directive/schema.d.ts | 24 +++++++++-- .../src/generators/directive/schema.json | 26 ++++++----- .../pipe/files/__fileName__.spec.ts__tpl__ | 8 ++++ ....pipe.ts__tpl__ => __fileName__.ts__tpl__} | 4 +- .../__pipeFileName__.pipe.spec.ts__tpl__ | 8 ---- .../generators/pipe/lib/normalize-options.ts | 36 ++++++++++++---- .../generators/pipe/lib/validate-options.ts | 8 +--- packages/angular/src/generators/pipe/pipe.ts | 20 ++++----- .../angular/src/generators/pipe/schema.d.ts | 24 +++++++++-- .../angular/src/generators/pipe/schema.json | 26 ++++++----- .../lib/convert-directive-to-scam.spec.ts | 6 +++ .../lib/convert-directive-to-scam.ts | 10 ++--- .../scam-directive/lib/normalize-options.ts | 37 +++++++++++----- .../scam-directive/scam-directive.ts | 2 +- .../src/generators/scam-directive/schema.d.ts | 23 +++++++--- .../src/generators/scam-directive/schema.json | 41 ++++++++++-------- .../lib/convert-pipe-to-scam.spec.ts | 6 +++ .../scam-pipe/lib/convert-pipe-to-scam.ts | 10 ++--- .../scam-pipe/lib/normalize-options.ts | 38 ++++++++++------ .../src/generators/scam-pipe/scam-pipe.ts | 2 +- .../src/generators/scam-pipe/schema.d.ts | 23 +++++++--- .../src/generators/scam-pipe/schema.json | 39 ++++++++++------- .../lib/convert-component-to-scam.spec.ts | 8 ++++ .../scam/lib/convert-component-to-scam.ts | 10 ++--- .../generators/scam/lib/normalize-options.ts | 32 +++++++++++--- packages/angular/src/generators/scam/scam.ts | 2 +- .../angular/src/generators/scam/schema.d.ts | 21 +++++++-- .../angular/src/generators/scam/schema.json | 43 +++++++++++-------- 39 files changed, 498 insertions(+), 281 deletions(-) delete mode 100644 packages/angular/src/generators/directive/files/__directiveFileName__.directive.spec.ts__tpl__ create mode 100644 packages/angular/src/generators/directive/files/__fileName__.spec.ts__tpl__ rename packages/angular/src/generators/directive/files/{__directiveFileName__.directive.ts__tpl__ => __fileName__.ts__tpl__} (76%) create mode 100644 packages/angular/src/generators/pipe/files/__fileName__.spec.ts__tpl__ rename packages/angular/src/generators/pipe/files/{__pipeFileName__.pipe.ts__tpl__ => __fileName__.ts__tpl__} (58%) delete mode 100644 packages/angular/src/generators/pipe/files/__pipeFileName__.pipe.spec.ts__tpl__ diff --git a/docs/generated/packages/angular/generators/directive.json b/docs/generated/packages/angular/generators/directive.json index 1dd939c7d48988..d2a60d2339be16 100644 --- a/docs/generated/packages/angular/generators/directive.json +++ b/docs/generated/packages/angular/generators/directive.json @@ -7,7 +7,7 @@ "cli": "nx", "title": "Nx Angular Directive Options Schema", "type": "object", - "description": "Creates a new, generic directive definition in the given project.", + "description": "Creates a new Angular directive.", "additionalProperties": false, "properties": { "name": { @@ -16,18 +16,23 @@ "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What name would you like to use for the directive?" }, - "path": { + "directory": { "type": "string", - "format": "path", - "$default": { "$source": "workingDirectory" }, - "description": "The path at which to create the interface that defines the directive, relative to the workspace root.", - "visible": false + "description": "The directory at which to create the directive file. When `--nameAndDirectoryFormat=as-provided`, it will be relative to the current working directory. Otherwise, it will be relative to the workspace root.", + "aliases": ["dir", "path"], + "x-priority": "important" + }, + "nameAndDirectoryFormat": { + "description": "Whether to generate the directive in the directory as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).", + "type": "string", + "enum": ["as-provided", "derived"] }, "project": { "type": "string", "description": "The name of the project.", "$default": { "$source": "projectName" }, - "x-dropdown": "projects" + "x-dropdown": "projects", + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v18." }, "prefix": { "type": "string", @@ -61,7 +66,8 @@ "flat": { "type": "boolean", "description": "When true (the default), creates the new files at the top level of the current project.", - "default": true + "default": true, + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18." }, "module": { "type": "string", @@ -79,7 +85,7 @@ "description": "Skip formatting of files." } }, - "required": ["name", "project"], + "required": ["name"], "presets": [] }, "aliases": ["d"], diff --git a/docs/generated/packages/angular/generators/pipe.json b/docs/generated/packages/angular/generators/pipe.json index 1c543a9de57756..e022ed06fc4e7b 100644 --- a/docs/generated/packages/angular/generators/pipe.json +++ b/docs/generated/packages/angular/generators/pipe.json @@ -8,7 +8,7 @@ "type": "object", "cli": "nx", "additionalProperties": false, - "description": "Creates a new, generic pipe definition in the given project.", + "description": "Creates an Angular pipe.", "properties": { "name": { "type": "string", @@ -16,23 +16,29 @@ "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What name would you like to use for the pipe?" }, - "path": { + "directory": { "type": "string", - "format": "path", - "$default": { "$source": "workingDirectory" }, - "description": "The path at which to create the pipe, relative to the workspace root.", - "visible": false + "description": "The directory at which to create the pipe file. When `--nameAndDirectoryFormat=as-provided`, it will be relative to the current working directory. Otherwise, it will be relative to the workspace root.", + "aliases": ["dir", "path"], + "x-priority": "important" + }, + "nameAndDirectoryFormat": { + "description": "Whether to generate the pipe in the directory as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).", + "type": "string", + "enum": ["as-provided", "derived"] }, "project": { "type": "string", "description": "The name of the project.", "$default": { "$source": "projectName" }, - "x-dropdown": "projects" + "x-dropdown": "projects", + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v18." }, "flat": { "type": "boolean", "default": true, - "description": "When true (the default) creates files at the top level of the project." + "description": "When true (the default) creates files at the top level of the project.", + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18." }, "skipTests": { "type": "boolean", @@ -65,7 +71,7 @@ "description": "Skip formatting of files." } }, - "required": ["name", "project"], + "required": ["name"], "presets": [] }, "description": "Generate an Angular Pipe", diff --git a/docs/generated/packages/angular/generators/scam-directive.json b/docs/generated/packages/angular/generators/scam-directive.json index 79116e21dfa436..6c5688b006b3a0 100644 --- a/docs/generated/packages/angular/generators/scam-directive.json +++ b/docs/generated/packages/angular/generators/scam-directive.json @@ -9,25 +9,13 @@ "type": "object", "examples": [ { - "command": "nx g @nx/angular:scam-directive --project=my-lib --flat=false my-sample", + "command": "nx g @nx/angular:scam-directive my-sample --directory=my-lib/src/lib/my-sample", "description": "Generate a `MySampleDirective` directive in a `my-sample` folder in the `my-lib` library" } ], "description": "Creates a new, generic Angular directive definition in the given or default project.", "additionalProperties": false, "properties": { - "path": { - "type": "string", - "format": "path", - "description": "The path at which to create the directive file, relative to the current workspace. Default is a folder with the same name as the directive in the project root.", - "visible": false - }, - "project": { - "type": "string", - "description": "The name of the project.", - "$default": { "$source": "projectName" }, - "x-dropdown": "projects" - }, "name": { "type": "string", "description": "The name of the directive.", @@ -35,6 +23,24 @@ "x-prompt": "What name would you like to use for the directive?", "x-priority": "important" }, + "directory": { + "type": "string", + "description": "The directory at which to create the SCAM Directive files. When `--nameAndDirectoryFormat=as-provided`, it will be relative to the current working directory. Otherwise, it will be relative to the workspace root.", + "aliases": ["dir", "path"], + "x-priority": "important" + }, + "nameAndDirectoryFormat": { + "description": "Whether to generate the component in the directory as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).", + "type": "string", + "enum": ["as-provided", "derived"] + }, + "project": { + "type": "string", + "description": "The name of the project.", + "$default": { "$source": "projectName" }, + "x-dropdown": "projects", + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v18." + }, "skipTests": { "type": "boolean", "description": "Do not create `spec.ts` test files for the new directive.", @@ -49,7 +55,8 @@ "flat": { "type": "boolean", "description": "Create the new files at the top level of the current project.", - "default": true + "default": true, + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18." }, "selector": { "type": "string", @@ -72,7 +79,7 @@ "x-priority": "important" } }, - "required": ["name", "project"], + "required": ["name"], "presets": [] }, "description": "Generate a directive with an accompanying Single Component Angular Module (SCAM).", diff --git a/docs/generated/packages/angular/generators/scam-pipe.json b/docs/generated/packages/angular/generators/scam-pipe.json index 03e61d937bdb29..dd1d71decd8488 100644 --- a/docs/generated/packages/angular/generators/scam-pipe.json +++ b/docs/generated/packages/angular/generators/scam-pipe.json @@ -16,18 +16,6 @@ "description": "Creates a new, generic Angular pipe definition in the given or default project.", "additionalProperties": false, "properties": { - "path": { - "type": "string", - "format": "path", - "description": "The path at which to create the pipe file, relative to the current workspace. Default is a folder with the same name as the pipe in the project root.", - "visible": false - }, - "project": { - "type": "string", - "description": "The name of the project.", - "$default": { "$source": "projectName" }, - "x-dropdown": "projects" - }, "name": { "type": "string", "description": "The name of the pipe.", @@ -35,6 +23,24 @@ "x-prompt": "What name would you like to use for the pipe?", "x-priority": "important" }, + "directory": { + "type": "string", + "description": "The directory at which to create the component file. When `--nameAndDirectoryFormat=as-provided`, it will be relative to the current working directory. Otherwise, it will be relative to the workspace root.", + "aliases": ["dir", "path"], + "x-priority": "important" + }, + "nameAndDirectoryFormat": { + "description": "Whether to generate the component in the directory as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).", + "type": "string", + "enum": ["as-provided", "derived"] + }, + "project": { + "type": "string", + "description": "The name of the project.", + "$default": { "$source": "projectName" }, + "x-dropdown": "projects", + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v18." + }, "skipTests": { "type": "boolean", "description": "Do not create `spec.ts` test files for the new pipe.", @@ -49,7 +55,8 @@ "flat": { "type": "boolean", "description": "Create the new files at the top level of the current project.", - "default": true + "default": true, + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18." }, "export": { "type": "boolean", @@ -58,7 +65,7 @@ "x-priority": "important" } }, - "required": ["name", "project"], + "required": ["name"], "presets": [] }, "description": "Generate a pipe with an accompanying Single Component Angular Module (SCAM).", diff --git a/docs/generated/packages/angular/generators/scam.json b/docs/generated/packages/angular/generators/scam.json index 75fc4233c60362..addc48143357ea 100644 --- a/docs/generated/packages/angular/generators/scam.json +++ b/docs/generated/packages/angular/generators/scam.json @@ -9,30 +9,36 @@ "type": "object", "examples": [ { - "command": "nx g @nx/angular:scam --project=my-lib my-sample", + "command": "nx g @nx/angular:scam my-sample --directory=my-lib/src/lib/my-sample", "description": "Generate a `MySampleComponent` component in the `my-lib` library." } ], - "description": "Creates a new, generic Angular component definition in the given or default project.", + "description": "Creates a new Angular SCAM.", "additionalProperties": false, "properties": { - "path": { + "name": { + "type": "string", + "description": "The name of the component.", + "$default": { "$source": "argv", "index": 0 }, + "x-prompt": "What name would you like to use for the component?" + }, + "directory": { + "type": "string", + "description": "The directory at which to create the SCAM files. When `--nameAndDirectoryFormat=as-provided`, it will be relative to the current working directory. Otherwise, it will be relative to the workspace root.", + "aliases": ["dir", "path"], + "x-priority": "important" + }, + "nameAndDirectoryFormat": { + "description": "Whether to generate the SCAM in the directory as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).", "type": "string", - "format": "path", - "description": "The path at which to create the component file, relative to the current workspace. Default is a folder with the same name as the component in the project root.", - "visible": false + "enum": ["as-provided", "derived"] }, "project": { "type": "string", "description": "The name of the project.", "$default": { "$source": "projectName" }, - "x-dropdown": "projects" - }, - "name": { - "type": "string", - "description": "The name of the component.", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the component?" + "x-dropdown": "projects", + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v18." }, "displayBlock": { "description": "Specifies if the style will contain `:host { display: block; }`.", @@ -85,7 +91,8 @@ "flat": { "type": "boolean", "description": "Create the new files at the top level of the current project.", - "default": false + "default": false, + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18." }, "selector": { "type": "string", @@ -124,7 +131,7 @@ "x-priority": "internal" } }, - "required": ["name", "project"], + "required": ["name"], "presets": [] }, "description": "Generate a component with an accompanying Single Component Angular Module (SCAM).", diff --git a/packages/angular/src/generators/directive/directive.ts b/packages/angular/src/generators/directive/directive.ts index 09a50dcda56760..34d59653279433 100644 --- a/packages/angular/src/generators/directive/directive.ts +++ b/packages/angular/src/generators/directive/directive.ts @@ -11,9 +11,7 @@ import type { Schema } from './schema'; export async function directiveGenerator(tree: Tree, schema: Schema) { validateOptions(tree, schema); - const options = normalizeOptions(tree, schema); - - const directiveNames = names(options.name); + const options = await normalizeOptions(tree, schema); generateFiles( tree, @@ -21,8 +19,8 @@ export async function directiveGenerator(tree: Tree, schema: Schema) { options.directory, { selector: options.selector, - directiveClassName: directiveNames.className, - directiveFileName: directiveNames.fileName, + symbolName: options.symbolName, + fileName: options.fileName, standalone: options.standalone, tpl: '', } @@ -31,21 +29,21 @@ export async function directiveGenerator(tree: Tree, schema: Schema) { if (options.skipTests) { const pathToSpecFile = joinPathFragments( options.directory, - `${directiveNames.fileName}.directive.spec.ts` + `${options.fileName}.spec.ts` ); tree.delete(pathToSpecFile); } if (!options.skipImport && !options.standalone) { - const modulePath = findModule(tree, options.path, options.module); + const modulePath = findModule(tree, options.directory, options.module); addToNgModule( tree, - options.path, + options.directory, modulePath, - directiveNames.fileName, - `${directiveNames.className}Directive`, - `${directiveNames.fileName}.directive`, + '', + options.symbolName, + options.fileName, 'declarations', options.flat, options.export diff --git a/packages/angular/src/generators/directive/files/__directiveFileName__.directive.spec.ts__tpl__ b/packages/angular/src/generators/directive/files/__directiveFileName__.directive.spec.ts__tpl__ deleted file mode 100644 index fdb318fd15e10b..00000000000000 --- a/packages/angular/src/generators/directive/files/__directiveFileName__.directive.spec.ts__tpl__ +++ /dev/null @@ -1,8 +0,0 @@ -import { <%= directiveClassName %>Directive } from './<%= directiveFileName %>.directive'; - -describe('<%= directiveClassName %>Directive', () => { - it('should create an instance', () => { - const directive = new <%= directiveClassName %>Directive(); - expect(directive).toBeTruthy(); - }); -}); diff --git a/packages/angular/src/generators/directive/files/__fileName__.spec.ts__tpl__ b/packages/angular/src/generators/directive/files/__fileName__.spec.ts__tpl__ new file mode 100644 index 00000000000000..6b24ac8db3d266 --- /dev/null +++ b/packages/angular/src/generators/directive/files/__fileName__.spec.ts__tpl__ @@ -0,0 +1,8 @@ +import { <%= symbolName %> } from './<%= fileName %>'; + +describe('<%= symbolName %>', () => { + it('should create an instance', () => { + const directive = new <%= symbolName %>(); + expect(directive).toBeTruthy(); + }); +}); diff --git a/packages/angular/src/generators/directive/files/__directiveFileName__.directive.ts__tpl__ b/packages/angular/src/generators/directive/files/__fileName__.ts__tpl__ similarity index 76% rename from packages/angular/src/generators/directive/files/__directiveFileName__.directive.ts__tpl__ rename to packages/angular/src/generators/directive/files/__fileName__.ts__tpl__ index 10881ae3dec51e..ebe17b75731a73 100644 --- a/packages/angular/src/generators/directive/files/__directiveFileName__.directive.ts__tpl__ +++ b/packages/angular/src/generators/directive/files/__fileName__.ts__tpl__ @@ -4,7 +4,7 @@ import { Directive } from '@angular/core'; selector: '[<%= selector %>]'<% if(standalone) {%>, standalone: true<%}%> }) -export class <%= directiveClassName %>Directive { +export class <%= symbolName %> { constructor() { } diff --git a/packages/angular/src/generators/directive/lib/normalize-options.ts b/packages/angular/src/generators/directive/lib/normalize-options.ts index 165049dcd4ef7c..58c0d36f3a8ee9 100644 --- a/packages/angular/src/generators/directive/lib/normalize-options.ts +++ b/packages/angular/src/generators/directive/lib/normalize-options.ts @@ -1,22 +1,38 @@ import type { Tree } from '@nx/devkit'; -import { readProjectConfiguration } from '@nx/devkit'; +import { names, readProjectConfiguration } from '@nx/devkit'; import type { AngularProjectConfiguration } from '../../../utils/types'; -import { normalizeNameAndPaths } from '../../utils/path'; import { buildSelector } from '../../utils/selector'; import type { NormalizedSchema, Schema } from '../schema'; +import { determineArtifactNameAndDirectoryOptions } from '@nx/devkit/src/generators/artifact-name-and-directory-utils'; -export function normalizeOptions( +export async function normalizeOptions( tree: Tree, options: Schema -): NormalizedSchema { - const { directory, name, path } = normalizeNameAndPaths(tree, { - ...options, - type: 'directive', +): Promise { + const { + artifactName: name, + directory, + fileName, + filePath, + project, + } = await determineArtifactNameAndDirectoryOptions(tree, { + artifactType: 'directive', + callingGenerator: '@nx/angular:directive', + name: options.name, + directory: options.directory ?? options.path, + flat: options.flat, + nameAndDirectoryFormat: options.nameAndDirectoryFormat, + project: options.project, + suffix: 'directive', }); + const { className } = names(name); + const { className: suffixClassName } = names('directive'); + const symbolName = `${className}${suffixClassName}`; + const { prefix } = readProjectConfiguration( tree, - options.project + project ) as AngularProjectConfiguration; const selector = @@ -25,9 +41,12 @@ export function normalizeOptions( return { ...options, - directory, + project, name, - path, + directory, + fileName, + filePath, + symbolName, selector, }; } diff --git a/packages/angular/src/generators/directive/lib/validate-options.ts b/packages/angular/src/generators/directive/lib/validate-options.ts index 01ce0032013ff1..d51a443cd84fbc 100644 --- a/packages/angular/src/generators/directive/lib/validate-options.ts +++ b/packages/angular/src/generators/directive/lib/validate-options.ts @@ -1,13 +1,7 @@ import type { Tree } from '@nx/devkit'; -import { - validatePathIsUnderProjectRoot, - validateProject, - validateStandaloneOption, -} from '../../utils/validations'; +import { validateStandaloneOption } from '../../utils/validations'; import type { Schema } from '../schema'; export function validateOptions(tree: Tree, options: Schema): void { - validateProject(tree, options.project); - validatePathIsUnderProjectRoot(tree, options.project, options.path); validateStandaloneOption(tree, options.standalone); } diff --git a/packages/angular/src/generators/directive/schema.d.ts b/packages/angular/src/generators/directive/schema.d.ts index 5e70ed24e30ac6..76316f929e1369 100644 --- a/packages/angular/src/generators/directive/schema.d.ts +++ b/packages/angular/src/generators/directive/schema.d.ts @@ -1,19 +1,35 @@ +import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils'; + export interface Schema { name: string; - project: string; - path?: string; + directory?: string; + nameAndDirectoryFormat?: NameAndDirectoryFormat; prefix?: string; skipTests?: boolean; skipImport?: boolean; selector?: string; standalone?: boolean; - flat?: boolean; module?: string; export?: boolean; skipFormat?: boolean; + /** + * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18. + */ + flat?: boolean; + /** + * @deprecated Provide the `directory` option instead. It will be removed in Nx v18. + */ + path?: string; + /** + * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v18. + */ + project?: string; } export interface NormalizedSchema extends Schema { directory: string; - path: string; + filePath: string; + fileName: string; + symbolName: string; + project: string; } diff --git a/packages/angular/src/generators/directive/schema.json b/packages/angular/src/generators/directive/schema.json index 46ae84d8b7c4bc..9ac21fb8dcca79 100644 --- a/packages/angular/src/generators/directive/schema.json +++ b/packages/angular/src/generators/directive/schema.json @@ -4,7 +4,7 @@ "cli": "nx", "title": "Nx Angular Directive Options Schema", "type": "object", - "description": "Creates a new, generic directive definition in the given project.", + "description": "Creates a new Angular directive.", "additionalProperties": false, "properties": { "name": { @@ -16,14 +16,16 @@ }, "x-prompt": "What name would you like to use for the directive?" }, - "path": { + "directory": { "type": "string", - "format": "path", - "$default": { - "$source": "workingDirectory" - }, - "description": "The path at which to create the interface that defines the directive, relative to the workspace root.", - "visible": false + "description": "The directory at which to create the directive file. When `--nameAndDirectoryFormat=as-provided`, it will be relative to the current working directory. Otherwise, it will be relative to the workspace root.", + "aliases": ["dir", "path"], + "x-priority": "important" + }, + "nameAndDirectoryFormat": { + "description": "Whether to generate the directive in the directory as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).", + "type": "string", + "enum": ["as-provided", "derived"] }, "project": { "type": "string", @@ -31,7 +33,8 @@ "$default": { "$source": "projectName" }, - "x-dropdown": "projects" + "x-dropdown": "projects", + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v18." }, "prefix": { "type": "string", @@ -70,7 +73,8 @@ "flat": { "type": "boolean", "description": "When true (the default), creates the new files at the top level of the current project.", - "default": true + "default": true, + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18." }, "module": { "type": "string", @@ -88,5 +92,5 @@ "description": "Skip formatting of files." } }, - "required": ["name", "project"] + "required": ["name"] } diff --git a/packages/angular/src/generators/pipe/files/__fileName__.spec.ts__tpl__ b/packages/angular/src/generators/pipe/files/__fileName__.spec.ts__tpl__ new file mode 100644 index 00000000000000..e0be26b46cf071 --- /dev/null +++ b/packages/angular/src/generators/pipe/files/__fileName__.spec.ts__tpl__ @@ -0,0 +1,8 @@ +import { <%= symbolName %> } from './<%= fileName %>'; + +describe('<%= symbolName %>', () => { + it('create an instance', () => { + const pipe = new <%= symbolName %>(); + expect(pipe).toBeTruthy(); + }); +}); diff --git a/packages/angular/src/generators/pipe/files/__pipeFileName__.pipe.ts__tpl__ b/packages/angular/src/generators/pipe/files/__fileName__.ts__tpl__ similarity index 58% rename from packages/angular/src/generators/pipe/files/__pipeFileName__.pipe.ts__tpl__ rename to packages/angular/src/generators/pipe/files/__fileName__.ts__tpl__ index c59db204558b05..8f42b5cc1f45f7 100644 --- a/packages/angular/src/generators/pipe/files/__pipeFileName__.pipe.ts__tpl__ +++ b/packages/angular/src/generators/pipe/files/__fileName__.ts__tpl__ @@ -1,10 +1,10 @@ import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ - name: '<%= pipePropertyName %>'<% if(standalone) {%>, + name: '<%= selector %>'<% if(standalone) {%>, standalone: true<%}%> }) -export class <%= pipeClassName %>Pipe implements PipeTransform { +export class <%= symbolName %> implements PipeTransform { transform(value: unknown, ...args: unknown[]): unknown { return null; diff --git a/packages/angular/src/generators/pipe/files/__pipeFileName__.pipe.spec.ts__tpl__ b/packages/angular/src/generators/pipe/files/__pipeFileName__.pipe.spec.ts__tpl__ deleted file mode 100644 index cc652640a7fc4e..00000000000000 --- a/packages/angular/src/generators/pipe/files/__pipeFileName__.pipe.spec.ts__tpl__ +++ /dev/null @@ -1,8 +0,0 @@ -import { <%= pipeClassName %>Pipe } from './<%= pipeFileName %>.pipe'; - -describe('<%= pipeClassName %>Pipe', () => { - it('create an instance', () => { - const pipe = new <%= pipeClassName %>Pipe(); - expect(pipe).toBeTruthy(); - }); -}); diff --git a/packages/angular/src/generators/pipe/lib/normalize-options.ts b/packages/angular/src/generators/pipe/lib/normalize-options.ts index f273c799428fc0..33c3153c83a0a4 100644 --- a/packages/angular/src/generators/pipe/lib/normalize-options.ts +++ b/packages/angular/src/generators/pipe/lib/normalize-options.ts @@ -1,20 +1,40 @@ import type { Tree } from '@nx/devkit'; -import { normalizeNameAndPaths } from '../../utils/path'; import type { NormalizedSchema, Schema } from '../schema'; +import { determineArtifactNameAndDirectoryOptions } from '@nx/devkit/src/generators/artifact-name-and-directory-utils'; +import { names } from '@nx/devkit'; -export function normalizeOptions( +export async function normalizeOptions( tree: Tree, options: Schema -): NormalizedSchema { - const { directory, name, path } = normalizeNameAndPaths(tree, { - ...options, - type: 'pipe', +): Promise { + const { + artifactName: name, + directory, + fileName, + filePath, + project, + } = await determineArtifactNameAndDirectoryOptions(tree, { + artifactType: 'pipe', + callingGenerator: '@nx/angular:pipe', + name: options.name, + directory: options.directory ?? options.path, + flat: options.flat, + nameAndDirectoryFormat: options.nameAndDirectoryFormat, + project: options.project, + suffix: 'pipe', }); + const { className } = names(name); + const { className: suffixClassName } = names('pipe'); + const symbolName = `${className}${suffixClassName}`; + return { ...options, - directory, + project, name, - path, + directory, + fileName, + filePath, + symbolName, }; } diff --git a/packages/angular/src/generators/pipe/lib/validate-options.ts b/packages/angular/src/generators/pipe/lib/validate-options.ts index 01ce0032013ff1..d51a443cd84fbc 100644 --- a/packages/angular/src/generators/pipe/lib/validate-options.ts +++ b/packages/angular/src/generators/pipe/lib/validate-options.ts @@ -1,13 +1,7 @@ import type { Tree } from '@nx/devkit'; -import { - validatePathIsUnderProjectRoot, - validateProject, - validateStandaloneOption, -} from '../../utils/validations'; +import { validateStandaloneOption } from '../../utils/validations'; import type { Schema } from '../schema'; export function validateOptions(tree: Tree, options: Schema): void { - validateProject(tree, options.project); - validatePathIsUnderProjectRoot(tree, options.project, options.path); validateStandaloneOption(tree, options.standalone); } diff --git a/packages/angular/src/generators/pipe/pipe.ts b/packages/angular/src/generators/pipe/pipe.ts index a103c5a20dc4d5..045e94942be9fd 100644 --- a/packages/angular/src/generators/pipe/pipe.ts +++ b/packages/angular/src/generators/pipe/pipe.ts @@ -11,7 +11,7 @@ import type { Schema } from './schema'; export async function pipeGenerator(tree: Tree, rawOptions: Schema) { validateOptions(tree, rawOptions); - const options = normalizeOptions(tree, rawOptions); + const options = await normalizeOptions(tree, rawOptions); const pipeNames = names(options.name); @@ -20,9 +20,9 @@ export async function pipeGenerator(tree: Tree, rawOptions: Schema) { joinPathFragments(__dirname, 'files'), options.directory, { - pipeClassName: pipeNames.className, - pipeFileName: pipeNames.fileName, - pipePropertyName: pipeNames.propertyName, + symbolName: options.symbolName, + fileName: options.fileName, + selector: pipeNames.propertyName, standalone: options.standalone, tpl: '', } @@ -31,21 +31,21 @@ export async function pipeGenerator(tree: Tree, rawOptions: Schema) { if (options.skipTests) { const pathToSpecFile = joinPathFragments( options.directory, - `${pipeNames.fileName}.pipe.spec.ts` + `${options.fileName}.spec.ts` ); tree.delete(pathToSpecFile); } if (!options.skipImport && !options.standalone) { - const modulePath = findModule(tree, options.path, options.module); + const modulePath = findModule(tree, options.directory, options.module); addToNgModule( tree, - options.path, + options.directory, modulePath, - pipeNames.fileName, - `${pipeNames.className}Pipe`, - `${pipeNames.fileName}.pipe`, + '', + options.symbolName, + options.fileName, 'declarations', options.flat, options.export diff --git a/packages/angular/src/generators/pipe/schema.d.ts b/packages/angular/src/generators/pipe/schema.d.ts index 87c13019442bec..2e5ed3204e635b 100644 --- a/packages/angular/src/generators/pipe/schema.d.ts +++ b/packages/angular/src/generators/pipe/schema.d.ts @@ -1,17 +1,33 @@ +import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils'; + export interface Schema { name: string; - project: string; - path?: string; - flat?: boolean; + directory?: string; + nameAndDirectoryFormat?: NameAndDirectoryFormat; skipTests?: boolean; skipImport?: boolean; standalone?: boolean; module?: string; export?: boolean; skipFormat?: boolean; + /** + * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18. + */ + flat?: boolean; + /** + * @deprecated Provide the `directory` option instead. It will be removed in Nx v18. + */ + path?: string; + /** + * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v18. + */ + project?: string; } export interface NormalizedSchema extends Schema { directory: string; - path: string; + filePath: string; + project: string; + fileName: string; + symbolName: string; } diff --git a/packages/angular/src/generators/pipe/schema.json b/packages/angular/src/generators/pipe/schema.json index 32775a8aecc149..0be12fae31dbd1 100644 --- a/packages/angular/src/generators/pipe/schema.json +++ b/packages/angular/src/generators/pipe/schema.json @@ -5,7 +5,7 @@ "type": "object", "cli": "nx", "additionalProperties": false, - "description": "Creates a new, generic pipe definition in the given project.", + "description": "Creates an Angular pipe.", "properties": { "name": { "type": "string", @@ -16,14 +16,16 @@ }, "x-prompt": "What name would you like to use for the pipe?" }, - "path": { + "directory": { "type": "string", - "format": "path", - "$default": { - "$source": "workingDirectory" - }, - "description": "The path at which to create the pipe, relative to the workspace root.", - "visible": false + "description": "The directory at which to create the pipe file. When `--nameAndDirectoryFormat=as-provided`, it will be relative to the current working directory. Otherwise, it will be relative to the workspace root.", + "aliases": ["dir", "path"], + "x-priority": "important" + }, + "nameAndDirectoryFormat": { + "description": "Whether to generate the pipe in the directory as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).", + "type": "string", + "enum": ["as-provided", "derived"] }, "project": { "type": "string", @@ -31,12 +33,14 @@ "$default": { "$source": "projectName" }, - "x-dropdown": "projects" + "x-dropdown": "projects", + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v18." }, "flat": { "type": "boolean", "default": true, - "description": "When true (the default) creates files at the top level of the project." + "description": "When true (the default) creates files at the top level of the project.", + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18." }, "skipTests": { "type": "boolean", @@ -69,5 +73,5 @@ "description": "Skip formatting of files." } }, - "required": ["name", "project"] + "required": ["name"] } diff --git a/packages/angular/src/generators/scam-directive/lib/convert-directive-to-scam.spec.ts b/packages/angular/src/generators/scam-directive/lib/convert-directive-to-scam.spec.ts index 82ab6e68ee6db6..0bec5db564edc9 100644 --- a/packages/angular/src/generators/scam-directive/lib/convert-directive-to-scam.spec.ts +++ b/packages/angular/src/generators/scam-directive/lib/convert-directive-to-scam.spec.ts @@ -32,6 +32,7 @@ describe('convertDirectiveToScam', () => { flat: false, inlineScam: true, path: 'apps/app1/src/app', + symbolName: 'ExampleDirective', }); // ASSERT @@ -87,6 +88,7 @@ describe('convertDirectiveToScam', () => { flat: false, inlineScam: false, path: 'apps/app1/src/app', + symbolName: 'ExampleDirective', }); // ASSERT @@ -136,6 +138,7 @@ describe('convertDirectiveToScam', () => { inlineScam: true, flat: true, path: 'apps/app1/src/app', + symbolName: 'ExampleDirective', }); // ASSERT @@ -191,6 +194,7 @@ describe('convertDirectiveToScam', () => { inlineScam: false, flat: true, path: 'apps/app1/src/app', + symbolName: 'ExampleDirective', }); // ASSERT @@ -241,6 +245,7 @@ describe('convertDirectiveToScam', () => { flat: false, inlineScam: true, path: 'apps/app1/src/app/random', + symbolName: 'ExampleDirective', }); // ASSERT @@ -297,6 +302,7 @@ describe('convertDirectiveToScam', () => { flat: true, inlineScam: true, path: 'apps/app1/src/app/random', + symbolName: 'ExampleDirective', }); // ASSERT diff --git a/packages/angular/src/generators/scam-directive/lib/convert-directive-to-scam.ts b/packages/angular/src/generators/scam-directive/lib/convert-directive-to-scam.ts index 711c06d211f74b..8a0e6749c91cf2 100644 --- a/packages/angular/src/generators/scam-directive/lib/convert-directive-to-scam.ts +++ b/packages/angular/src/generators/scam-directive/lib/convert-directive-to-scam.ts @@ -19,10 +19,6 @@ export function convertDirectiveToScam( tsModule = ensureTypescript(); } - const directiveNames = names(options.name); - const typeNames = names('directive'); - const directiveClassName = `${directiveNames.className}${typeNames.className}`; - if (options.inlineScam) { const currentDirectiveContents = tree.read(options.filePath, 'utf-8'); let source = tsModule.createSourceFile( @@ -49,7 +45,7 @@ export function convertDirectiveToScam( let updatedDirectiveSource = source.getText(); updatedDirectiveSource = `${updatedDirectiveSource}${getNgModuleDeclaration( - directiveClassName + options.symbolName )}`; tree.write(options.filePath, updatedDirectiveSource); @@ -58,12 +54,12 @@ export function convertDirectiveToScam( const scamFilePath = joinPathFragments( options.directory, - `${directiveNames.fileName}.module.ts` + `${options.name}.module.ts` ); tree.write( scamFilePath, - getModuleFileContent(directiveClassName, options.fileName) + getModuleFileContent(options.symbolName, options.fileName) ); } diff --git a/packages/angular/src/generators/scam-directive/lib/normalize-options.ts b/packages/angular/src/generators/scam-directive/lib/normalize-options.ts index 299d946ab9e7b0..720640900eb3a4 100644 --- a/packages/angular/src/generators/scam-directive/lib/normalize-options.ts +++ b/packages/angular/src/generators/scam-directive/lib/normalize-options.ts @@ -1,28 +1,43 @@ import type { Tree } from '@nx/devkit'; import { normalizeNameAndPaths } from '../../utils/path'; import type { NormalizedSchema, Schema } from '../schema'; +import { determineArtifactNameAndDirectoryOptions } from '@nx/devkit/src/generators/artifact-name-and-directory-utils'; +import { names } from '@nx/devkit'; -export function normalizeOptions( +export async function normalizeOptions( tree: Tree, options: Schema -): NormalizedSchema { - const { directory, fileName, filePath, name, path } = normalizeNameAndPaths( - tree, - { - ...options, - type: 'directive', - } - ); +): Promise { + const { + artifactName: name, + directory, + fileName, + filePath, + project, + } = await determineArtifactNameAndDirectoryOptions(tree, { + artifactType: 'directive', + callingGenerator: '@nx/angular:scam-directive', + name: options.name, + directory: options.directory ?? options.path, + flat: options.flat, + nameAndDirectoryFormat: options.nameAndDirectoryFormat, + project: options.project, + suffix: 'directive', + }); + + const { className } = names(name); + const { className: suffixClassName } = names('directive'); + const symbolName = `${className}${suffixClassName}`; return { ...options, export: options.export ?? true, - flat: options.flat ?? true, inlineScam: options.inlineScam ?? true, directory, fileName, filePath, - path, name, + symbolName, + project, }; } diff --git a/packages/angular/src/generators/scam-directive/scam-directive.ts b/packages/angular/src/generators/scam-directive/scam-directive.ts index 3a7b8884d7c264..4b509255555773 100644 --- a/packages/angular/src/generators/scam-directive/scam-directive.ts +++ b/packages/angular/src/generators/scam-directive/scam-directive.ts @@ -21,7 +21,7 @@ export async function scamDirectiveGenerator(tree: Tree, rawOptions: Schema) { skipFormat: true, }); - const options = normalizeOptions(tree, rawOptions); + const options = await normalizeOptions(tree, rawOptions); convertDirectiveToScam(tree, options); exportScam(tree, options); diff --git a/packages/angular/src/generators/scam-directive/schema.d.ts b/packages/angular/src/generators/scam-directive/schema.d.ts index bae6bcb67d77c1..4baa183ba0ae1e 100644 --- a/packages/angular/src/generators/scam-directive/schema.d.ts +++ b/packages/angular/src/generators/scam-directive/schema.d.ts @@ -1,13 +1,26 @@ +import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils'; + export interface Schema { name: string; - project: string; - path?: string; + directory?: string; + nameAndDirectoryFormat?: NameAndDirectoryFormat; skipTests?: boolean; inlineScam?: boolean; - flat?: boolean; prefix?: string; selector?: string; export?: boolean; + /** + * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18. + */ + flat?: boolean; + /** + * @deprecated Provide the `directory` option instead. It will be removed in Nx v18. + */ + path?: string; + /** + * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v18. + */ + project?: string; } export interface NormalizedSchema extends Schema { @@ -15,7 +28,7 @@ export interface NormalizedSchema extends Schema { export: boolean; fileName: string; filePath: string; - flat: boolean; inlineScam: boolean; - path: string; + symbolName: string; + project: string; } diff --git a/packages/angular/src/generators/scam-directive/schema.json b/packages/angular/src/generators/scam-directive/schema.json index 0c61aaa88614e3..4244a0f146f316 100644 --- a/packages/angular/src/generators/scam-directive/schema.json +++ b/packages/angular/src/generators/scam-directive/schema.json @@ -6,27 +6,13 @@ "type": "object", "examples": [ { - "command": "nx g @nx/angular:scam-directive --project=my-lib --flat=false my-sample", + "command": "nx g @nx/angular:scam-directive my-sample --directory=my-lib/src/lib/my-sample", "description": "Generate a `MySampleDirective` directive in a `my-sample` folder in the `my-lib` library" } ], "description": "Creates a new, generic Angular directive definition in the given or default project.", "additionalProperties": false, "properties": { - "path": { - "type": "string", - "format": "path", - "description": "The path at which to create the directive file, relative to the current workspace. Default is a folder with the same name as the directive in the project root.", - "visible": false - }, - "project": { - "type": "string", - "description": "The name of the project.", - "$default": { - "$source": "projectName" - }, - "x-dropdown": "projects" - }, "name": { "type": "string", "description": "The name of the directive.", @@ -37,6 +23,26 @@ "x-prompt": "What name would you like to use for the directive?", "x-priority": "important" }, + "directory": { + "type": "string", + "description": "The directory at which to create the SCAM Directive files. When `--nameAndDirectoryFormat=as-provided`, it will be relative to the current working directory. Otherwise, it will be relative to the workspace root.", + "aliases": ["dir", "path"], + "x-priority": "important" + }, + "nameAndDirectoryFormat": { + "description": "Whether to generate the component in the directory as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).", + "type": "string", + "enum": ["as-provided", "derived"] + }, + "project": { + "type": "string", + "description": "The name of the project.", + "$default": { + "$source": "projectName" + }, + "x-dropdown": "projects", + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v18." + }, "skipTests": { "type": "boolean", "description": "Do not create `spec.ts` test files for the new directive.", @@ -51,7 +57,8 @@ "flat": { "type": "boolean", "description": "Create the new files at the top level of the current project.", - "default": true + "default": true, + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18." }, "selector": { "type": "string", @@ -79,5 +86,5 @@ "x-priority": "important" } }, - "required": ["name", "project"] + "required": ["name"] } diff --git a/packages/angular/src/generators/scam-pipe/lib/convert-pipe-to-scam.spec.ts b/packages/angular/src/generators/scam-pipe/lib/convert-pipe-to-scam.spec.ts index a1dcd21be7c77c..56626e557b234f 100644 --- a/packages/angular/src/generators/scam-pipe/lib/convert-pipe-to-scam.spec.ts +++ b/packages/angular/src/generators/scam-pipe/lib/convert-pipe-to-scam.spec.ts @@ -32,6 +32,7 @@ describe('convertPipeToScam', () => { flat: false, inlineScam: true, path: 'apps/app1/src/app', + symbolName: 'ExamplePipe', }); // ASSERT @@ -89,6 +90,7 @@ describe('convertPipeToScam', () => { flat: false, inlineScam: false, path: 'apps/app1/src/app', + symbolName: 'ExamplePipe', }); // ASSERT @@ -138,6 +140,7 @@ describe('convertPipeToScam', () => { inlineScam: true, flat: true, path: 'apps/app1/src/app', + symbolName: 'ExamplePipe', }); // ASSERT @@ -192,6 +195,7 @@ describe('convertPipeToScam', () => { inlineScam: false, flat: true, path: 'apps/app1/src/app', + symbolName: 'ExamplePipe', }); // ASSERT @@ -242,6 +246,7 @@ describe('convertPipeToScam', () => { flat: false, inlineScam: true, path: 'apps/app1/src/app/random', + symbolName: 'ExamplePipe', }); // ASSERT @@ -300,6 +305,7 @@ describe('convertPipeToScam', () => { flat: true, inlineScam: true, path: 'apps/app1/src/app/random', + symbolName: 'ExamplePipe', }); // ASSERT diff --git a/packages/angular/src/generators/scam-pipe/lib/convert-pipe-to-scam.ts b/packages/angular/src/generators/scam-pipe/lib/convert-pipe-to-scam.ts index a1e4cf088c95f6..cff1d806c6a158 100644 --- a/packages/angular/src/generators/scam-pipe/lib/convert-pipe-to-scam.ts +++ b/packages/angular/src/generators/scam-pipe/lib/convert-pipe-to-scam.ts @@ -16,10 +16,6 @@ export function convertPipeToScam(tree: Tree, options: NormalizedSchema) { tsModule = ensureTypescript(); } - const pipeNames = names(options.name); - const typeNames = names('pipe'); - const pipeClassName = `${pipeNames.className}${typeNames.className}`; - if (options.inlineScam) { const currentPipeContents = tree.read(options.filePath, 'utf-8'); let source = tsModule.createSourceFile( @@ -46,7 +42,7 @@ export function convertPipeToScam(tree: Tree, options: NormalizedSchema) { let updatedPipeSource = source.getText(); updatedPipeSource = `${updatedPipeSource}${getNgModuleDeclaration( - pipeClassName + options.symbolName )}`; tree.write(options.filePath, updatedPipeSource); @@ -55,12 +51,12 @@ export function convertPipeToScam(tree: Tree, options: NormalizedSchema) { const scamFilePath = joinPathFragments( options.directory, - `${pipeNames.fileName}.module.ts` + `${options.name}.module.ts` ); tree.write( scamFilePath, - getModuleFileContent(pipeClassName, options.fileName) + getModuleFileContent(options.symbolName, options.fileName) ); } diff --git a/packages/angular/src/generators/scam-pipe/lib/normalize-options.ts b/packages/angular/src/generators/scam-pipe/lib/normalize-options.ts index 1f0aa2cbaa812e..d9a96e542f2ad6 100644 --- a/packages/angular/src/generators/scam-pipe/lib/normalize-options.ts +++ b/packages/angular/src/generators/scam-pipe/lib/normalize-options.ts @@ -1,28 +1,42 @@ import type { Tree } from '@nx/devkit'; -import { normalizeNameAndPaths } from '../../utils/path'; import type { NormalizedSchema, Schema } from '../schema'; +import { determineArtifactNameAndDirectoryOptions } from '@nx/devkit/src/generators/artifact-name-and-directory-utils'; +import { names } from '@nx/devkit'; -export function normalizeOptions( +export async function normalizeOptions( tree: Tree, options: Schema -): NormalizedSchema { - const { directory, fileName, filePath, name, path } = normalizeNameAndPaths( - tree, - { - ...options, - type: 'pipe', - } - ); +): Promise { + const { + artifactName: name, + directory, + fileName, + filePath, + project, + } = await determineArtifactNameAndDirectoryOptions(tree, { + artifactType: 'pipe', + callingGenerator: '@nx/angular:scam-pipe', + name: options.name, + directory: options.directory ?? options.path, + flat: options.flat, + nameAndDirectoryFormat: options.nameAndDirectoryFormat, + project: options.project, + suffix: 'pipe', + }); + + const { className } = names(name); + const { className: suffixClassName } = names('pipe'); + const symbolName = `${className}${suffixClassName}`; return { ...options, export: options.export ?? true, - flat: options.flat ?? true, inlineScam: options.inlineScam ?? true, directory, fileName, filePath, name, - path, + symbolName, + project, }; } diff --git a/packages/angular/src/generators/scam-pipe/scam-pipe.ts b/packages/angular/src/generators/scam-pipe/scam-pipe.ts index 0194d40764828a..6842073bf62a2c 100644 --- a/packages/angular/src/generators/scam-pipe/scam-pipe.ts +++ b/packages/angular/src/generators/scam-pipe/scam-pipe.ts @@ -17,7 +17,7 @@ export async function scamPipeGenerator(tree: Tree, rawOptions: Schema) { skipFormat: true, }); - const options = normalizeOptions(tree, rawOptions); + const options = await normalizeOptions(tree, rawOptions); convertPipeToScam(tree, options); exportScam(tree, options); diff --git a/packages/angular/src/generators/scam-pipe/schema.d.ts b/packages/angular/src/generators/scam-pipe/schema.d.ts index 29ff79a5311de6..ec538eb742a80c 100644 --- a/packages/angular/src/generators/scam-pipe/schema.d.ts +++ b/packages/angular/src/generators/scam-pipe/schema.d.ts @@ -1,11 +1,24 @@ +import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils'; + export interface Schema { name: string; - project: string; - path?: string; + directory?: string; + nameAndDirectoryFormat?: NameAndDirectoryFormat; skipTests?: boolean; inlineScam?: boolean; - flat?: boolean; export?: boolean; + /** + * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18. + */ + flat?: boolean; + /** + * @deprecated Provide the `directory` option instead. It will be removed in Nx v18. + */ + path?: string; + /** + * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v18. + */ + project?: string; } export interface NormalizedSchema extends Schema { @@ -13,7 +26,7 @@ export interface NormalizedSchema extends Schema { export: boolean; fileName: string; filePath: string; - flat: boolean; inlineScam: boolean; - path: string; + project: string; + symbolName: string; } diff --git a/packages/angular/src/generators/scam-pipe/schema.json b/packages/angular/src/generators/scam-pipe/schema.json index 089a462452062d..025eafe1b6cd38 100644 --- a/packages/angular/src/generators/scam-pipe/schema.json +++ b/packages/angular/src/generators/scam-pipe/schema.json @@ -13,20 +13,6 @@ "description": "Creates a new, generic Angular pipe definition in the given or default project.", "additionalProperties": false, "properties": { - "path": { - "type": "string", - "format": "path", - "description": "The path at which to create the pipe file, relative to the current workspace. Default is a folder with the same name as the pipe in the project root.", - "visible": false - }, - "project": { - "type": "string", - "description": "The name of the project.", - "$default": { - "$source": "projectName" - }, - "x-dropdown": "projects" - }, "name": { "type": "string", "description": "The name of the pipe.", @@ -37,6 +23,26 @@ "x-prompt": "What name would you like to use for the pipe?", "x-priority": "important" }, + "directory": { + "type": "string", + "description": "The directory at which to create the component file. When `--nameAndDirectoryFormat=as-provided`, it will be relative to the current working directory. Otherwise, it will be relative to the workspace root.", + "aliases": ["dir", "path"], + "x-priority": "important" + }, + "nameAndDirectoryFormat": { + "description": "Whether to generate the component in the directory as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).", + "type": "string", + "enum": ["as-provided", "derived"] + }, + "project": { + "type": "string", + "description": "The name of the project.", + "$default": { + "$source": "projectName" + }, + "x-dropdown": "projects", + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v18." + }, "skipTests": { "type": "boolean", "description": "Do not create `spec.ts` test files for the new pipe.", @@ -51,7 +57,8 @@ "flat": { "type": "boolean", "description": "Create the new files at the top level of the current project.", - "default": true + "default": true, + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18." }, "export": { "type": "boolean", @@ -60,5 +67,5 @@ "x-priority": "important" } }, - "required": ["name", "project"] + "required": ["name"] } diff --git a/packages/angular/src/generators/scam/lib/convert-component-to-scam.spec.ts b/packages/angular/src/generators/scam/lib/convert-component-to-scam.spec.ts index 1de216f33efea6..2c57b50b14727a 100644 --- a/packages/angular/src/generators/scam/lib/convert-component-to-scam.spec.ts +++ b/packages/angular/src/generators/scam/lib/convert-component-to-scam.spec.ts @@ -30,6 +30,7 @@ describe('convertComponentToScam', () => { export: false, inlineScam: true, path: 'apps/app1/src/app', + symbolName: 'ExampleComponent', }); // ASSERT @@ -83,6 +84,7 @@ describe('convertComponentToScam', () => { export: false, inlineScam: false, path: 'apps/app1/src/app', + symbolName: 'ExampleComponent', }); // ASSERT @@ -132,6 +134,7 @@ describe('convertComponentToScam', () => { inlineScam: true, flat: true, path: 'apps/app1/src/app', + symbolName: 'ExampleComponent', }); // ASSERT @@ -187,6 +190,7 @@ describe('convertComponentToScam', () => { inlineScam: false, flat: true, path: 'apps/app1/src/app', + symbolName: 'ExampleComponent', }); // ASSERT @@ -238,6 +242,7 @@ describe('convertComponentToScam', () => { flat: true, type: 'random', path: 'apps/app1/src/app', + symbolName: 'ExampleRandom', }); // ASSERT @@ -295,6 +300,7 @@ describe('convertComponentToScam', () => { flat: true, type: 'random', path: 'apps/app1/src/app', + symbolName: 'ExampleRandom', }); // ASSERT @@ -345,6 +351,7 @@ describe('convertComponentToScam', () => { flat: false, inlineScam: true, path: 'apps/app1/src/app/random', + symbolName: 'ExampleComponent', }); // ASSERT @@ -401,6 +408,7 @@ describe('convertComponentToScam', () => { flat: true, inlineScam: true, path: 'apps/app1/src/app/random', + symbolName: 'ExampleComponent', }); // ASSERT diff --git a/packages/angular/src/generators/scam/lib/convert-component-to-scam.ts b/packages/angular/src/generators/scam/lib/convert-component-to-scam.ts index 4050bc7e8e0811..75d948c29e3ecb 100644 --- a/packages/angular/src/generators/scam/lib/convert-component-to-scam.ts +++ b/packages/angular/src/generators/scam/lib/convert-component-to-scam.ts @@ -13,10 +13,6 @@ export function convertComponentToScam(tree: Tree, options: NormalizedSchema) { ); } - const componentNames = names(options.name); - const typeNames = names(options.type ?? 'component'); - const componentClassName = `${componentNames.className}${typeNames.className}`; - if (!tsModule) { tsModule = ensureTypescript(); } @@ -47,7 +43,7 @@ export function convertComponentToScam(tree: Tree, options: NormalizedSchema) { let updatedComponentSource = source.getText(); updatedComponentSource = `${updatedComponentSource}${getNgModuleDeclaration( - componentClassName + options.symbolName )}`; tree.write(options.filePath, updatedComponentSource); @@ -56,12 +52,12 @@ export function convertComponentToScam(tree: Tree, options: NormalizedSchema) { const moduleFilePath = joinPathFragments( options.directory, - `${componentNames.fileName}.module.ts` + `${options.name}.module.ts` ); tree.write( moduleFilePath, - getModuleFileContent(componentClassName, options.fileName) + getModuleFileContent(options.symbolName, options.fileName) ); } diff --git a/packages/angular/src/generators/scam/lib/normalize-options.ts b/packages/angular/src/generators/scam/lib/normalize-options.ts index 331bced481fded..475dd50aa13af9 100644 --- a/packages/angular/src/generators/scam/lib/normalize-options.ts +++ b/packages/angular/src/generators/scam/lib/normalize-options.ts @@ -1,16 +1,34 @@ import type { Tree } from '@nx/devkit'; -import { normalizeNameAndPaths } from '../../utils/path'; import type { NormalizedSchema, Schema } from '../schema'; +import { determineArtifactNameAndDirectoryOptions } from '@nx/devkit/src/generators/artifact-name-and-directory-utils'; +import { names } from '@nx/devkit'; -export function normalizeOptions( +export async function normalizeOptions( tree: Tree, options: Schema -): NormalizedSchema { - const { directory, fileName, filePath, name } = normalizeNameAndPaths(tree, { - ...options, - type: options.type ?? 'component', +): Promise { + options.type ??= 'component'; + const { + artifactName: name, + directory, + fileName, + filePath, + project, + } = await determineArtifactNameAndDirectoryOptions(tree, { + artifactType: options.type, + callingGenerator: '@nx/angular:scam', + name: options.name, + directory: options.directory ?? options.path, + flat: options.flat, + nameAndDirectoryFormat: options.nameAndDirectoryFormat, + project: options.project, + suffix: options.type ?? 'component', }); + const { className } = names(name); + const { className: suffixClassName } = names(options.type); + const symbolName = `${className}${suffixClassName}`; + return { ...options, export: options.export ?? true, @@ -19,5 +37,7 @@ export function normalizeOptions( fileName, filePath, name, + symbolName, + project, }; } diff --git a/packages/angular/src/generators/scam/scam.ts b/packages/angular/src/generators/scam/scam.ts index 1c23c7abcb0c25..cdb3f4be97e24f 100644 --- a/packages/angular/src/generators/scam/scam.ts +++ b/packages/angular/src/generators/scam/scam.ts @@ -21,7 +21,7 @@ export async function scamGenerator(tree: Tree, rawOptions: Schema) { skipFormat: true, }); - const options = normalizeOptions(tree, rawOptions); + const options = await normalizeOptions(tree, rawOptions); convertComponentToScam(tree, options); exportScam(tree, options); diff --git a/packages/angular/src/generators/scam/schema.d.ts b/packages/angular/src/generators/scam/schema.d.ts index 05e4c0fbd7c350..f9db5013b87ae7 100644 --- a/packages/angular/src/generators/scam/schema.d.ts +++ b/packages/angular/src/generators/scam/schema.d.ts @@ -1,7 +1,9 @@ +import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils'; + export interface Schema { name: string; - project: string; - path?: string; + directory?: string; + nameAndDirectoryFormat?: NameAndDirectoryFormat; displayBlock?: boolean; inlineStyle?: boolean; inlineTemplate?: boolean; @@ -11,18 +13,31 @@ export interface Schema { skipTests?: boolean; inlineScam?: boolean; type?: string; - flat?: boolean; prefix?: string; selector?: string; skipSelector?: boolean; export?: boolean; skipFormat?: boolean; + /** + * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18. + */ + flat?: boolean; + /** + * @deprecated Provide the `directory` option instead. It will be removed in Nx v18. + */ + path?: string; + /** + * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v18. + */ + project?: string; } export interface NormalizedSchema extends Schema { directory: string; + project: string; fileName: string; filePath: string; + symbolName: string; export: boolean; inlineScam: boolean; } diff --git a/packages/angular/src/generators/scam/schema.json b/packages/angular/src/generators/scam/schema.json index 03658184f760ad..f2843277451a98 100644 --- a/packages/angular/src/generators/scam/schema.json +++ b/packages/angular/src/generators/scam/schema.json @@ -6,27 +6,13 @@ "type": "object", "examples": [ { - "command": "nx g @nx/angular:scam --project=my-lib my-sample", + "command": "nx g @nx/angular:scam my-sample --directory=my-lib/src/lib/my-sample", "description": "Generate a `MySampleComponent` component in the `my-lib` library." } ], - "description": "Creates a new, generic Angular component definition in the given or default project.", + "description": "Creates a new Angular SCAM.", "additionalProperties": false, "properties": { - "path": { - "type": "string", - "format": "path", - "description": "The path at which to create the component file, relative to the current workspace. Default is a folder with the same name as the component in the project root.", - "visible": false - }, - "project": { - "type": "string", - "description": "The name of the project.", - "$default": { - "$source": "projectName" - }, - "x-dropdown": "projects" - }, "name": { "type": "string", "description": "The name of the component.", @@ -36,6 +22,26 @@ }, "x-prompt": "What name would you like to use for the component?" }, + "directory": { + "type": "string", + "description": "The directory at which to create the SCAM files. When `--nameAndDirectoryFormat=as-provided`, it will be relative to the current working directory. Otherwise, it will be relative to the workspace root.", + "aliases": ["dir", "path"], + "x-priority": "important" + }, + "nameAndDirectoryFormat": { + "description": "Whether to generate the SCAM in the directory as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).", + "type": "string", + "enum": ["as-provided", "derived"] + }, + "project": { + "type": "string", + "description": "The name of the project.", + "$default": { + "$source": "projectName" + }, + "x-dropdown": "projects", + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v18." + }, "displayBlock": { "description": "Specifies if the style will contain `:host { display: block; }`.", "type": "boolean", @@ -87,7 +93,8 @@ "flat": { "type": "boolean", "description": "Create the new files at the top level of the current project.", - "default": false + "default": false, + "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18." }, "selector": { "type": "string", @@ -131,5 +138,5 @@ "x-priority": "internal" } }, - "required": ["name", "project"] + "required": ["name"] } From 80fde793741dc6c0fe8a249c624e980d98dc489b Mon Sep 17 00:00:00 2001 From: Colum Ferry Date: Fri, 13 Oct 2023 17:14:16 +0100 Subject: [PATCH 3/9] feat(misc): remove deprecated Angular CLI usage of schematics and builders (#19557) --- docs/generated/devkit/ngcli_adapter/README.md | 1 - .../overrideCollectionResolutionForTesting.md | 32 ---- .../devkit/documents/ngcli_adapter.md | 1 - e2e/angular-core/src/ng-add.test.ts | 12 +- packages/angular/executors.json | 20 --- packages/angular/generators.json | 154 ------------------ packages/angular/package.json | 4 +- .../src/executors/browser-esbuild/compat.ts | 5 - .../src/executors/delegate-build/compat.ts | 5 - .../src/executors/ng-packagr-lite/compat.ts | 5 - .../angular/src/executors/package/compat.ts | 5 - .../src/generators/add-linting/compat.ts | 5 - .../application/application.compat.ts | 7 - .../component-cypress-spec/compat.ts | 7 - .../src/generators/component-story/compat.ts | 7 - .../src/generators/component-test/compat.ts | 7 - .../generators/component/component.compat.ts | 5 - .../convert-to-with-mf.compat.ts | 5 - .../cypress-component-configuration/compat.ts | 7 - .../federate-module/federate-module.compat.ts | 5 - .../src/generators/host/host.compat.ts | 5 - .../src/generators/init/init.compat.ts | 7 - .../library-secondary-entry-point/compat.ts | 7 - .../src/generators/library/library.compat.ts | 7 - .../angular/src/generators/move/compat.ts | 7 - .../angular/src/generators/ng-add/compat.ts | 4 - .../angular/src/generators/ngrx/compat.ts | 5 - .../src/generators/remote/remote.compat.ts | 5 - .../scam-directive/scam-directive.compat.ts | 5 - .../generators/scam-pipe/scam-pipe.compat.ts | 5 - .../generators/scam-to-standalone/compat.ts | 5 - .../src/generators/scam/scam.compat.ts | 5 - .../generators/setup-mf/setup-mf.compat.ts | 5 - .../generators/setup-ssr/setup-ssr.compat.ts | 5 - .../setup-tailwind/setup-tailwind.compat.ts | 7 - .../angular/src/generators/stories/compat.ts | 7 - .../storybook-configuration/compat.ts | 7 - .../storybook-utilities.spec.ts} | 42 ++--- .../utils/warn-for-schematic-usage.ts | 7 - .../src/generators/web-worker/compat.ts | 5 - packages/cypress/executors.json | 7 - packages/cypress/generators.json | 31 ---- packages/cypress/package.json | 4 +- .../cypress/src/executors/cypress/compat.ts | 5 - .../component-configuration.ts | 2 - .../generators/configuration/configuration.ts | 3 +- .../cypress-project/cypress-project.ts | 4 - packages/cypress/src/generators/init/init.ts | 2 - packages/detox/generators.json | 15 -- packages/detox/package.json | 4 +- packages/detox/src/executors/build/compat.ts | 5 - packages/detox/src/executors/test/compat.ts | 5 - .../src/generators/application/application.ts | 10 +- packages/detox/src/generators/init/init.ts | 2 - packages/devkit/ngcli-adapter.ts | 1 - packages/esbuild/executors.json | 7 - packages/esbuild/generators.json | 14 -- packages/esbuild/package.json | 4 +- .../esbuild/src/executors/esbuild/compat.ts | 5 - .../generators/configuration/configuration.ts | 3 - packages/esbuild/src/generators/init/init.ts | 9 +- packages/expo/executors.json | 57 ------- packages/expo/generators.json | 28 ---- packages/expo/package.json | 4 +- .../expo/src/executors/build-list/compat.ts | 5 - packages/expo/src/executors/build/compat.ts | 5 - .../src/executors/ensure-symlink/compat.ts | 5 - packages/expo/src/executors/export/compat.ts | 5 - packages/expo/src/executors/install/compat.ts | 5 - .../expo/src/executors/prebuild/compat.ts | 5 - packages/expo/src/executors/run/compat.ts | 5 - packages/expo/src/executors/start/compat.ts | 5 - packages/expo/src/executors/submit/compat.ts | 5 - .../expo/src/executors/sync-deps/compat.ts | 5 - packages/expo/src/executors/update/compat.ts | 5 - .../src/generators/application/application.ts | 4 - .../src/generators/component/component.ts | 4 - packages/expo/src/generators/init/init.ts | 2 - .../expo/src/generators/library/library.ts | 2 - packages/express/generators.json | 18 -- packages/express/package.json | 2 +- .../src/generators/application/application.ts | 3 +- packages/express/src/generators/init/init.ts | 2 - packages/jest/executors.json | 7 - packages/jest/generators.json | 15 -- packages/jest/package.json | 4 +- packages/jest/src/executors/jest/compat.ts | 5 - .../generators/configuration/configuration.ts | 3 - packages/jest/src/generators/init/init.ts | 4 - packages/js/executors.json | 22 --- packages/js/generators.json | 35 ---- packages/js/package.json | 2 - packages/js/src/executors/node/compat.ts | 4 - packages/js/src/executors/swc/compat.ts | 4 - packages/js/src/executors/tsc/compat.ts | 5 - packages/js/src/executors/verdaccio/compat.ts | 5 - .../convert-to-swc/convert-to-swc.ts | 2 - packages/js/src/generators/init/init.ts | 4 - packages/js/src/generators/library/library.ts | 3 +- .../src/generators/setup-build/generator.ts | 2 - .../generators/setup-verdaccio/generator.ts | 2 - packages/linter/executors.json | 7 - packages/linter/generators.json | 13 -- packages/linter/package.json | 4 +- .../linter/src/executors/eslint/compat.ts | 5 - .../workspace-rule/workspace-rule.ts | 5 - .../workspace-rules-project.ts | 5 - packages/nest/generators.json | 98 ----------- packages/nest/package.json | 2 +- .../src/generators/application/application.ts | 4 +- packages/nest/src/generators/class/class.ts | 3 - .../src/generators/controller/controller.ts | 3 - .../src/generators/decorator/decorator.ts | 3 - packages/nest/src/generators/filter/filter.ts | 3 - .../nest/src/generators/gateway/gateway.ts | 3 - packages/nest/src/generators/guard/guard.ts | 3 - packages/nest/src/generators/init/init.ts | 4 +- .../src/generators/interceptor/interceptor.ts | 3 - .../src/generators/interface/interface.ts | 3 - .../nest/src/generators/library/library.ts | 4 +- .../src/generators/middleware/middleware.ts | 3 - packages/nest/src/generators/module/module.ts | 3 - packages/nest/src/generators/pipe/pipe.ts | 3 - .../nest/src/generators/provider/provider.ts | 3 - .../nest/src/generators/resolver/resolver.ts | 3 - .../nest/src/generators/resource/resource.ts | 3 - .../nest/src/generators/service/service.ts | 3 - packages/next/executors.json | 18 -- packages/next/generators.json | 30 ---- packages/next/package.json | 4 +- packages/next/src/executors/build/compat.ts | 5 - packages/next/src/executors/export/compat.ts | 5 - packages/next/src/executors/server/compat.ts | 5 - .../src/generators/application/application.ts | 3 - .../src/generators/component/component.ts | 2 - .../generators/custom-server/custom-server.ts | 3 - packages/next/src/generators/init/init.ts | 2 - .../next/src/generators/library/library.ts | 2 - packages/next/src/generators/page/page.ts | 2 - packages/node/generators.json | 28 ---- packages/node/package.json | 2 +- .../src/generators/application/application.ts | 2 - .../src/generators/e2e-project/e2e-project.ts | 2 - packages/node/src/generators/init/init.ts | 2 - .../node/src/generators/library/library.ts | 2 - .../generators/setup-docker/setup-docker.ts | 2 - packages/nuxt/src/generators/init/init.ts | 2 - packages/nx/executors.json | 12 -- packages/nx/src/adapter/ngcli-adapter.ts | 25 +-- .../angular/integrated-workspace.ts | 2 +- .../nx/src/executors/run-commands/compat.ts | 4 - .../nx/src/executors/run-script/compat.ts | 5 - packages/playwright/executors.json | 7 - packages/playwright/generators.json | 12 -- .../src/executors/playwright/compat.ts | 4 - .../generators/configuration/configuration.ts | 4 - .../playwright/src/generators/init/init.ts | 2 - packages/plugin/executors.json | 8 - packages/plugin/generators.json | 32 ---- packages/plugin/package.json | 4 +- packages/plugin/src/executors/e2e/compat.ts | 4 - .../create-package/create-package.ts | 4 - .../plugin/src/generators/e2e-project/e2e.ts | 2 - .../src/generators/executor/executor.ts | 2 - .../src/generators/generator/generator.ts | 2 - .../src/generators/migration/migration.ts | 3 +- .../plugin/src/generators/plugin/plugin.ts | 2 - packages/react-native/executors.json | 52 ------ packages/react-native/generators.json | 52 ------ packages/react-native/package.json | 4 +- .../src/executors/build-android/compat.ts | 5 - .../src/executors/build-ios/compat.ts | 5 - .../src/executors/bundle/compat.ts | 5 - .../src/executors/ensure-symlink/compat.ts | 5 - .../src/executors/pod-install/compat.ts | 5 - .../src/executors/run-android/compat.ts | 5 - .../src/executors/run-ios/compat.ts | 5 - .../src/executors/start/compat.ts | 5 - .../src/executors/storybook/compat.ts | 5 - .../src/executors/sync-deps/compat.ts | 5 - .../src/generators/application/application.ts | 4 - .../component-story/component-story.ts | 4 - .../src/generators/component/component.ts | 5 +- .../react-native/src/generators/init/init.ts | 4 - .../src/generators/library/library.ts | 4 - .../src/generators/stories/stories.ts | 2 - .../storybook-configuration/configuration.ts | 4 - .../upgrade-native/upgrade-native.ts | 4 - packages/react/executors.json | 12 -- packages/react/generators.json | 125 -------------- packages/react/package.json | 4 +- .../module-federation-dev-server/compat.ts | 5 - .../compat.ts | 5 - .../src/generators/application/application.ts | 2 - .../component-cypress-spec.ts | 4 - .../component-story/component-story.ts | 4 - .../src/generators/component/component.ts | 3 - .../federate-module/federate-module.ts | 5 - packages/react/src/generators/hook/hook.ts | 4 +- packages/react/src/generators/init/init.ts | 3 - .../react/src/generators/library/library.ts | 2 - packages/react/src/generators/redux/redux.ts | 2 - .../src/generators/setup-ssr/setup-ssr.ts | 3 - .../setup-tailwind/setup-tailwind.ts | 5 - .../react/src/generators/stories/stories.ts | 2 - .../storybook-configuration/configuration.ts | 4 - packages/rollup/executors.json | 7 - packages/rollup/generators.json | 14 -- packages/rollup/package.json | 4 +- .../rollup/src/executors/rollup/compat.ts | 5 - .../generators/configuration/configuration.ts | 3 - packages/rollup/src/generators/init/init.ts | 4 - packages/storybook/executors.json | 12 -- packages/storybook/generators.json | 27 --- packages/storybook/package.json | 4 +- .../src/executors/build-storybook/compat.ts | 4 - .../src/executors/storybook/compat.ts | 4 - .../generators/configuration/configuration.ts | 4 - .../cypress-project/cypress-project.ts | 5 - .../storybook/src/generators/init/init.ts | 2 - .../src/generators/migrate-7/migrate-7.ts | 2 - packages/vite/generators.json | 21 --- packages/vite/package.json | 4 +- .../generators/configuration/configuration.ts | 4 - packages/vite/src/generators/init/init.ts | 2 - .../src/generators/vitest/vitest-generator.ts | 2 - .../vue/src/generators/stories/stories.ts | 2 - .../storybook-configuration/configuration.ts | 10 +- packages/web/generators.json | 20 --- packages/web/package.json | 4 +- .../web/src/executors/file-server/compat.ts | 5 +- .../src/generators/application/application.ts | 2 - packages/web/src/generators/init/init.ts | 2 - .../static-serve-configuration.ts | 3 +- packages/webpack/executors.json | 17 -- packages/webpack/generators.json | 15 -- packages/webpack/package.json | 4 +- .../src/executors/dev-server/compat.ts | 5 - .../src/executors/ssr-dev-server/compat.ts | 5 - .../webpack/src/executors/webpack/compat.ts | 5 - .../generators/configuration/configuration.ts | 3 - packages/webpack/src/generators/init/init.ts | 3 - packages/workspace/generators.json | 31 ---- packages/workspace/index.ts | 5 +- packages/workspace/package.json | 4 +- .../src/generators/ci-workflow/ci-workflow.ts | 1 - .../convert-to-monorepo.ts | 3 - .../convert-to-nx-project.ts | 5 - .../workspace/src/generators/move/move.ts | 3 - .../src/generators/npm-package/npm-package.ts | 4 +- .../workspace/src/generators/remove/remove.ts | 9 +- .../generators/run-commands/run-commands.ts | 3 - 252 files changed, 76 insertions(+), 1975 deletions(-) delete mode 100644 docs/generated/devkit/ngcli_adapter/overrideCollectionResolutionForTesting.md delete mode 100644 packages/angular/src/executors/browser-esbuild/compat.ts delete mode 100644 packages/angular/src/executors/delegate-build/compat.ts delete mode 100644 packages/angular/src/executors/ng-packagr-lite/compat.ts delete mode 100644 packages/angular/src/executors/package/compat.ts delete mode 100644 packages/angular/src/generators/add-linting/compat.ts delete mode 100644 packages/angular/src/generators/application/application.compat.ts delete mode 100644 packages/angular/src/generators/component-cypress-spec/compat.ts delete mode 100644 packages/angular/src/generators/component-story/compat.ts delete mode 100644 packages/angular/src/generators/component-test/compat.ts delete mode 100644 packages/angular/src/generators/component/component.compat.ts delete mode 100644 packages/angular/src/generators/convert-to-with-mf/convert-to-with-mf.compat.ts delete mode 100644 packages/angular/src/generators/cypress-component-configuration/compat.ts delete mode 100644 packages/angular/src/generators/federate-module/federate-module.compat.ts delete mode 100644 packages/angular/src/generators/host/host.compat.ts delete mode 100644 packages/angular/src/generators/init/init.compat.ts delete mode 100644 packages/angular/src/generators/library-secondary-entry-point/compat.ts delete mode 100644 packages/angular/src/generators/library/library.compat.ts delete mode 100644 packages/angular/src/generators/move/compat.ts delete mode 100644 packages/angular/src/generators/ng-add/compat.ts delete mode 100644 packages/angular/src/generators/ngrx/compat.ts delete mode 100644 packages/angular/src/generators/remote/remote.compat.ts delete mode 100644 packages/angular/src/generators/scam-directive/scam-directive.compat.ts delete mode 100644 packages/angular/src/generators/scam-pipe/scam-pipe.compat.ts delete mode 100644 packages/angular/src/generators/scam-to-standalone/compat.ts delete mode 100644 packages/angular/src/generators/scam/scam.compat.ts delete mode 100644 packages/angular/src/generators/setup-mf/setup-mf.compat.ts delete mode 100644 packages/angular/src/generators/setup-ssr/setup-ssr.compat.ts delete mode 100644 packages/angular/src/generators/setup-tailwind/setup-tailwind.compat.ts delete mode 100644 packages/angular/src/generators/stories/compat.ts delete mode 100644 packages/angular/src/generators/storybook-configuration/compat.ts rename packages/{storybook/src/utils/utilities.spec.ts => angular/src/generators/storybook-configuration/storybook-utilities.spec.ts} (91%) delete mode 100644 packages/angular/src/generators/utils/warn-for-schematic-usage.ts delete mode 100644 packages/angular/src/generators/web-worker/compat.ts delete mode 100644 packages/cypress/src/executors/cypress/compat.ts delete mode 100644 packages/detox/src/executors/build/compat.ts delete mode 100644 packages/detox/src/executors/test/compat.ts delete mode 100644 packages/esbuild/src/executors/esbuild/compat.ts delete mode 100644 packages/expo/src/executors/build-list/compat.ts delete mode 100644 packages/expo/src/executors/build/compat.ts delete mode 100644 packages/expo/src/executors/ensure-symlink/compat.ts delete mode 100644 packages/expo/src/executors/export/compat.ts delete mode 100644 packages/expo/src/executors/install/compat.ts delete mode 100644 packages/expo/src/executors/prebuild/compat.ts delete mode 100644 packages/expo/src/executors/run/compat.ts delete mode 100644 packages/expo/src/executors/start/compat.ts delete mode 100644 packages/expo/src/executors/submit/compat.ts delete mode 100644 packages/expo/src/executors/sync-deps/compat.ts delete mode 100644 packages/expo/src/executors/update/compat.ts delete mode 100644 packages/jest/src/executors/jest/compat.ts delete mode 100644 packages/js/src/executors/node/compat.ts delete mode 100644 packages/js/src/executors/swc/compat.ts delete mode 100644 packages/js/src/executors/tsc/compat.ts delete mode 100644 packages/js/src/executors/verdaccio/compat.ts delete mode 100644 packages/linter/src/executors/eslint/compat.ts delete mode 100644 packages/next/src/executors/build/compat.ts delete mode 100644 packages/next/src/executors/export/compat.ts delete mode 100644 packages/next/src/executors/server/compat.ts delete mode 100644 packages/nx/src/executors/run-commands/compat.ts delete mode 100644 packages/nx/src/executors/run-script/compat.ts delete mode 100644 packages/playwright/src/executors/playwright/compat.ts delete mode 100644 packages/plugin/src/executors/e2e/compat.ts delete mode 100644 packages/react-native/src/executors/build-android/compat.ts delete mode 100644 packages/react-native/src/executors/build-ios/compat.ts delete mode 100644 packages/react-native/src/executors/bundle/compat.ts delete mode 100644 packages/react-native/src/executors/ensure-symlink/compat.ts delete mode 100644 packages/react-native/src/executors/pod-install/compat.ts delete mode 100644 packages/react-native/src/executors/run-android/compat.ts delete mode 100644 packages/react-native/src/executors/run-ios/compat.ts delete mode 100644 packages/react-native/src/executors/start/compat.ts delete mode 100644 packages/react-native/src/executors/storybook/compat.ts delete mode 100644 packages/react-native/src/executors/sync-deps/compat.ts delete mode 100644 packages/react/src/executors/module-federation-dev-server/compat.ts delete mode 100644 packages/react/src/executors/module-federation-ssr-dev-server/compat.ts delete mode 100644 packages/rollup/src/executors/rollup/compat.ts delete mode 100644 packages/storybook/src/executors/build-storybook/compat.ts delete mode 100644 packages/storybook/src/executors/storybook/compat.ts delete mode 100644 packages/webpack/src/executors/dev-server/compat.ts delete mode 100644 packages/webpack/src/executors/ssr-dev-server/compat.ts delete mode 100644 packages/webpack/src/executors/webpack/compat.ts diff --git a/docs/generated/devkit/ngcli_adapter/README.md b/docs/generated/devkit/ngcli_adapter/README.md index 8250da93e4678b..9bfb21f93f3769 100644 --- a/docs/generated/devkit/ngcli_adapter/README.md +++ b/docs/generated/devkit/ngcli_adapter/README.md @@ -9,5 +9,4 @@ ### Functions - [mockSchematicsForTesting](../../devkit/documents/ngcli_adapter/mockSchematicsForTesting) -- [overrideCollectionResolutionForTesting](../../devkit/documents/ngcli_adapter/overrideCollectionResolutionForTesting) - [wrapAngularDevkitSchematic](../../devkit/documents/ngcli_adapter/wrapAngularDevkitSchematic) diff --git a/docs/generated/devkit/ngcli_adapter/overrideCollectionResolutionForTesting.md b/docs/generated/devkit/ngcli_adapter/overrideCollectionResolutionForTesting.md deleted file mode 100644 index 0861f2e510327a..00000000000000 --- a/docs/generated/devkit/ngcli_adapter/overrideCollectionResolutionForTesting.md +++ /dev/null @@ -1,32 +0,0 @@ -# Function: overrideCollectionResolutionForTesting - -▸ **overrideCollectionResolutionForTesting**(`collections`): `void` - -By default, Angular Devkit schematic collections will be resolved using the Node resolution. -This doesn't work if you are testing schematics that refer to other schematics in the -same repo. - -This function can can be used to override the resolution behaviour. - -Example: - -```typescript -overrideCollectionResolutionForTesting({ - '@nx/workspace': path.join( - __dirname, - '../../../../workspace/generators.json' - ), - '@nx/angular': path.join(__dirname, '../../../../angular/generators.json'), - '@nx/linter': path.join(__dirname, '../../../../linter/generators.json'), -}); -``` - -#### Parameters - -| Name | Type | -| :------------ | :------- | -| `collections` | `Object` | - -#### Returns - -`void` diff --git a/docs/generated/packages/devkit/documents/ngcli_adapter.md b/docs/generated/packages/devkit/documents/ngcli_adapter.md index 8250da93e4678b..9bfb21f93f3769 100644 --- a/docs/generated/packages/devkit/documents/ngcli_adapter.md +++ b/docs/generated/packages/devkit/documents/ngcli_adapter.md @@ -9,5 +9,4 @@ ### Functions - [mockSchematicsForTesting](../../devkit/documents/ngcli_adapter/mockSchematicsForTesting) -- [overrideCollectionResolutionForTesting](../../devkit/documents/ngcli_adapter/overrideCollectionResolutionForTesting) - [wrapAngularDevkitSchematic](../../devkit/documents/ngcli_adapter/wrapAngularDevkitSchematic) diff --git a/e2e/angular-core/src/ng-add.test.ts b/e2e/angular-core/src/ng-add.test.ts index 59b39c3c9bf3da..cb6433b88ab331 100644 --- a/e2e/angular-core/src/ng-add.test.ts +++ b/e2e/angular-core/src/ng-add.test.ts @@ -68,6 +68,8 @@ describe('convert Angular CLI workspace to an Nx workspace', () => { // TODO: solve issues with pnpm and remove this fallback packageManager = packageManager === 'pnpm' ? 'yarn' : packageManager; project = runNgNew(packageManager); + packageInstall('nx', null, 'latest'); + packageInstall('@nx/angular', null, 'latest'); }); afterEach(() => { @@ -105,7 +107,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => { expect(packageJson.devDependencies['@nx/workspace']).not.toBeDefined(); // run ng add - runNgAdd('@nx/angular', '--npm-scope projscope --default-base main'); + runCLI('g @nx/angular:ng-add --npm-scope projscope --default-base main'); // check that prettier config exits and that files have been moved checkFilesExist( @@ -262,7 +264,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => { it('should handle a workspace with cypress v9', () => { addCypress9(); - runNgAdd('@nx/angular', '--npm-scope projscope --skip-install'); + runCLI('g @nx/angular:ng-add --npm-scope projscope --skip-install'); const e2eProject = `${project}-e2e`; //check e2e project files @@ -329,7 +331,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => { it('should handle a workspace with cypress v10', () => { addCypress10(); - runNgAdd('@nx/angular', '--npm-scope projscope --skip-install'); + runCLI('g @nx/angular:ng-add --npm-scope projscope --skip-install'); const e2eProject = `${project}-e2e`; //check e2e project files @@ -399,7 +401,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => { it.skip('should handle a workspace with ESLint', () => { addEsLint(); - runNgAdd('@nx/angular', '--npm-scope projscope'); + runCLI('g @nx/angular:ng-add --npm-scope projscope'); checkFilesExist(`apps/${project}/.eslintrc.json`, `.eslintrc.json`); @@ -436,7 +438,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => { runCommand(`ng g @schematics/angular:application ${app1} --no-interactive`); runCommand(`ng g @schematics/angular:library ${lib1} --no-interactive`); - runNgAdd('@nx/angular', '--npm-scope projscope'); + runCLI('g @nx/angular:ng-add --npm-scope projscope'); // check angular.json does not exist checkFilesDoNotExist('angular.json'); diff --git a/packages/angular/executors.json b/packages/angular/executors.json index 9d4063da6c4337..154989ca4ec9ad 100644 --- a/packages/angular/executors.json +++ b/packages/angular/executors.json @@ -22,21 +22,6 @@ } }, "builders": { - "delegate-build": { - "implementation": "./src/executors/delegate-build/compat", - "schema": "./src/executors/delegate-build/schema.json", - "description": "Delegates the build to a different target while supporting incremental builds." - }, - "ng-packagr-lite": { - "implementation": "./src/executors/ng-packagr-lite/compat", - "schema": "./src/executors/ng-packagr-lite/schema.json", - "description": "Builds a library with support for incremental builds.\nThis executor is meant to be used with buildable libraries in an incremental build scenario. It is similar to the `@nrwl/angular:package` executor but with some key differences:\n- It doesn't run `ngcc` automatically (`ngcc` needs to be run separately beforehand if needed, this can be done in a `postinstall` hook on `package.json`)\n- It only produces ESM2020 bundles\n- It doesn't generate package exports in the `package.json`" - }, - "package": { - "implementation": "./src/executors/package/compat", - "schema": "./src/executors/package/schema.json", - "description": "Builds and packages an Angular library to be distributed as an NPM package. It supports incremental builds." - }, "webpack-browser": { "implementation": "./src/builders/webpack-browser/webpack-browser.impl", "schema": "./src/builders/webpack-browser/schema.json", @@ -61,11 +46,6 @@ "implementation": "./src/builders/module-federation-dev-ssr/module-federation-dev-ssr.impl", "schema": "./src/builders/module-federation-dev-ssr/schema.json", "description": "The module-federation-dev-ssr executor is reserved exclusively for use with host Module Federation applications that use SSR. It allows the user to specify which remote applications should be served with the host." - }, - "browser-esbuild": { - "implementation": "./src/executors/browser-esbuild/compat", - "schema": "./src/executors/browser-esbuild/schema.json", - "description": "Builds your application with esbuild and adds support for incremental builds." } } } diff --git a/packages/angular/generators.json b/packages/angular/generators.json index 90906d24f34063..7a81ee936f6050 100644 --- a/packages/angular/generators.json +++ b/packages/angular/generators.json @@ -2,160 +2,6 @@ "name": "Nx Angular", "version": "0.1", "extends": ["@schematics/angular", "@nx/workspace"], - "schematics": { - "add-linting": { - "factory": "./src/generators/add-linting/compat", - "schema": "./src/generators/add-linting/schema.json", - "description": "Adds linting configuration to an Angular project.", - "hidden": true - }, - "application": { - "factory": "./src/generators/application/application.compat#applicationSchematic", - "schema": "./src/generators/application/schema.json", - "aliases": ["app"], - "x-type": "application", - "description": "Creates an Angular application." - }, - "component": { - "factory": "./src/generators/component/component.compat", - "schema": "./src/generators/component/schema.json", - "aliases": ["c"], - "description": "Generate an Angular Component." - }, - "component-cypress-spec": { - "factory": "./src/generators/component-cypress-spec/compat", - "schema": "./src/generators/component-cypress-spec/schema.json", - "description": "Creates a Cypress spec for a UI component that has a story.", - "hidden": true - }, - "component-story": { - "factory": "./src/generators/component-story/compat", - "schema": "./src/generators/component-story/schema.json", - "description": "Creates a `stories.ts` file for a component.", - "hidden": true - }, - "component-test": { - "factory": "./src/generators/component-test/compat", - "schema": "./src/generators/component-test/schema.json", - "description": "Creates a cypress component test file for a component." - }, - "init": { - "factory": "./src/generators/init/init.compat#initSchematic", - "schema": "./src/generators/init/schema.json", - "description": "Initializes the `@nrwl/angular` plugin.", - "hidden": true - }, - "library": { - "factory": "./src/generators/library/library.compat#librarySchematic", - "schema": "./src/generators/library/schema.json", - "aliases": ["lib"], - "x-type": "library", - "description": "Creates an Angular library." - }, - "library-secondary-entry-point": { - "factory": "./src/generators/library-secondary-entry-point/compat", - "schema": "./src/generators/library-secondary-entry-point/schema.json", - "aliases": ["secondary-entry-point", "entry-point"], - "description": "Creates a secondary entry point for an Angular publishable library." - }, - "remote": { - "factory": "./src/generators/remote/remote.compat", - "schema": "./src/generators/remote/schema.json", - "x-type": "application", - "description": "Generate a Remote Angular Module Federation Application." - }, - "move": { - "factory": "./src/generators/move/compat", - "schema": "./src/generators/move/schema.json", - "aliases": ["mv"], - "description": "Moves an Angular application or library to another folder within the workspace and updates the project configuration.", - "x-deprecated": "Use the `@nx/workspace:move` generator instead. This generator will be removed in Nx v18." - }, - "convert-to-with-mf": { - "factory": "./src/generators/convert-to-with-mf/convert-to-with-mf.compat", - "schema": "./src/generators/convert-to-with-mf/schema.json", - "description": "Converts an old micro frontend configuration to use the new `withModuleFederation` helper. It will run successfully if the following conditions are met: \n - Is either a host or remote application \n - Shared npm package configurations have not been modified \n - Name used to identify the Micro Frontend application matches the project name \n\n{% callout type=\"warning\" title=\"Overrides\" %}This generator will overwrite your webpack config. If you have additional custom configuration in your config file, it will be lost!{% /callout %}" - }, - "federate-module": { - "factory": "./src/generators/federate-module/federate-module.compat", - "schema": "./src/generators/federate-module/schema.json", - "x-type": "application", - "description": "Create a federated module, which is exposed by a remote and can be subsequently loaded by a host." - }, - "host": { - "factory": "./src/generators/host/host.compat", - "schema": "./src/generators/host/schema.json", - "x-type": "application", - "description": "Generate a Host Angular Module Federation Application." - }, - "ng-add": { - "factory": "./src/generators/ng-add/compat", - "schema": "./src/generators/ng-add/schema.json", - "description": "Migrates an Angular CLI workspace to Nx or adds the Angular plugin to an Nx workspace.", - "hidden": true - }, - "ngrx": { - "factory": "./src/generators/ngrx/compat", - "schema": "./src/generators/ngrx/schema.json", - "description": "Adds NgRx support to an application or library.", - "x-deprecated": "This generator is deprecated and will be removed in a future version of Nx. Use the 'ngrx-root-store' and 'ngrx-feature-store' generators instead." - }, - "scam-to-standalone": { - "factory": "./src/generators/scam-to-standalone/compat", - "schema": "./src/generators/scam-to-standalone/schema.json", - "description": "Convert an existing Single Component Angular Module (SCAM) to a Standalone Component." - }, - "scam": { - "factory": "./src/generators/scam/scam.compat", - "schema": "./src/generators/scam/schema.json", - "description": "Generate a component with an accompanying Single Component Angular Module (SCAM)." - }, - "scam-directive": { - "factory": "./src/generators/scam-directive/scam-directive.compat", - "schema": "./src/generators/scam-directive/schema.json", - "description": "Generate a directive with an accompanying Single Component Angular Module (SCAM)." - }, - "scam-pipe": { - "factory": "./src/generators/scam-pipe/scam-pipe.compat", - "schema": "./src/generators/scam-pipe/schema.json", - "description": "Generate a pipe with an accompanying Single Component Angular Module (SCAM)." - }, - "setup-mf": { - "factory": "./src/generators/setup-mf/setup-mf.compat", - "schema": "./src/generators/setup-mf/schema.json", - "description": "Generate a Module Federation configuration for a given Angular application." - }, - "setup-ssr": { - "factory": "./src/generators/setup-ssr/setup-ssr.compat", - "schema": "./src/generators/setup-ssr/schema.json", - "description": "Generate Angular Universal (SSR) setup for an Angular application." - }, - "setup-tailwind": { - "factory": "./src/generators/setup-tailwind/setup-tailwind.compat", - "schema": "./src/generators/setup-tailwind/schema.json", - "description": "Configures Tailwind CSS for an application or a buildable/publishable library." - }, - "stories": { - "factory": "./src/generators/stories/compat", - "schema": "./src/generators/stories/schema.json", - "description": "Creates stories/specs for all components declared in a project." - }, - "storybook-configuration": { - "factory": "./src/generators/storybook-configuration/compat", - "schema": "./src/generators/storybook-configuration/schema.json", - "description": "Adds Storybook configuration to a project." - }, - "cypress-component-configuration": { - "factory": "./src/generators/cypress-component-configuration/compat", - "schema": "./src/generators/cypress-component-configuration/schema.json", - "description": "Setup Cypress component testing for a project." - }, - "web-worker": { - "factory": "./src/generators/web-worker/compat", - "schema": "./src/generators/web-worker/schema.json", - "description": "Creates a Web Worker." - } - }, "generators": { "add-linting": { "factory": "./src/generators/add-linting/add-linting", diff --git a/packages/angular/package.json b/packages/angular/package.json index 747bc783362a75..e2f0af305d5660 100644 --- a/packages/angular/package.json +++ b/packages/angular/package.json @@ -39,8 +39,8 @@ "url": "https://github.com/nrwl/nx/issues" }, "homepage": "https://nx.dev", - "builders": "./executors.json", - "schematics": "./generators.json", + "executors": "./executors.json", + "generators": "./generators.json", "ng-update": { "requirements": {}, "migrations": "./migrations.json" diff --git a/packages/angular/src/executors/browser-esbuild/compat.ts b/packages/angular/src/executors/browser-esbuild/compat.ts deleted file mode 100644 index 13353169d9b4c8..00000000000000 --- a/packages/angular/src/executors/browser-esbuild/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import nxBrowserEsBuild from './browser-esbuild.impl'; - -export default convertNxExecutor(nxBrowserEsBuild); diff --git a/packages/angular/src/executors/delegate-build/compat.ts b/packages/angular/src/executors/delegate-build/compat.ts deleted file mode 100644 index 910a004384dbdf..00000000000000 --- a/packages/angular/src/executors/delegate-build/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import { delegateBuildExecutor } from './delegate-build.impl'; - -export default convertNxExecutor(delegateBuildExecutor); diff --git a/packages/angular/src/executors/ng-packagr-lite/compat.ts b/packages/angular/src/executors/ng-packagr-lite/compat.ts deleted file mode 100644 index 9602cbe987eca5..00000000000000 --- a/packages/angular/src/executors/ng-packagr-lite/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import { ngPackagrLiteExecutor } from './ng-packagr-lite.impl'; - -export default convertNxExecutor(ngPackagrLiteExecutor); diff --git a/packages/angular/src/executors/package/compat.ts b/packages/angular/src/executors/package/compat.ts deleted file mode 100644 index 26939a7823c757..00000000000000 --- a/packages/angular/src/executors/package/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import { packageExecutor } from './package.impl'; - -export default convertNxExecutor(packageExecutor); diff --git a/packages/angular/src/generators/add-linting/compat.ts b/packages/angular/src/generators/add-linting/compat.ts deleted file mode 100644 index 73002df46214d4..00000000000000 --- a/packages/angular/src/generators/add-linting/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { addLintingGenerator } from './add-linting'; - -export default warnForSchematicUsage(convertNxGenerator(addLintingGenerator)); diff --git a/packages/angular/src/generators/application/application.compat.ts b/packages/angular/src/generators/application/application.compat.ts deleted file mode 100644 index 90809af8c37a3d..00000000000000 --- a/packages/angular/src/generators/application/application.compat.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import application from './application'; - -export const applicationSchematic = warnForSchematicUsage( - convertNxGenerator(application) -); diff --git a/packages/angular/src/generators/component-cypress-spec/compat.ts b/packages/angular/src/generators/component-cypress-spec/compat.ts deleted file mode 100644 index 336397f5deb481..00000000000000 --- a/packages/angular/src/generators/component-cypress-spec/compat.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { componentCypressSpecGenerator } from './component-cypress-spec'; - -export default warnForSchematicUsage( - convertNxGenerator(componentCypressSpecGenerator) -); diff --git a/packages/angular/src/generators/component-story/compat.ts b/packages/angular/src/generators/component-story/compat.ts deleted file mode 100644 index fed22609bd3e8a..00000000000000 --- a/packages/angular/src/generators/component-story/compat.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { componentStoryGenerator } from './component-story'; - -export default warnForSchematicUsage( - convertNxGenerator(componentStoryGenerator) -); diff --git a/packages/angular/src/generators/component-test/compat.ts b/packages/angular/src/generators/component-test/compat.ts deleted file mode 100644 index fdcda1d20e345f..00000000000000 --- a/packages/angular/src/generators/component-test/compat.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { componentTestGenerator } from './component-test'; - -export default warnForSchematicUsage( - convertNxGenerator(componentTestGenerator) -); diff --git a/packages/angular/src/generators/component/component.compat.ts b/packages/angular/src/generators/component/component.compat.ts deleted file mode 100644 index ec0a114263163b..00000000000000 --- a/packages/angular/src/generators/component/component.compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { componentGenerator } from './component'; - -export default warnForSchematicUsage(convertNxGenerator(componentGenerator)); diff --git a/packages/angular/src/generators/convert-to-with-mf/convert-to-with-mf.compat.ts b/packages/angular/src/generators/convert-to-with-mf/convert-to-with-mf.compat.ts deleted file mode 100644 index 4148cde7d08839..00000000000000 --- a/packages/angular/src/generators/convert-to-with-mf/convert-to-with-mf.compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import convertToWithMF from './convert-to-with-mf'; - -export default warnForSchematicUsage(convertNxGenerator(convertToWithMF)); diff --git a/packages/angular/src/generators/cypress-component-configuration/compat.ts b/packages/angular/src/generators/cypress-component-configuration/compat.ts deleted file mode 100644 index bf69a3cb55e230..00000000000000 --- a/packages/angular/src/generators/cypress-component-configuration/compat.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { cypressComponentConfiguration } from './cypress-component-configuration'; - -export default warnForSchematicUsage( - convertNxGenerator(cypressComponentConfiguration) -); diff --git a/packages/angular/src/generators/federate-module/federate-module.compat.ts b/packages/angular/src/generators/federate-module/federate-module.compat.ts deleted file mode 100644 index 49e0658a273d94..00000000000000 --- a/packages/angular/src/generators/federate-module/federate-module.compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import federateModule from './federate-module'; - -export default warnForSchematicUsage(convertNxGenerator(federateModule)); diff --git a/packages/angular/src/generators/host/host.compat.ts b/packages/angular/src/generators/host/host.compat.ts deleted file mode 100644 index 80b6456539d956..00000000000000 --- a/packages/angular/src/generators/host/host.compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import host from './host'; - -export default warnForSchematicUsage(convertNxGenerator(host)); diff --git a/packages/angular/src/generators/init/init.compat.ts b/packages/angular/src/generators/init/init.compat.ts deleted file mode 100644 index fc18cd0dacc07c..00000000000000 --- a/packages/angular/src/generators/init/init.compat.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { angularInitGenerator } from './init'; - -export const initSchematic = warnForSchematicUsage( - convertNxGenerator(angularInitGenerator) -); diff --git a/packages/angular/src/generators/library-secondary-entry-point/compat.ts b/packages/angular/src/generators/library-secondary-entry-point/compat.ts deleted file mode 100644 index 39811b2cef6e73..00000000000000 --- a/packages/angular/src/generators/library-secondary-entry-point/compat.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { librarySecondaryEntryPointGenerator } from './library-secondary-entry-point'; - -export default warnForSchematicUsage( - convertNxGenerator(librarySecondaryEntryPointGenerator) -); diff --git a/packages/angular/src/generators/library/library.compat.ts b/packages/angular/src/generators/library/library.compat.ts deleted file mode 100644 index 984242c8feaee6..00000000000000 --- a/packages/angular/src/generators/library/library.compat.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import library from './library'; - -export const librarySchematic = warnForSchematicUsage( - convertNxGenerator(library) -); diff --git a/packages/angular/src/generators/move/compat.ts b/packages/angular/src/generators/move/compat.ts deleted file mode 100644 index c7b5746b8d9f0f..00000000000000 --- a/packages/angular/src/generators/move/compat.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { angularMoveGenerator } from './move'; - -export const angularMoveSchematic = warnForSchematicUsage( - convertNxGenerator(angularMoveGenerator) -); diff --git a/packages/angular/src/generators/ng-add/compat.ts b/packages/angular/src/generators/ng-add/compat.ts deleted file mode 100644 index a6d120fbe36d30..00000000000000 --- a/packages/angular/src/generators/ng-add/compat.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { ngAddGenerator } from './ng-add'; - -export default convertNxGenerator(ngAddGenerator, true); diff --git a/packages/angular/src/generators/ngrx/compat.ts b/packages/angular/src/generators/ngrx/compat.ts deleted file mode 100644 index 2b9b2934bbd8e9..00000000000000 --- a/packages/angular/src/generators/ngrx/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { ngrxGenerator } from './ngrx'; - -export default warnForSchematicUsage(convertNxGenerator(ngrxGenerator)); diff --git a/packages/angular/src/generators/remote/remote.compat.ts b/packages/angular/src/generators/remote/remote.compat.ts deleted file mode 100644 index 5a898b92119cf4..00000000000000 --- a/packages/angular/src/generators/remote/remote.compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import remote from './remote'; - -export default warnForSchematicUsage(convertNxGenerator(remote)); diff --git a/packages/angular/src/generators/scam-directive/scam-directive.compat.ts b/packages/angular/src/generators/scam-directive/scam-directive.compat.ts deleted file mode 100644 index 19d1fbcdaa2f92..00000000000000 --- a/packages/angular/src/generators/scam-directive/scam-directive.compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import scamGenerator from './scam-directive'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { convertNxGenerator } from '@nx/devkit'; - -export default warnForSchematicUsage(convertNxGenerator(scamGenerator)); diff --git a/packages/angular/src/generators/scam-pipe/scam-pipe.compat.ts b/packages/angular/src/generators/scam-pipe/scam-pipe.compat.ts deleted file mode 100644 index aa2b976cfb8500..00000000000000 --- a/packages/angular/src/generators/scam-pipe/scam-pipe.compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import scamPipeGenerator from './scam-pipe'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { convertNxGenerator } from '@nx/devkit'; - -export default warnForSchematicUsage(convertNxGenerator(scamPipeGenerator)); diff --git a/packages/angular/src/generators/scam-to-standalone/compat.ts b/packages/angular/src/generators/scam-to-standalone/compat.ts deleted file mode 100644 index 3cfba0da6f8612..00000000000000 --- a/packages/angular/src/generators/scam-to-standalone/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { scamToStandalone } from './scam-to-standalone'; - -export default warnForSchematicUsage(convertNxGenerator(scamToStandalone)); diff --git a/packages/angular/src/generators/scam/scam.compat.ts b/packages/angular/src/generators/scam/scam.compat.ts deleted file mode 100644 index db6c9c0e2637c4..00000000000000 --- a/packages/angular/src/generators/scam/scam.compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import scamGenerator from './scam'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { convertNxGenerator } from '@nx/devkit'; - -export default warnForSchematicUsage(convertNxGenerator(scamGenerator)); diff --git a/packages/angular/src/generators/setup-mf/setup-mf.compat.ts b/packages/angular/src/generators/setup-mf/setup-mf.compat.ts deleted file mode 100644 index 5b2378850139db..00000000000000 --- a/packages/angular/src/generators/setup-mf/setup-mf.compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { setupMf } from './setup-mf'; - -export default warnForSchematicUsage(convertNxGenerator(setupMf)); diff --git a/packages/angular/src/generators/setup-ssr/setup-ssr.compat.ts b/packages/angular/src/generators/setup-ssr/setup-ssr.compat.ts deleted file mode 100644 index 0b1da67ed2c0e3..00000000000000 --- a/packages/angular/src/generators/setup-ssr/setup-ssr.compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { setupSsr } from './setup-ssr'; - -export default warnForSchematicUsage(convertNxGenerator(setupSsr)); diff --git a/packages/angular/src/generators/setup-tailwind/setup-tailwind.compat.ts b/packages/angular/src/generators/setup-tailwind/setup-tailwind.compat.ts deleted file mode 100644 index 96fe2d20549778..00000000000000 --- a/packages/angular/src/generators/setup-tailwind/setup-tailwind.compat.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { setupTailwindGenerator } from './setup-tailwind'; - -export default warnForSchematicUsage( - convertNxGenerator(setupTailwindGenerator) -); diff --git a/packages/angular/src/generators/stories/compat.ts b/packages/angular/src/generators/stories/compat.ts deleted file mode 100644 index 1b0c9fa07f8b9c..00000000000000 --- a/packages/angular/src/generators/stories/compat.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { angularStoriesGenerator } from './stories'; - -export default warnForSchematicUsage( - convertNxGenerator(angularStoriesGenerator) -); diff --git a/packages/angular/src/generators/storybook-configuration/compat.ts b/packages/angular/src/generators/storybook-configuration/compat.ts deleted file mode 100644 index 6fcff020e10fb1..00000000000000 --- a/packages/angular/src/generators/storybook-configuration/compat.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { storybookConfigurationGenerator } from './storybook-configuration'; - -export default warnForSchematicUsage( - convertNxGenerator(storybookConfigurationGenerator) -); diff --git a/packages/storybook/src/utils/utilities.spec.ts b/packages/angular/src/generators/storybook-configuration/storybook-utilities.spec.ts similarity index 91% rename from packages/storybook/src/utils/utilities.spec.ts rename to packages/angular/src/generators/storybook-configuration/storybook-utilities.spec.ts index 3a4ca203c55bf3..5b42d24f0c6245 100644 --- a/packages/storybook/src/utils/utilities.spec.ts +++ b/packages/angular/src/generators/storybook-configuration/storybook-utilities.spec.ts @@ -1,15 +1,15 @@ import { joinPathFragments, Tree, writeJson } from '@nx/devkit'; -import { - overrideCollectionResolutionForTesting, - wrapAngularDevkitSchematic, -} from '@nx/devkit/ngcli-adapter'; import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; import { findStorybookAndBuildTargetsAndCompiler, isTheFileAStory, -} from './utilities'; -import { nxVersion, storybookVersion } from './versions'; -import * as targetVariations from './test-configs/different-target-variations.json'; +} from '@nx/storybook/src/utils/utilities'; +import { nxVersion, storybookVersion } from '@nx/storybook/src/utils/versions'; +import * as targetVariations from '@nx/storybook/src/utils/test-configs/different-target-variations.json'; +import libraryGenerator from '../library/library'; +import componentGenerator from '../component/component'; +import storybookConfigurationGenerator from '../storybook-configuration/storybook-configuration'; +import { Linter } from '@nx/linter'; // nested code imports graph from the repo, which might have innacurate graph version jest.mock('nx/src/project-graph/project-graph', () => ({ @@ -19,38 +19,18 @@ jest.mock('nx/src/project-graph/project-graph', () => ({ .mockImplementation(async () => ({ nodes: {}, dependencies: {} })), })); -const componentSchematic = wrapAngularDevkitSchematic( - '@schematics/angular', - 'component' -); -const runAngularLibrarySchematic = wrapAngularDevkitSchematic( - '@schematics/angular', - 'library' -); -const runAngularStorybookSchematic = wrapAngularDevkitSchematic( - '@nx/angular', - 'storybook-configuration' -); - describe('testing utilities', () => { describe('Test functions that need workspace tree', () => { let appTree: Tree; beforeEach(async () => { - overrideCollectionResolutionForTesting({ - '@nx/storybook': joinPathFragments( - __dirname, - '../../../../generators.json' - ), - }); - appTree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); - await runAngularLibrarySchematic(appTree, { + await libraryGenerator(appTree, { name: 'test-ui-lib', }); - await componentSchematic(appTree, { + await componentGenerator(appTree, { name: 'button', project: 'test-ui-lib', }); @@ -64,10 +44,12 @@ describe('testing utilities', () => { }); writeJson(appTree, 'test-ui-lib/tsconfig.json', {}); - await runAngularStorybookSchematic(appTree, { + await storybookConfigurationGenerator(appTree, { name: 'test-ui-lib', configureCypress: true, configureStaticServe: false, + linter: Linter.EsLint, + generateStories: false, }); appTree.write( diff --git a/packages/angular/src/generators/utils/warn-for-schematic-usage.ts b/packages/angular/src/generators/utils/warn-for-schematic-usage.ts deleted file mode 100644 index 5f847a61fece7d..00000000000000 --- a/packages/angular/src/generators/utils/warn-for-schematic-usage.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function warnForSchematicUsage(convertedGenerator: T): T { - console.warn( - 'Running generators as schematics is deprecated and will be removed in v17. Prefer `callRule(convertNxGenerator(generator)(options), tree, context)` where "generator" is the name of the generator you wish to use.' - ); - - return convertedGenerator; -} diff --git a/packages/angular/src/generators/web-worker/compat.ts b/packages/angular/src/generators/web-worker/compat.ts deleted file mode 100644 index b2a38e1e72bd25..00000000000000 --- a/packages/angular/src/generators/web-worker/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxGenerator } from '@nx/devkit'; -import { warnForSchematicUsage } from '../utils/warn-for-schematic-usage'; -import { webWorkerGenerator } from './web-worker'; - -export default warnForSchematicUsage(convertNxGenerator(webWorkerGenerator)); diff --git a/packages/cypress/executors.json b/packages/cypress/executors.json index f04e75ca738d26..fb6d6b7008aa73 100644 --- a/packages/cypress/executors.json +++ b/packages/cypress/executors.json @@ -1,11 +1,4 @@ { - "builders": { - "cypress": { - "implementation": "./src/executors/cypress/compat", - "schema": "./src/executors/cypress/schema.json", - "description": "Run Cypress E2E tests." - } - }, "executors": { "cypress": { "implementation": "./src/executors/cypress/cypress.impl", diff --git a/packages/cypress/generators.json b/packages/cypress/generators.json index 954808225a408b..45e5f3f23a3528 100644 --- a/packages/cypress/generators.json +++ b/packages/cypress/generators.json @@ -1,37 +1,6 @@ { "name": "Nx Cypress", "version": "0.1", - "schematics": { - "init": { - "factory": "./src/generators/init/init#cypressInitSchematic", - "schema": "./src/generators/init/schema.json", - "description": "Initialize the `@nrwl/cypress` plugin.", - "aliases": ["ng-add"], - "hidden": true - }, - "cypress-project": { - "factory": "./src/generators/cypress-project/cypress-project#cypressProjectSchematic", - "schema": "./src/generators/cypress-project/schema.json", - "description": "Add a Cypress E2E Project." - }, - "configuration": { - "aliases": ["cypress-e2e-configuration", "e2e", "e2e-config"], - "factory": "./src/generators/configuration/configuration#compat", - "schema": "./src/generators/configuration/schema.json", - "description": "Add a Cypress E2E Configuration to an existing project." - }, - "component-configuration": { - "aliases": ["cypress-component-configuration"], - "factory": "./src/generators/component-configuration/component-configuration#compat", - "schema": "./src/generators/component-configuration/schema.json", - "description": "Set up Cypress Component Test for a project" - }, - "migrate-to-cypress-11": { - "factory": "./src/generators/migrate-to-cypress-11/migrate-to-cypress-11#migrateCypressProject", - "schema": "./src/generators/migrate-to-cypress-11/schema.json", - "description": "Migrate existing Cypress e2e projects to Cypress v11" - } - }, "generators": { "init": { "factory": "./src/generators/init/init#cypressInitGenerator", diff --git a/packages/cypress/package.json b/packages/cypress/package.json index 892ea88470f0c3..82310de6cc3853 100644 --- a/packages/cypress/package.json +++ b/packages/cypress/package.json @@ -27,8 +27,8 @@ "url": "https://github.com/nrwl/nx/issues" }, "homepage": "https://nx.dev", - "schematics": "./generators.json", - "builders": "./executors.json", + "generators": "./generators.json", + "executors": "./executors.json", "ng-update": { "requirements": {}, "migrations": "./migrations.json" diff --git a/packages/cypress/src/executors/cypress/compat.ts b/packages/cypress/src/executors/cypress/compat.ts deleted file mode 100644 index 73ff03fab97441..00000000000000 --- a/packages/cypress/src/executors/cypress/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import { default as cypressExecutor } from './cypress.impl'; - -export default convertNxExecutor(cypressExecutor); diff --git a/packages/cypress/src/generators/component-configuration/component-configuration.ts b/packages/cypress/src/generators/component-configuration/component-configuration.ts index 1a9bbfd5c04abd..b8187b649c2e0b 100644 --- a/packages/cypress/src/generators/component-configuration/component-configuration.ts +++ b/packages/cypress/src/generators/component-configuration/component-configuration.ts @@ -11,7 +11,6 @@ import { updateJson, updateProjectConfiguration, updateNxJson, - convertNxGenerator, } from '@nx/devkit'; import { installedCypressVersion } from '../../utils/cypress-version'; @@ -210,4 +209,3 @@ export function updateTsConfigForComponentTesting( } export default componentConfigurationGenerator; -export const compat = convertNxGenerator(componentConfigurationGenerator); diff --git a/packages/cypress/src/generators/configuration/configuration.ts b/packages/cypress/src/generators/configuration/configuration.ts index a4aa0f33bfbe0b..7973c4c9226476 100644 --- a/packages/cypress/src/generators/configuration/configuration.ts +++ b/packages/cypress/src/generators/configuration/configuration.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, formatFiles, generateFiles, GeneratorCallback, @@ -37,6 +36,7 @@ export interface CypressE2EConfigSchema { linter?: Linter; port?: number | 'cypress-auto'; } + type NormalizedSchema = ReturnType; export async function configurationGenerator( @@ -221,4 +221,3 @@ function addTarget(tree: Tree, opts: NormalizedSchema) { } export default configurationGenerator; -export const compat = convertNxGenerator(configurationGenerator); diff --git a/packages/cypress/src/generators/cypress-project/cypress-project.ts b/packages/cypress/src/generators/cypress-project/cypress-project.ts index 634d2880f04f86..7fd389de559436 100644 --- a/packages/cypress/src/generators/cypress-project/cypress-project.ts +++ b/packages/cypress/src/generators/cypress-project/cypress-project.ts @@ -1,7 +1,6 @@ import { addDependenciesToPackageJson, addProjectConfiguration, - convertNxGenerator, formatFiles, generateFiles, GeneratorCallback, @@ -266,6 +265,3 @@ async function normalizeOptions( } export default cypressProjectGenerator; -export const cypressProjectSchematic = convertNxGenerator( - cypressProjectGenerator -); diff --git a/packages/cypress/src/generators/init/init.ts b/packages/cypress/src/generators/init/init.ts index 20d1a7dbeebd23..688c28a2704d6a 100644 --- a/packages/cypress/src/generators/init/init.ts +++ b/packages/cypress/src/generators/init/init.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, GeneratorCallback, readNxJson, removeDependenciesFromPackageJson, @@ -70,4 +69,3 @@ export async function cypressInitGenerator(tree: Tree, options: Schema) { } export default cypressInitGenerator; -export const cypressInitSchematic = convertNxGenerator(cypressInitGenerator); diff --git a/packages/detox/generators.json b/packages/detox/generators.json index c0c41461d4c441..629445d13db737 100644 --- a/packages/detox/generators.json +++ b/packages/detox/generators.json @@ -2,21 +2,6 @@ "name": "Nx Detox", "version": "0.1", "extends": ["@nx/workspace"], - "schematics": { - "init": { - "factory": "./src/generators/init/init#detoxInitSchematic", - "schema": "./src/generators/init/schema.json", - "description": "Initialize the `@nrwl/detox` plugin.", - "hidden": true - }, - "application": { - "factory": "./src/generators/application/application#detoxApplicationSchematic", - "schema": "./src/generators/application/schema.json", - "aliases": ["app"], - "x-type": "application", - "description": "Create a Detox application." - } - }, "generators": { "init": { "factory": "./src/generators/init/init#detoxInitGenerator", diff --git a/packages/detox/package.json b/packages/detox/package.json index 8437047ae186df..fcc63ca1dc80b8 100644 --- a/packages/detox/package.json +++ b/packages/detox/package.json @@ -35,12 +35,12 @@ "peerDependencies": { "detox": "^20.9.0" }, - "builders": "./executors.json", + "executors": "./executors.json", "ng-update": { "requirements": {}, "migrations": "./migrations.json" }, - "schematics": "./generators.json", + "generators": "./generators.json", "publishConfig": { "access": "public" } diff --git a/packages/detox/src/executors/build/compat.ts b/packages/detox/src/executors/build/compat.ts deleted file mode 100644 index 49a0fc36986e06..00000000000000 --- a/packages/detox/src/executors/build/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import detoxBuildExecutor from './build.impl'; - -export default convertNxExecutor(detoxBuildExecutor); diff --git a/packages/detox/src/executors/test/compat.ts b/packages/detox/src/executors/test/compat.ts deleted file mode 100644 index 489629e0671a2c..00000000000000 --- a/packages/detox/src/executors/test/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import detoxTestExecutor from './test.impl'; - -export default convertNxExecutor(detoxTestExecutor); diff --git a/packages/detox/src/generators/application/application.ts b/packages/detox/src/generators/application/application.ts index 65138b439d24f3..a8af1cdbe22ed9 100644 --- a/packages/detox/src/generators/application/application.ts +++ b/packages/detox/src/generators/application/application.ts @@ -1,9 +1,4 @@ -import { - convertNxGenerator, - formatFiles, - runTasksInSerial, - Tree, -} from '@nx/devkit'; +import { formatFiles, runTasksInSerial, Tree } from '@nx/devkit'; import detoxInitGenerator from '../init/init'; import { addGitIgnoreEntry } from './lib/add-git-ignore-entry'; @@ -44,6 +39,3 @@ export async function detoxApplicationGeneratorInternal( } export default detoxApplicationGenerator; -export const detoxApplicationSchematic = convertNxGenerator( - detoxApplicationGenerator -); diff --git a/packages/detox/src/generators/init/init.ts b/packages/detox/src/generators/init/init.ts index a7dc66ad6e1f1f..479844ab88eef5 100644 --- a/packages/detox/src/generators/init/init.ts +++ b/packages/detox/src/generators/init/init.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, formatFiles, GeneratorCallback, removeDependenciesFromPackageJson, @@ -54,4 +53,3 @@ function moveDependency(host: Tree) { } export default detoxInitGenerator; -export const detoxInitSchematic = convertNxGenerator(detoxInitGenerator); diff --git a/packages/devkit/ngcli-adapter.ts b/packages/devkit/ngcli-adapter.ts index 197c62d08a7446..925677d2648e6f 100644 --- a/packages/devkit/ngcli-adapter.ts +++ b/packages/devkit/ngcli-adapter.ts @@ -4,7 +4,6 @@ // eslint-disable-next-line @typescript-eslint/no-restricted-imports export { wrapAngularDevkitSchematic, - overrideCollectionResolutionForTesting, mockSchematicsForTesting, NxScopedHost, } from 'nx/src/adapter/ngcli-adapter'; diff --git a/packages/esbuild/executors.json b/packages/esbuild/executors.json index dbba2d50275df6..f4ebe04316cb33 100644 --- a/packages/esbuild/executors.json +++ b/packages/esbuild/executors.json @@ -1,11 +1,4 @@ { - "builders": { - "esbuild": { - "implementation": "./src/executors/esbuild/compat", - "schema": "./src/executors/esbuild/schema.json", - "description": "Bundle a package using EsBuild." - } - }, "executors": { "esbuild": { "implementation": "./src/executors/esbuild/esbuild.impl", diff --git a/packages/esbuild/generators.json b/packages/esbuild/generators.json index 7588f2902124e9..1a28d4bfc7edf1 100644 --- a/packages/esbuild/generators.json +++ b/packages/esbuild/generators.json @@ -1,20 +1,6 @@ { "name": "Nx esbuild", "version": "0.1", - "schematics": { - "init": { - "factory": "./src/generators/init/init#esbuildInitSchematic", - "schema": "./src/generators/init/schema.json", - "description": "Initialize the `@nrwl/esbuild` plugin.", - "hidden": true - }, - "configuration": { - "aliases": ["esbuild-project"], - "factory": "./src/generators/configuration/configuration#compat", - "schema": "./src/generators/configuration/schema.json", - "description": "Add esbuild configuration to a project." - } - }, "generators": { "init": { "factory": "./src/generators/init/init#esbuildInitGenerator", diff --git a/packages/esbuild/package.json b/packages/esbuild/package.json index 3c65d65091278d..d8e9fefb75762c 100644 --- a/packages/esbuild/package.json +++ b/packages/esbuild/package.json @@ -22,8 +22,8 @@ "url": "https://github.com/nrwl/nx/issues" }, "homepage": "https://nx.dev", - "schematics": "./generators.json", - "builders": "./executors.json", + "generators": "./generators.json", + "executors": "./executors.json", "ng-update": { "requirements": {}, "migrations": "./migrations.json" diff --git a/packages/esbuild/src/executors/esbuild/compat.ts b/packages/esbuild/src/executors/esbuild/compat.ts deleted file mode 100644 index 4b0539b6e2df5f..00000000000000 --- a/packages/esbuild/src/executors/esbuild/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import esbuildExecutor from './esbuild.impl'; - -export default convertNxExecutor(esbuildExecutor); diff --git a/packages/esbuild/src/generators/configuration/configuration.ts b/packages/esbuild/src/generators/configuration/configuration.ts index 9233c6bc8b8080..0c179a070585b8 100644 --- a/packages/esbuild/src/generators/configuration/configuration.ts +++ b/packages/esbuild/src/generators/configuration/configuration.ts @@ -1,6 +1,5 @@ import type { Tree } from '@nx/devkit'; import { - convertNxGenerator, formatFiles, joinPathFragments, readProjectConfiguration, @@ -131,6 +130,4 @@ function getTsConfigFile(tree: Tree, options: EsBuildProjectSchema) { return options.tsConfig; } -export const compat = convertNxGenerator(configurationGenerator); - export default configurationGenerator; diff --git a/packages/esbuild/src/generators/init/init.ts b/packages/esbuild/src/generators/init/init.ts index c05b72aa1a363b..25a6df9c741525 100644 --- a/packages/esbuild/src/generators/init/init.ts +++ b/packages/esbuild/src/generators/init/init.ts @@ -1,9 +1,4 @@ -import { - addDependenciesToPackageJson, - convertNxGenerator, - formatFiles, - Tree, -} from '@nx/devkit'; +import { addDependenciesToPackageJson, formatFiles, Tree } from '@nx/devkit'; import { Schema } from './schema'; import { esbuildVersion } from '@nx/js/src/utils/versions'; import { nxVersion } from '../../utils/versions'; @@ -26,5 +21,3 @@ export async function esbuildInitGenerator(tree: Tree, schema: Schema) { } export default esbuildInitGenerator; - -export const esbuildInitSchematic = convertNxGenerator(esbuildInitGenerator); diff --git a/packages/expo/executors.json b/packages/expo/executors.json index c34726aa8c8385..698998e09a7f03 100644 --- a/packages/expo/executors.json +++ b/packages/expo/executors.json @@ -55,62 +55,5 @@ "schema": "./src/executors/submit/schema.json", "description": "Submit app binary to App Store and/or Play Store" } - }, - "builders": { - "update": { - "implementation": "./src/executors/update/compat", - "schema": "./src/executors/update/schema.json", - "description": "Start an EAS update for your expo project" - }, - "build": { - "implementation": "./src/executors/build/compat", - "schema": "./src/executors/build/schema.json", - "description": "Start an EAS build for your expo project" - }, - "build-list": { - "implementation": "./src/executors/build-list/compat", - "schema": "./src/executors/build-list/schema.json", - "description": "List all EAS builds for your Expo project" - }, - "run": { - "implementation": "./src/executors/run/compat", - "schema": "./src/executors/run/schema.json", - "description": "Run the Android app binary locally or run the iOS app binary locally" - }, - "start": { - "implementation": "./src/executors/start/compat", - "schema": "./src/executors/start/schema.json", - "description": "Start a local dev server for the app or start a Webpack dev server for the web app" - }, - "sync-deps": { - "implementation": "./src/executors/sync-deps/compat", - "schema": "./src/executors/sync-deps/schema.json", - "description": "Syncs dependencies to package.json (required for autolinking)." - }, - "ensure-symlink": { - "implementation": "./src/executors/ensure-symlink/compat", - "schema": "./src/executors/ensure-symlink/schema.json", - "description": "Ensure workspace node_modules is symlink under app's node_modules folder." - }, - "prebuild": { - "implementation": "./src/executors/prebuild/compat", - "schema": "./src/executors/prebuild/schema.json", - "description": "Create native iOS and Android project files for building natively." - }, - "install": { - "implementation": "./src/executors/install/compat", - "schema": "./src/executors/install/schema.json", - "description": "Install a module or other package to a project." - }, - "export": { - "implementation": "./src/executors/export/compat", - "schema": "./src/executors/export/schema.json", - "description": "Export the JavaScript and assets for your app using Metro/webpack bundler" - }, - "submit": { - "implementation": "./src/executors/submit/compat", - "schema": "./src/executors/submit/schema.json", - "description": "Submit app binary to App Store and/or Play Store" - } } } diff --git a/packages/expo/generators.json b/packages/expo/generators.json index e683057b95dba1..63ea53981685cc 100644 --- a/packages/expo/generators.json +++ b/packages/expo/generators.json @@ -2,34 +2,6 @@ "name": "Nx Expo", "version": "0.1", "extends": ["@nx/workspace"], - "schematics": { - "init": { - "factory": "./src/generators/init/init#expoInitSchematic", - "schema": "./src/generators/init/schema.json", - "description": "Initialize the @nrwl/expo plugin", - "hidden": true - }, - "application": { - "factory": "./src/generators/application/application#expoApplicationSchematic", - "schema": "./src/generators/application/schema.json", - "aliases": ["app"], - "x-type": "application", - "description": "Create an application" - }, - "library": { - "factory": "./src/generators/library/library#expoLibrarySchematic", - "schema": "./src/generators/library/schema.json", - "aliases": ["lib"], - "x-type": "library", - "description": "Create a library" - }, - "component": { - "factory": "./src/generators/component/component#expoComponentSchematic", - "schema": "./src/generators/component/schema.json", - "description": "Create a component", - "aliases": ["c"] - } - }, "generators": { "init": { "factory": "./src/generators/init/init#expoInitGenerator", diff --git a/packages/expo/package.json b/packages/expo/package.json index fa946f18b9255b..dca29c2fa0af6c 100644 --- a/packages/expo/package.json +++ b/packages/expo/package.json @@ -47,12 +47,12 @@ "@expo/cli": ">= 0.10.0", "eas-cli": ">= 3.15.0" }, - "builders": "./executors.json", + "executors": "./executors.json", "ng-update": { "requirements": {}, "migrations": "./migrations.json" }, - "schematics": "./generators.json", + "generators": "./generators.json", "publishConfig": { "access": "public" } diff --git a/packages/expo/src/executors/build-list/compat.ts b/packages/expo/src/executors/build-list/compat.ts deleted file mode 100644 index 764bd063faf8c7..00000000000000 --- a/packages/expo/src/executors/build-list/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import buildListExecutor from './build-list.impl'; - -export default convertNxExecutor(buildListExecutor); diff --git a/packages/expo/src/executors/build/compat.ts b/packages/expo/src/executors/build/compat.ts deleted file mode 100644 index fc7908d20075b8..00000000000000 --- a/packages/expo/src/executors/build/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import buildExecutor from './build.impl'; - -export default convertNxExecutor(buildExecutor); diff --git a/packages/expo/src/executors/ensure-symlink/compat.ts b/packages/expo/src/executors/ensure-symlink/compat.ts deleted file mode 100644 index 2b1fbac1599191..00000000000000 --- a/packages/expo/src/executors/ensure-symlink/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import ensureSymlinkExecutor from './ensure-symlink.impl'; - -export default convertNxExecutor(ensureSymlinkExecutor); diff --git a/packages/expo/src/executors/export/compat.ts b/packages/expo/src/executors/export/compat.ts deleted file mode 100644 index b3d3c12d21d776..00000000000000 --- a/packages/expo/src/executors/export/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import exportExecutor from './export.impl'; - -export default convertNxExecutor(exportExecutor); diff --git a/packages/expo/src/executors/install/compat.ts b/packages/expo/src/executors/install/compat.ts deleted file mode 100644 index 73aaed1b3481e2..00000000000000 --- a/packages/expo/src/executors/install/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import installExecutor from './install.impl'; - -export default convertNxExecutor(installExecutor); diff --git a/packages/expo/src/executors/prebuild/compat.ts b/packages/expo/src/executors/prebuild/compat.ts deleted file mode 100644 index a8ede28bfcb24a..00000000000000 --- a/packages/expo/src/executors/prebuild/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import prebuildExecutor from './prebuild.impl'; - -export default convertNxExecutor(prebuildExecutor); diff --git a/packages/expo/src/executors/run/compat.ts b/packages/expo/src/executors/run/compat.ts deleted file mode 100644 index 8bda243d659a9e..00000000000000 --- a/packages/expo/src/executors/run/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import runExecutor from './run.impl'; - -export default convertNxExecutor(runExecutor); diff --git a/packages/expo/src/executors/start/compat.ts b/packages/expo/src/executors/start/compat.ts deleted file mode 100644 index d0a895af818ad6..00000000000000 --- a/packages/expo/src/executors/start/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import startExecutor from './start.impl'; - -export default convertNxExecutor(startExecutor); diff --git a/packages/expo/src/executors/submit/compat.ts b/packages/expo/src/executors/submit/compat.ts deleted file mode 100644 index 8a20bd7c54f6e0..00000000000000 --- a/packages/expo/src/executors/submit/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import submitExecutor from './submit.impl'; - -export default convertNxExecutor(submitExecutor); diff --git a/packages/expo/src/executors/sync-deps/compat.ts b/packages/expo/src/executors/sync-deps/compat.ts deleted file mode 100644 index a0a363f75c0eea..00000000000000 --- a/packages/expo/src/executors/sync-deps/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import syncDepsExecutor from './sync-deps.impl'; - -export default convertNxExecutor(syncDepsExecutor); diff --git a/packages/expo/src/executors/update/compat.ts b/packages/expo/src/executors/update/compat.ts deleted file mode 100644 index d898a595f89b9f..00000000000000 --- a/packages/expo/src/executors/update/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import buildExecutor from './update.impl'; - -export default convertNxExecutor(buildExecutor); diff --git a/packages/expo/src/generators/application/application.ts b/packages/expo/src/generators/application/application.ts index 72c1f49ac66c38..f68a1313a383aa 100644 --- a/packages/expo/src/generators/application/application.ts +++ b/packages/expo/src/generators/application/application.ts @@ -1,5 +1,4 @@ import { - convertNxGenerator, formatFiles, GeneratorCallback, joinPathFragments, @@ -67,6 +66,3 @@ export async function expoApplicationGeneratorInternal( } export default expoApplicationGenerator; -export const expoApplicationSchematic = convertNxGenerator( - expoApplicationGenerator -); diff --git a/packages/expo/src/generators/component/component.ts b/packages/expo/src/generators/component/component.ts index e14228022e715a..b4ee7fa7cb0a1a 100644 --- a/packages/expo/src/generators/component/component.ts +++ b/packages/expo/src/generators/component/component.ts @@ -2,7 +2,6 @@ import * as ts from 'typescript'; import { Schema } from './schema'; import { applyChangesToString, - convertNxGenerator, formatFiles, generateFiles, getProjects, @@ -83,6 +82,3 @@ function addExportsToBarrel(host: Tree, options: NormalizedSchema) { } export default expoComponentGenerator; -export const expoComponentSchematic = convertNxGenerator( - expoComponentGenerator -); diff --git a/packages/expo/src/generators/init/init.ts b/packages/expo/src/generators/init/init.ts index 455eab099c6e66..fe2e07c2e3dd71 100644 --- a/packages/expo/src/generators/init/init.ts +++ b/packages/expo/src/generators/init/init.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, formatFiles, GeneratorCallback, removeDependenciesFromPackageJson, @@ -112,4 +111,3 @@ function moveDependency(host: Tree) { } export default expoInitGenerator; -export const expoInitSchematic = convertNxGenerator(expoInitGenerator); diff --git a/packages/expo/src/generators/library/library.ts b/packages/expo/src/generators/library/library.ts index 96cafbacae22e1..c167214a481599 100644 --- a/packages/expo/src/generators/library/library.ts +++ b/packages/expo/src/generators/library/library.ts @@ -1,6 +1,5 @@ import { addProjectConfiguration, - convertNxGenerator, ensurePackage, formatFiles, generateFiles, @@ -220,4 +219,3 @@ function maybeJs(options: NormalizedSchema, path: string): string { } export default expoLibraryGenerator; -export const expoLibrarySchematic = convertNxGenerator(expoLibraryGenerator); diff --git a/packages/express/generators.json b/packages/express/generators.json index bc6ea164919100..a0098d2e4f673d 100644 --- a/packages/express/generators.json +++ b/packages/express/generators.json @@ -10,7 +10,6 @@ "aliases": ["ng-add"], "hidden": true }, - "application": { "factory": "./src/generators/application/application#applicationGeneratorInternal", "schema": "./src/generators/application/schema.json", @@ -18,22 +17,5 @@ "x-type": "application", "description": "Create an Express application." } - }, - "schematics": { - "init": { - "factory": "./src/generators/init/init#initSchematic", - "schema": "./src/generators/init/schema.json", - "description": "Initialize the `@nrwl/express` plugin.", - "aliases": ["ng-add"], - "hidden": true - }, - - "application": { - "factory": "./src/generators/application/application#applicationSchematic", - "schema": "./src/generators/application/schema.json", - "aliases": ["app"], - "x-type": "application", - "description": "Create an Express application." - } } } diff --git a/packages/express/package.json b/packages/express/package.json index 0d7e951b8bd010..6554d94e752f19 100644 --- a/packages/express/package.json +++ b/packages/express/package.json @@ -24,7 +24,7 @@ "url": "https://github.com/nrwl/nx/issues" }, "homepage": "https://nx.dev", - "schematics": "./generators.json", + "generators": "./generators.json", "ng-update": { "requirements": {}, "migrations": "./migrations.json" diff --git a/packages/express/src/generators/application/application.ts b/packages/express/src/generators/application/application.ts index adf4ae7adb131e..d7c5a7b3cfa032 100644 --- a/packages/express/src/generators/application/application.ts +++ b/packages/express/src/generators/application/application.ts @@ -1,5 +1,5 @@ import type { Tree } from '@nx/devkit'; -import { convertNxGenerator, formatFiles, toJS, updateJson } from '@nx/devkit'; +import { formatFiles, toJS, updateJson } from '@nx/devkit'; import { determineProjectNameAndRootOptions } from '@nx/devkit/src/generators/project-name-and-root-utils'; import { applicationGenerator as nodeApplicationGenerator } from '@nx/node'; import { join } from 'path'; @@ -83,7 +83,6 @@ export async function applicationGeneratorInternal(tree: Tree, schema: Schema) { } export default applicationGenerator; -export const applicationSchematic = convertNxGenerator(applicationGenerator); async function normalizeOptions( host: Tree, diff --git a/packages/express/src/generators/init/init.ts b/packages/express/src/generators/init/init.ts index 5a4d9a50efd1aa..e3eee52308e545 100644 --- a/packages/express/src/generators/init/init.ts +++ b/packages/express/src/generators/init/init.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, formatFiles, removeDependenciesFromPackageJson, Tree, @@ -47,4 +46,3 @@ export async function initGenerator(tree: Tree, schema: Schema) { } export default initGenerator; -export const initSchematic = convertNxGenerator(initGenerator); diff --git a/packages/jest/executors.json b/packages/jest/executors.json index 6a9afc165b6132..136c2300193a3b 100644 --- a/packages/jest/executors.json +++ b/packages/jest/executors.json @@ -1,11 +1,4 @@ { - "builders": { - "jest": { - "implementation": "./src/executors/jest/compat", - "schema": "./src/executors/jest/schema.json", - "description": "Run Jest unit tests." - } - }, "executors": { "jest": { "implementation": "./src/executors/jest/jest.impl", diff --git a/packages/jest/generators.json b/packages/jest/generators.json index 62fe83c0ccffd4..ba0c89972679d4 100644 --- a/packages/jest/generators.json +++ b/packages/jest/generators.json @@ -1,21 +1,6 @@ { "name": "Nx Jest", "version": "0.1", - "schematics": { - "init": { - "factory": "./src/generators/init/init#jestInitSchematic", - "schema": "./src/generators/init/schema.json", - "description": "Initialize the `@nrwl/jest` plugin.", - "aliases": ["ng-add"], - "hidden": true - }, - "configuration": { - "factory": "./src/generators/configuration/configuration#compat", - "schema": "./src/generators/configuration/schema.json", - "description": "Add Jest configuration to a project.", - "hidden": true - } - }, "generators": { "init": { "factory": "./src/generators/init/init#jestInitGenerator", diff --git a/packages/jest/package.json b/packages/jest/package.json index b626d67894dba8..25c461a51f4369 100644 --- a/packages/jest/package.json +++ b/packages/jest/package.json @@ -27,8 +27,8 @@ "url": "https://github.com/nrwl/nx/issues" }, "homepage": "https://nx.dev", - "schematics": "./generators.json", - "builders": "./executors.json", + "generators": "./generators.json", + "executors": "./executors.json", "ng-update": { "requirements": {}, "migrations": "./migrations.json" diff --git a/packages/jest/src/executors/jest/compat.ts b/packages/jest/src/executors/jest/compat.ts deleted file mode 100644 index 5211fd6b87f59d..00000000000000 --- a/packages/jest/src/executors/jest/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import { default as jestExecutor } from './jest.impl'; - -export default convertNxExecutor(jestExecutor); diff --git a/packages/jest/src/generators/configuration/configuration.ts b/packages/jest/src/generators/configuration/configuration.ts index 048c237a9c217f..4f062facd3a88d 100644 --- a/packages/jest/src/generators/configuration/configuration.ts +++ b/packages/jest/src/generators/configuration/configuration.ts @@ -7,7 +7,6 @@ import { JestProjectSchema, NormalizedJestProjectSchema } from './schema'; import { formatFiles, Tree, - convertNxGenerator, GeneratorCallback, readProjectConfiguration, } from '@nx/devkit'; @@ -75,5 +74,3 @@ export async function configurationGenerator( } export default configurationGenerator; - -export const compat = convertNxGenerator(configurationGenerator); diff --git a/packages/jest/src/generators/init/init.ts b/packages/jest/src/generators/init/init.ts index a4ffd0a61be888..6ad8d03a6655ce 100644 --- a/packages/jest/src/generators/init/init.ts +++ b/packages/jest/src/generators/init/init.ts @@ -1,10 +1,8 @@ import { addDependenciesToPackageJson, - convertNxGenerator, GeneratorCallback, getProjects, readNxJson, - readProjectConfiguration, removeDependenciesFromPackageJson, runTasksInSerial, stripIndents, @@ -233,5 +231,3 @@ function normalizeOptions(options: JestInitSchema) { } export default jestInitGenerator; - -export const jestInitSchematic = convertNxGenerator(jestInitGenerator); diff --git a/packages/js/executors.json b/packages/js/executors.json index ff7d851b68430b..884efedeac4595 100644 --- a/packages/js/executors.json +++ b/packages/js/executors.json @@ -28,27 +28,5 @@ "schema": "./src/executors/verdaccio/schema.json", "description": "Start local registry with verdaccio" } - }, - "builders": { - "tsc": { - "implementation": "./src/executors/tsc/compat", - "schema": "./src/executors/tsc/schema.json", - "description": "Build a project using TypeScript." - }, - "swc": { - "implementation": "./src/executors/swc/compat", - "schema": "./src/executors/swc/schema.json", - "description": "Build a project using SWC." - }, - "node": { - "implementation": "./src/executors/node/compat", - "schema": "./src/executors/node/schema.json", - "description": "Execute a Node application." - }, - "verdaccio": { - "implementation": "./src/executors/verdaccio/compat", - "schema": "./src/executors/verdaccio/schema.json", - "description": "Start local registry with verdaccio" - } } } diff --git a/packages/js/generators.json b/packages/js/generators.json index 91a7eed1c5dcf2..c43c2e134917ec 100644 --- a/packages/js/generators.json +++ b/packages/js/generators.json @@ -1,41 +1,6 @@ { "name": "nx/js", "version": "0.1", - "schematics": { - "library": { - "factory": "./src/generators/library/library#librarySchematic", - "schema": "./src/generators/library/schema.json", - "aliases": ["lib"], - "x-type": "library", - "description": "Create a library." - }, - "init": { - "factory": "./src/generators/init/init#initSchematic", - "schema": "./src/generators/init/schema.json", - "x-type": "init", - "description": "Initialize a TS/JS workspace.", - "hidden": true - }, - "convert-to-swc": { - "factory": "./src/generators/convert-to-swc/convert-to-swc#convertToSwcSchematic", - "schema": "./src/generators/convert-to-swc/schema.json", - "aliases": ["swc"], - "x-type": "library", - "description": "Convert a TypeScript library to compile with SWC." - }, - "setup-verdaccio": { - "factory": "./src/generators/setup-verdaccio/generator#setupVerdaccioSchematic", - "schema": "./src/generators/setup-verdaccio/schema.json", - "alias": ["verdaccio"], - "description": "Setup Verdaccio for local package management." - }, - "setup-build": { - "factory": "./src/generators/setup-build/generator#setupBuildSchematic", - "schema": "./src/generators/setup-build/schema.json", - "alias": ["build"], - "description": "setup-build generator" - } - }, "generators": { "library": { "factory": "./src/generators/library/library#libraryGeneratorInternal", diff --git a/packages/js/package.json b/packages/js/package.json index 48163735a48733..5baac1d301a88d 100644 --- a/packages/js/package.json +++ b/packages/js/package.json @@ -28,9 +28,7 @@ "migrations": "./migrations.json" }, "generators": "./generators.json", - "schematics": "./generators.json", "executors": "./executors.json", - "builders": "./executors.json", "dependencies": { "@babel/core": "^7.22.9", "@babel/plugin-proposal-class-properties": "^7.18.6", diff --git a/packages/js/src/executors/node/compat.ts b/packages/js/src/executors/node/compat.ts deleted file mode 100644 index 03735e668e6414..00000000000000 --- a/packages/js/src/executors/node/compat.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; -import nodeExecutor from './node.impl'; - -export default convertNxExecutor(nodeExecutor); diff --git a/packages/js/src/executors/swc/compat.ts b/packages/js/src/executors/swc/compat.ts deleted file mode 100644 index 156bea015e7d1a..00000000000000 --- a/packages/js/src/executors/swc/compat.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; -import { swcExecutor } from './swc.impl'; - -export default convertNxExecutor(swcExecutor); diff --git a/packages/js/src/executors/tsc/compat.ts b/packages/js/src/executors/tsc/compat.ts deleted file mode 100644 index ab5004ebde7fd1..00000000000000 --- a/packages/js/src/executors/tsc/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import { tscExecutor } from './tsc.impl'; - -export default convertNxExecutor(tscExecutor); diff --git a/packages/js/src/executors/verdaccio/compat.ts b/packages/js/src/executors/verdaccio/compat.ts deleted file mode 100644 index 59c9b9ce7d1673..00000000000000 --- a/packages/js/src/executors/verdaccio/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import { verdaccioExecutor } from './verdaccio.impl'; - -export default convertNxExecutor(verdaccioExecutor); diff --git a/packages/js/src/generators/convert-to-swc/convert-to-swc.ts b/packages/js/src/generators/convert-to-swc/convert-to-swc.ts index fb55f63966e98d..ee1c5aa5f264f2 100644 --- a/packages/js/src/generators/convert-to-swc/convert-to-swc.ts +++ b/packages/js/src/generators/convert-to-swc/convert-to-swc.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, installPackagesTask, ProjectConfiguration, readJson, @@ -109,4 +108,3 @@ function checkSwcDependencies( } export default convertToSwcGenerator; -export const convertToSwcSchematic = convertNxGenerator(convertToSwcGenerator); diff --git a/packages/js/src/generators/init/init.ts b/packages/js/src/generators/init/init.ts index 94b1c80dca4048..ed52e27735a84d 100644 --- a/packages/js/src/generators/init/init.ts +++ b/packages/js/src/generators/init/init.ts @@ -1,11 +1,9 @@ import { addDependenciesToPackageJson, - convertNxGenerator, ensurePackage, formatFiles, generateFiles, GeneratorCallback, - joinPathFragments, readJson, stripIndents, Tree, @@ -154,5 +152,3 @@ export async function initGenerator( } export default initGenerator; - -export const initSchematic = convertNxGenerator(initGenerator); diff --git a/packages/js/src/generators/library/library.ts b/packages/js/src/generators/library/library.ts index ef3451ede0ba61..b9488428ca1061 100644 --- a/packages/js/src/generators/library/library.ts +++ b/packages/js/src/generators/library/library.ts @@ -1,7 +1,6 @@ import { addDependenciesToPackageJson, addProjectConfiguration, - convertNxGenerator, ensurePackage, formatFiles, generateFiles, @@ -239,6 +238,7 @@ export type AddLintOptions = Pick< | 'rootProject' | 'bundler' >; + export async function addLint( tree: Tree, options: AddLintOptions @@ -813,4 +813,3 @@ function determineEntryFields( } export default libraryGenerator; -export const librarySchematic = convertNxGenerator(libraryGenerator); diff --git a/packages/js/src/generators/setup-build/generator.ts b/packages/js/src/generators/setup-build/generator.ts index f84c8e7e038bb6..a0ea3fad9877d8 100644 --- a/packages/js/src/generators/setup-build/generator.ts +++ b/packages/js/src/generators/setup-build/generator.ts @@ -1,5 +1,4 @@ import { - convertNxGenerator, ensurePackage, formatFiles, type GeneratorCallback, @@ -161,4 +160,3 @@ export async function setupBuildGenerator( } export default setupBuildGenerator; -export const setupBuildSchematic = convertNxGenerator(setupBuildGenerator); diff --git a/packages/js/src/generators/setup-verdaccio/generator.ts b/packages/js/src/generators/setup-verdaccio/generator.ts index 380d468495863b..735c556fd7dbe0 100644 --- a/packages/js/src/generators/setup-verdaccio/generator.ts +++ b/packages/js/src/generators/setup-verdaccio/generator.ts @@ -1,7 +1,6 @@ import { addDependenciesToPackageJson, addProjectConfiguration, - convertNxGenerator, formatFiles, generateFiles, ProjectConfiguration, @@ -75,4 +74,3 @@ export async function setupVerdaccio( } export default setupVerdaccio; -export const setupVerdaccioSchematic = convertNxGenerator(setupVerdaccio); diff --git a/packages/linter/executors.json b/packages/linter/executors.json index 684f49d0da77ad..ef774305dbbf1c 100644 --- a/packages/linter/executors.json +++ b/packages/linter/executors.json @@ -1,11 +1,4 @@ { - "builders": { - "eslint": { - "implementation": "./src/executors/eslint/compat", - "schema": "./src/executors/eslint/schema.json", - "description": "Run ESLint on a project." - } - }, "executors": { "eslint": { "implementation": "./src/executors/eslint/lint.impl", diff --git a/packages/linter/generators.json b/packages/linter/generators.json index 7cfdf3c9f80622..dde511249dbad0 100644 --- a/packages/linter/generators.json +++ b/packages/linter/generators.json @@ -1,19 +1,6 @@ { "name": "nx/linter", "version": "0.1", - "schematics": { - "workspace-rules-project": { - "factory": "./src/generators/workspace-rules-project/workspace-rules-project#lintWorkspaceRulesProjectSchematic", - "schema": "./src/generators/workspace-rules-project/schema.json", - "description": "Create the Workspace Lint Rules Project.", - "hidden": true - }, - "workspace-rule": { - "factory": "./src/generators/workspace-rule/workspace-rule#lintWorkspaceRuleSchematic", - "schema": "./src/generators/workspace-rule/schema.json", - "description": "Create a new Workspace ESLint rule." - } - }, "generators": { "workspace-rules-project": { "factory": "./src/generators/workspace-rules-project/workspace-rules-project#lintWorkspaceRulesProjectGenerator", diff --git a/packages/linter/package.json b/packages/linter/package.json index 93341f1e5866d5..962a62047e7085 100644 --- a/packages/linter/package.json +++ b/packages/linter/package.json @@ -27,8 +27,8 @@ "requirements": {}, "migrations": "./migrations.json" }, - "builders": "./executors.json", - "schematics": "./generators.json", + "executors": "./executors.json", + "generators": "./generators.json", "peerDependencies": { "eslint": "^8.0.0" }, diff --git a/packages/linter/src/executors/eslint/compat.ts b/packages/linter/src/executors/eslint/compat.ts deleted file mode 100644 index 1d005fafb0eee1..00000000000000 --- a/packages/linter/src/executors/eslint/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import lintExecutor from './lint.impl'; - -export default convertNxExecutor(lintExecutor); diff --git a/packages/linter/src/generators/workspace-rule/workspace-rule.ts b/packages/linter/src/generators/workspace-rule/workspace-rule.ts index ee9a7ea8ffb3dc..6c1ab98cf9e36a 100644 --- a/packages/linter/src/generators/workspace-rule/workspace-rule.ts +++ b/packages/linter/src/generators/workspace-rule/workspace-rule.ts @@ -1,7 +1,6 @@ import { applyChangesToString, ChangeType, - convertNxGenerator, formatFiles, generateFiles, joinPathFragments, @@ -115,7 +114,3 @@ export async function lintWorkspaceRuleGenerator( return projectGeneratorCallback; } - -export const lintWorkspaceRuleSchematic = convertNxGenerator( - lintWorkspaceRuleGenerator -); diff --git a/packages/linter/src/generators/workspace-rules-project/workspace-rules-project.ts b/packages/linter/src/generators/workspace-rules-project/workspace-rules-project.ts index 19f66980e78134..bcb39dbaea0423 100644 --- a/packages/linter/src/generators/workspace-rules-project/workspace-rules-project.ts +++ b/packages/linter/src/generators/workspace-rules-project/workspace-rules-project.ts @@ -1,6 +1,5 @@ import { addProjectConfiguration, - convertNxGenerator, ensurePackage, formatFiles, generateFiles, @@ -121,7 +120,3 @@ export async function lintWorkspaceRulesProjectGenerator( return installTask; } - -export const lintWorkspaceRulesProjectSchematic = convertNxGenerator( - lintWorkspaceRulesProjectGenerator -); diff --git a/packages/nest/generators.json b/packages/nest/generators.json index 86d60bc7bc7433..f7a242d0515847 100644 --- a/packages/nest/generators.json +++ b/packages/nest/generators.json @@ -2,104 +2,6 @@ "name": "nx/nest", "version": "0.1", "extends": ["@nx/workspace"], - "schematics": { - "application": { - "factory": "./src/generators/application/application#applicationSchematic", - "schema": "./src/generators/application/schema.json", - "aliases": ["app"], - "x-type": "application", - "description": "Create a NestJS application." - }, - "init": { - "factory": "./src/generators/init/init#initSchematic", - "schema": "./src/generators/init/schema.json", - "description": "Initialize the `@nrwl/nest` plugin.", - "aliases": ["ng-add"], - "hidden": true - }, - "library": { - "factory": "./src/generators/library/library#librarySchematic", - "schema": "./src/generators/library/schema.json", - "aliases": ["lib"], - "x-type": "library", - "description": "Create a new NestJS library." - }, - "class": { - "factory": "./src/generators/class/class#classSchematic", - "schema": "./src/generators/class/schema.json", - "description": "Run the `class` NestJS generator with Nx project support." - }, - "controller": { - "factory": "./src/generators/controller/controller#controllerSchematic", - "schema": "./src/generators/controller/schema.json", - "description": "Run the `controller` NestJS generator with Nx project support." - }, - "decorator": { - "factory": "./src/generators/decorator/decorator#decoratorSchematic", - "schema": "./src/generators/decorator/schema.json", - "description": "Run the `decorator` NestJS generator with Nx project support." - }, - "filter": { - "factory": "./src/generators/filter/filter#filterSchematic", - "schema": "./src/generators/filter/schema.json", - "description": "Run the `filter` NestJS generator with Nx project support." - }, - "gateway": { - "factory": "./src/generators/gateway/gateway#gatewaySchematic", - "schema": "./src/generators/gateway/schema.json", - "description": "Run the `gateway` NestJS generator with Nx project support." - }, - "guard": { - "factory": "./src/generators/guard/guard#guardSchematic", - "schema": "./src/generators/guard/schema.json", - "description": "Run the `guard` NestJS generator with Nx project support." - }, - "interceptor": { - "factory": "./src/generators/interceptor/interceptor#interceptorSchematic", - "schema": "./src/generators/interceptor/schema.json", - "description": "Run the `interceptor` NestJS generator with Nx project support." - }, - "interface": { - "factory": "./src/generators/interface/interface#interfaceSchematic", - "schema": "./src/generators/interface/schema.json", - "description": "Run the `interface` NestJS generator with Nx project support." - }, - "middleware": { - "factory": "./src/generators/middleware/middleware#middlewareSchematic", - "schema": "./src/generators/middleware/schema.json", - "description": "Run the `middleware` NestJS generator with Nx project support." - }, - "module": { - "factory": "./src/generators/module/module#moduleSchematic", - "schema": "./src/generators/module/schema.json", - "description": "Run the `module` NestJS generator with Nx project support." - }, - "pipe": { - "factory": "./src/generators/pipe/pipe#pipeSchematic", - "schema": "./src/generators/pipe/schema.json", - "description": "Run the `pipe` NestJS generator with Nx project support." - }, - "provider": { - "factory": "./src/generators/provider/provider#providerSchematic", - "schema": "./src/generators/provider/schema.json", - "description": "Run the `provider` NestJS generator with Nx project support." - }, - "resolver": { - "factory": "./src/generators/resolver/resolver#resolverSchematic", - "schema": "./src/generators/resolver/schema.json", - "description": "Run the `resolver` NestJS generator with Nx project support." - }, - "resource": { - "factory": "./src/generators/resource/resource#resourceSchematic", - "schema": "./src/generators/resource/schema.json", - "description": "Run the `resource` NestJS generator with Nx project support." - }, - "service": { - "factory": "./src/generators/service/service#serviceSchematic", - "schema": "./src/generators/service/schema.json", - "description": "Run the `service` NestJS generator with Nx project support." - } - }, "generators": { "application": { "factory": "./src/generators/application/application#applicationGeneratorInternal", diff --git a/packages/nest/package.json b/packages/nest/package.json index dc6b924ab48d59..5f2fe8b66d79e1 100644 --- a/packages/nest/package.json +++ b/packages/nest/package.json @@ -24,7 +24,7 @@ "url": "https://github.com/nrwl/nx/issues" }, "homepage": "https://nx.dev", - "schematics": "./generators.json", + "generators": "./generators.json", "ng-update": { "requirements": {}, "migrations": "./migrations.json" diff --git a/packages/nest/src/generators/application/application.ts b/packages/nest/src/generators/application/application.ts index caf90e1b6577f6..33426341f1f094 100644 --- a/packages/nest/src/generators/application/application.ts +++ b/packages/nest/src/generators/application/application.ts @@ -1,5 +1,5 @@ import type { GeneratorCallback, Tree } from '@nx/devkit'; -import { convertNxGenerator, formatFiles, runTasksInSerial } from '@nx/devkit'; +import { formatFiles, runTasksInSerial } from '@nx/devkit'; import { applicationGenerator as nodeApplicationGenerator } from '@nx/node'; import { initGenerator } from '../init/init'; @@ -46,5 +46,3 @@ export async function applicationGeneratorInternal( } export default applicationGenerator; - -export const applicationSchematic = convertNxGenerator(applicationGenerator); diff --git a/packages/nest/src/generators/class/class.ts b/packages/nest/src/generators/class/class.ts index b24c799617fab5..c8f16c0a6875ca 100644 --- a/packages/nest/src/generators/class/class.ts +++ b/packages/nest/src/generators/class/class.ts @@ -1,5 +1,4 @@ import type { Tree } from '@nx/devkit'; -import { convertNxGenerator } from '@nx/devkit'; import type { NestGeneratorWithLanguageOption, NestGeneratorWithTestOption, @@ -25,8 +24,6 @@ export function classGenerator( export default classGenerator; -export const classSchematic = convertNxGenerator(classGenerator); - function normalizeClassOptions( tree: Tree, options: ClassGeneratorOptions diff --git a/packages/nest/src/generators/controller/controller.ts b/packages/nest/src/generators/controller/controller.ts index 554ed0c32b1e26..d8e9487a85cf88 100644 --- a/packages/nest/src/generators/controller/controller.ts +++ b/packages/nest/src/generators/controller/controller.ts @@ -1,5 +1,4 @@ import type { Tree } from '@nx/devkit'; -import { convertNxGenerator } from '@nx/devkit'; import type { NestGeneratorWithLanguageOption, NestGeneratorWithTestOption, @@ -28,8 +27,6 @@ export function controllerGenerator( export default controllerGenerator; -export const controllerSchematic = convertNxGenerator(controllerGenerator); - function normalizeControllerOptions( tree: Tree, options: ControllerGeneratorOptions diff --git a/packages/nest/src/generators/decorator/decorator.ts b/packages/nest/src/generators/decorator/decorator.ts index 1092db987d6b38..1879890ff84f57 100644 --- a/packages/nest/src/generators/decorator/decorator.ts +++ b/packages/nest/src/generators/decorator/decorator.ts @@ -1,5 +1,4 @@ import type { Tree } from '@nx/devkit'; -import { convertNxGenerator } from '@nx/devkit'; import type { NestGeneratorWithLanguageOption, NormalizedOptions, @@ -19,8 +18,6 @@ export function decoratorGenerator( export default decoratorGenerator; -export const decoratorSchematic = convertNxGenerator(decoratorGenerator); - function normalizeDecoratorOptions( tree: Tree, options: DecoratorGeneratorOptions diff --git a/packages/nest/src/generators/filter/filter.ts b/packages/nest/src/generators/filter/filter.ts index 2b83a9ad40b638..4ff229beb6cec4 100644 --- a/packages/nest/src/generators/filter/filter.ts +++ b/packages/nest/src/generators/filter/filter.ts @@ -1,5 +1,4 @@ import type { Tree } from '@nx/devkit'; -import { convertNxGenerator } from '@nx/devkit'; import type { NestGeneratorWithLanguageOption, NestGeneratorWithTestOption, @@ -25,8 +24,6 @@ export function filterGenerator( export default filterGenerator; -export const filterSchematic = convertNxGenerator(filterGenerator); - function normalizeFilterOptions( tree: Tree, options: FilterGeneratorOptions diff --git a/packages/nest/src/generators/gateway/gateway.ts b/packages/nest/src/generators/gateway/gateway.ts index 0e816863e5fdda..cc10b0b88b375c 100644 --- a/packages/nest/src/generators/gateway/gateway.ts +++ b/packages/nest/src/generators/gateway/gateway.ts @@ -1,5 +1,4 @@ import type { Tree } from '@nx/devkit'; -import { convertNxGenerator } from '@nx/devkit'; import type { NestGeneratorWithLanguageOption, NestGeneratorWithTestOption, @@ -25,8 +24,6 @@ export function gatewayGenerator( export default gatewayGenerator; -export const gatewaySchematic = convertNxGenerator(gatewayGenerator); - function normalizeGatewayOptions( tree: Tree, options: GatewayGeneratorOptions diff --git a/packages/nest/src/generators/guard/guard.ts b/packages/nest/src/generators/guard/guard.ts index 20d1187adabddc..80b36cb0f88dc7 100644 --- a/packages/nest/src/generators/guard/guard.ts +++ b/packages/nest/src/generators/guard/guard.ts @@ -1,5 +1,4 @@ import type { Tree } from '@nx/devkit'; -import { convertNxGenerator } from '@nx/devkit'; import type { NestGeneratorWithLanguageOption, NestGeneratorWithTestOption, @@ -25,8 +24,6 @@ export function guardGenerator( export default guardGenerator; -export const guardSchematic = convertNxGenerator(guardGenerator); - function normalizeGuardOptions( tree: Tree, options: GuardGeneratorOptions diff --git a/packages/nest/src/generators/init/init.ts b/packages/nest/src/generators/init/init.ts index cb72841ff5ce9a..cfbe4e1b07d7ba 100644 --- a/packages/nest/src/generators/init/init.ts +++ b/packages/nest/src/generators/init/init.ts @@ -1,5 +1,5 @@ import type { GeneratorCallback, Tree } from '@nx/devkit'; -import { convertNxGenerator, formatFiles, runTasksInSerial } from '@nx/devkit'; +import { formatFiles, runTasksInSerial } from '@nx/devkit'; import { initGenerator as nodeInitGenerator } from '@nx/node'; import { addDependencies, normalizeOptions } from './lib'; @@ -31,5 +31,3 @@ export async function initGenerator( } export default initGenerator; - -export const initSchematic = convertNxGenerator(initGenerator); diff --git a/packages/nest/src/generators/interceptor/interceptor.ts b/packages/nest/src/generators/interceptor/interceptor.ts index 8a1fa227639c44..a1387f34450c10 100644 --- a/packages/nest/src/generators/interceptor/interceptor.ts +++ b/packages/nest/src/generators/interceptor/interceptor.ts @@ -1,5 +1,4 @@ import type { Tree } from '@nx/devkit'; -import { convertNxGenerator } from '@nx/devkit'; import type { NestGeneratorWithLanguageOption, NestGeneratorWithTestOption, @@ -25,8 +24,6 @@ export function interceptorGenerator( export default interceptorGenerator; -export const interceptorSchematic = convertNxGenerator(interceptorGenerator); - function normalizeInterceptorOptions( tree: Tree, options: InterceptorGeneratorOptions diff --git a/packages/nest/src/generators/interface/interface.ts b/packages/nest/src/generators/interface/interface.ts index c82310273af34e..b3ec2f50a529f1 100644 --- a/packages/nest/src/generators/interface/interface.ts +++ b/packages/nest/src/generators/interface/interface.ts @@ -1,5 +1,4 @@ import type { Tree } from '@nx/devkit'; -import { convertNxGenerator } from '@nx/devkit'; import type { NestGeneratorOptions } from '../utils'; import { normalizeOptions, runNestSchematic } from '../utils'; @@ -15,5 +14,3 @@ export function interfaceGenerator( } export default interfaceGenerator; - -export const interfaceSchematic = convertNxGenerator(interfaceGenerator); diff --git a/packages/nest/src/generators/library/library.ts b/packages/nest/src/generators/library/library.ts index 09e93fa4553bb3..70b46806632353 100644 --- a/packages/nest/src/generators/library/library.ts +++ b/packages/nest/src/generators/library/library.ts @@ -1,5 +1,5 @@ import type { GeneratorCallback, Tree } from '@nx/devkit'; -import { convertNxGenerator, formatFiles } from '@nx/devkit'; +import { formatFiles } from '@nx/devkit'; import { libraryGenerator as jsLibraryGenerator } from '@nx/js'; import { addDependencies } from '../init/lib'; import { @@ -44,5 +44,3 @@ export async function libraryGeneratorInternal( } export default libraryGenerator; - -export const librarySchematic = convertNxGenerator(libraryGenerator); diff --git a/packages/nest/src/generators/middleware/middleware.ts b/packages/nest/src/generators/middleware/middleware.ts index 3690226acfa629..3b42bbfa6b7246 100644 --- a/packages/nest/src/generators/middleware/middleware.ts +++ b/packages/nest/src/generators/middleware/middleware.ts @@ -1,5 +1,4 @@ import type { Tree } from '@nx/devkit'; -import { convertNxGenerator } from '@nx/devkit'; import type { NestGeneratorWithLanguageOption, NestGeneratorWithTestOption, @@ -25,8 +24,6 @@ export function middlewareGenerator( export default middlewareGenerator; -export const middlewareSchematic = convertNxGenerator(middlewareGenerator); - function normalizeMiddlewareOptions( tree: Tree, options: MiddlewareGeneratorOptions diff --git a/packages/nest/src/generators/module/module.ts b/packages/nest/src/generators/module/module.ts index 5faa8c640892ac..c29a9a41a44fb2 100644 --- a/packages/nest/src/generators/module/module.ts +++ b/packages/nest/src/generators/module/module.ts @@ -1,5 +1,4 @@ import type { Tree } from '@nx/devkit'; -import { convertNxGenerator } from '@nx/devkit'; import type { NestGeneratorWithLanguageOption, NormalizedOptions, @@ -22,8 +21,6 @@ export function moduleGenerator( export default moduleGenerator; -export const moduleSchematic = convertNxGenerator(moduleGenerator); - function normalizeModuleOptions( tree: Tree, options: ModuleGeneratorOptions diff --git a/packages/nest/src/generators/pipe/pipe.ts b/packages/nest/src/generators/pipe/pipe.ts index 5463bbfa249ac7..28ea67d3efdcb9 100644 --- a/packages/nest/src/generators/pipe/pipe.ts +++ b/packages/nest/src/generators/pipe/pipe.ts @@ -1,5 +1,4 @@ import type { Tree } from '@nx/devkit'; -import { convertNxGenerator } from '@nx/devkit'; import type { NestGeneratorWithLanguageOption, NestGeneratorWithTestOption, @@ -25,8 +24,6 @@ export function pipeGenerator( export default pipeGenerator; -export const pipeSchematic = convertNxGenerator(pipeGenerator); - function normalizePipeOptions( tree: Tree, options: PipeGeneratorOptions diff --git a/packages/nest/src/generators/provider/provider.ts b/packages/nest/src/generators/provider/provider.ts index 95e88475b9d17c..c708dea83bda53 100644 --- a/packages/nest/src/generators/provider/provider.ts +++ b/packages/nest/src/generators/provider/provider.ts @@ -1,5 +1,4 @@ import type { Tree } from '@nx/devkit'; -import { convertNxGenerator } from '@nx/devkit'; import type { NestGeneratorWithLanguageOption, NestGeneratorWithTestOption, @@ -25,8 +24,6 @@ export function providerGenerator( export default providerGenerator; -export const providerSchematic = convertNxGenerator(providerGenerator); - function normalizeProviderOptions( tree: Tree, options: ProviderGeneratorOptions diff --git a/packages/nest/src/generators/resolver/resolver.ts b/packages/nest/src/generators/resolver/resolver.ts index e60f5e6ddd7b7a..06e86c708f3c86 100644 --- a/packages/nest/src/generators/resolver/resolver.ts +++ b/packages/nest/src/generators/resolver/resolver.ts @@ -1,5 +1,4 @@ import type { Tree } from '@nx/devkit'; -import { convertNxGenerator } from '@nx/devkit'; import type { NestGeneratorWithLanguageOption, NestGeneratorWithTestOption, @@ -25,8 +24,6 @@ export function resolverGenerator( export default resolverGenerator; -export const resolverSchematic = convertNxGenerator(resolverGenerator); - function normalizeResolverOptions( tree: Tree, options: ResolverGeneratorOptions diff --git a/packages/nest/src/generators/resource/resource.ts b/packages/nest/src/generators/resource/resource.ts index a49cf7740f95f6..f5aa0faf9cba24 100644 --- a/packages/nest/src/generators/resource/resource.ts +++ b/packages/nest/src/generators/resource/resource.ts @@ -1,5 +1,4 @@ import type { Tree } from '@nx/devkit'; -import { convertNxGenerator } from '@nx/devkit'; import type { NestGeneratorWithLanguageOption, NestGeneratorWithResourceOption, @@ -27,8 +26,6 @@ export function resourceGenerator( export default resourceGenerator; -export const resourceSchematic = convertNxGenerator(resourceGenerator); - function normalizeResourceOptions( tree: Tree, options: ResourceGeneratorOptions diff --git a/packages/nest/src/generators/service/service.ts b/packages/nest/src/generators/service/service.ts index 7c5db71bd3c880..6a7011cfe07190 100644 --- a/packages/nest/src/generators/service/service.ts +++ b/packages/nest/src/generators/service/service.ts @@ -1,5 +1,4 @@ import type { Tree } from '@nx/devkit'; -import { convertNxGenerator } from '@nx/devkit'; import type { NestGeneratorWithLanguageOption, NestGeneratorWithTestOption, @@ -25,8 +24,6 @@ export function serviceGenerator( export default serviceGenerator; -export const serviceSchematic = convertNxGenerator(serviceGenerator); - function normalizeServiceOptions( tree: Tree, options: ServiceGeneratorOptions diff --git a/packages/next/executors.json b/packages/next/executors.json index 75ceca37a6b4b7..02cee6578f6033 100644 --- a/packages/next/executors.json +++ b/packages/next/executors.json @@ -16,23 +16,5 @@ "description": "Export a Next.js application. The exported application is located at `dist/$outputPath/exported`.", "x-deprecated": "Use static exports in next.config.js instead. See: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports." } - }, - "builders": { - "build": { - "implementation": "./src/executors/build/compat", - "schema": "./src/executors/build/schema.json", - "description": "Build a Next.js application." - }, - "server": { - "implementation": "./src/executors/server/compat", - "schema": "./src/executors/server/schema.json", - "description": "Serve a Next.js application." - }, - "export": { - "implementation": "./src/executors/export/compat", - "schema": "./src/executors/export/schema.json", - "description": "Export a Next.js application. The exported application is located at `dist/$outputPath/exported`.", - "x-deprecated": "Use static exports in next.config.js instead. See: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports." - } } } diff --git a/packages/next/generators.json b/packages/next/generators.json index 8ad7a43caad3bf..da4a3d1bf51d6d 100644 --- a/packages/next/generators.json +++ b/packages/next/generators.json @@ -2,36 +2,6 @@ "name": "nx/next", "version": "0.1", "extends": ["@nx/react"], - "schematics": { - "init": { - "factory": "./src/generators/init/init#nextInitSchematic", - "schema": "./src/generators/init/schema.json", - "description": "Initialize the `@nrwl/next` plugin.", - "hidden": true - }, - "application": { - "factory": "./src/generators/application/application#applicationSchematic", - "schema": "./src/generators/application/schema.json", - "aliases": ["app"], - "x-type": "application", - "description": "Create a Next.js application." - }, - "page": { - "factory": "./src/generators/page/page#pageSchematic", - "schema": "./src/generators/page/schema.json", - "description": "Create a Next.js page component." - }, - "component": { - "factory": "./src/generators/component/component#componentSchematic", - "schema": "./src/generators/component/schema.json", - "description": "Create a React component." - }, - "custom-server": { - "factory": "./src/generators/custom-server/custom-server#customServerSchematic", - "schema": "./src/generators/custom-server/schema.json", - "description": "Set up a custom server." - } - }, "generators": { "init": { "factory": "./src/generators/init/init#nextInitGenerator", diff --git a/packages/next/package.json b/packages/next/package.json index c050f395619029..c4af16631c6778 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -24,8 +24,8 @@ "url": "https://github.com/nrwl/nx/issues" }, "homepage": "https://nx.dev", - "schematics": "./generators.json", - "builders": "./executors.json", + "generators": "./generators.json", + "executors": "./executors.json", "ng-update": { "requirements": {}, "migrations": "./migrations.json" diff --git a/packages/next/src/executors/build/compat.ts b/packages/next/src/executors/build/compat.ts deleted file mode 100644 index fc7908d20075b8..00000000000000 --- a/packages/next/src/executors/build/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import buildExecutor from './build.impl'; - -export default convertNxExecutor(buildExecutor); diff --git a/packages/next/src/executors/export/compat.ts b/packages/next/src/executors/export/compat.ts deleted file mode 100644 index b3d3c12d21d776..00000000000000 --- a/packages/next/src/executors/export/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import exportExecutor from './export.impl'; - -export default convertNxExecutor(exportExecutor); diff --git a/packages/next/src/executors/server/compat.ts b/packages/next/src/executors/server/compat.ts deleted file mode 100644 index 62dff828d21b3b..00000000000000 --- a/packages/next/src/executors/server/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import serverExecutor from './server.impl'; - -export default convertNxExecutor(serverExecutor); diff --git a/packages/next/src/generators/application/application.ts b/packages/next/src/generators/application/application.ts index 8b67f6d27fba59..854b3daca37e97 100644 --- a/packages/next/src/generators/application/application.ts +++ b/packages/next/src/generators/application/application.ts @@ -1,5 +1,4 @@ import { - convertNxGenerator, formatFiles, GeneratorCallback, joinPathFragments, @@ -76,5 +75,3 @@ export async function applicationGeneratorInternal(host: Tree, schema: Schema) { return runTasksInSerial(...tasks); } - -export const applicationSchematic = convertNxGenerator(applicationGenerator); diff --git a/packages/next/src/generators/component/component.ts b/packages/next/src/generators/component/component.ts index fed2cf03f74ba4..1e357d943fe95c 100644 --- a/packages/next/src/generators/component/component.ts +++ b/packages/next/src/generators/component/component.ts @@ -1,5 +1,4 @@ import { - convertNxGenerator, formatFiles, getProjects, joinPathFragments, @@ -61,4 +60,3 @@ export async function componentGenerator(host: Tree, options: Schema) { } export default componentGenerator; -export const componentSchematic = convertNxGenerator(componentGenerator); diff --git a/packages/next/src/generators/custom-server/custom-server.ts b/packages/next/src/generators/custom-server/custom-server.ts index ddc87338c598bb..5d10feff102d6f 100644 --- a/packages/next/src/generators/custom-server/custom-server.ts +++ b/packages/next/src/generators/custom-server/custom-server.ts @@ -1,7 +1,6 @@ import type { Tree } from '@nx/devkit'; import { updateJson, - convertNxGenerator, generateFiles, logger, offsetFromRoot, @@ -115,5 +114,3 @@ export async function customServerGenerator( return json; }); } - -export const customServerSchematic = convertNxGenerator(customServerGenerator); diff --git a/packages/next/src/generators/init/init.ts b/packages/next/src/generators/init/init.ts index ed69a3ffc44309..39f4afa0a400da 100644 --- a/packages/next/src/generators/init/init.ts +++ b/packages/next/src/generators/init/init.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, ensurePackage, GeneratorCallback, runTasksInSerial, @@ -91,4 +90,3 @@ export async function nextInitGenerator(host: Tree, schema: InitSchema) { } export default nextInitGenerator; -export const nextInitSchematic = convertNxGenerator(nextInitGenerator); diff --git a/packages/next/src/generators/library/library.ts b/packages/next/src/generators/library/library.ts index da3e94a81b9395..767c41cc98d557 100644 --- a/packages/next/src/generators/library/library.ts +++ b/packages/next/src/generators/library/library.ts @@ -1,5 +1,4 @@ import { - convertNxGenerator, formatFiles, GeneratorCallback, joinPathFragments, @@ -119,4 +118,3 @@ export async function libraryGeneratorInternal(host: Tree, rawOptions: Schema) { } export default libraryGenerator; -export const librarySchematic = convertNxGenerator(libraryGenerator); diff --git a/packages/next/src/generators/page/page.ts b/packages/next/src/generators/page/page.ts index b392e2492f1408..2683dad0d2211f 100644 --- a/packages/next/src/generators/page/page.ts +++ b/packages/next/src/generators/page/page.ts @@ -1,6 +1,5 @@ import { componentGenerator as reactComponentGenerator } from '@nx/react'; import { - convertNxGenerator, formatFiles, joinPathFragments, readProjectConfiguration, @@ -56,4 +55,3 @@ function normalizeOptions(host: Tree, options: Schema) { } export default pageGenerator; -export const pageSchematic = convertNxGenerator(pageGenerator); diff --git a/packages/node/generators.json b/packages/node/generators.json index 4da769bc749c6c..17d96c7bf1ec51 100644 --- a/packages/node/generators.json +++ b/packages/node/generators.json @@ -30,33 +30,5 @@ "description": "Set up Docker configuration for a project.", "hidden": false } - }, - "schematics": { - "init": { - "factory": "./src/generators/init/init#initSchematic", - "schema": "./src/generators/init/schema.json", - "description": "Initialize the `@nrwl/node` plugin.", - "aliases": ["ng-add"], - "hidden": true - }, - "application": { - "factory": "./src/generators/application/application#applicationSchematic", - "schema": "./src/generators/application/schema.json", - "aliases": ["app"], - "x-type": "application", - "description": "Create a node application." - }, - "library": { - "factory": "./src/generators/library/library#librarySchematic", - "schema": "./src/generators/library/schema.json", - "aliases": ["lib"], - "x-type": "library", - "description": "Create a node library." - }, - "setup-docker": { - "factory": "./src/generators/setup-docker/setup-docker#setupDockerGenerator", - "schema": "./src/generators/setup-docker/schema.json", - "description": "Set up Docker configuration for a project." - } } } diff --git a/packages/node/package.json b/packages/node/package.json index 46385595acadfd..fb042aca55f209 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -24,7 +24,7 @@ "url": "https://github.com/nrwl/nx/issues" }, "homepage": "https://nx.dev", - "schematics": "./generators.json", + "generators": "./generators.json", "ng-update": { "requirements": {}, "migrations": "./migrations.json" diff --git a/packages/node/src/generators/application/application.ts b/packages/node/src/generators/application/application.ts index a7349b4c059710..195fa6230e6006 100644 --- a/packages/node/src/generators/application/application.ts +++ b/packages/node/src/generators/application/application.ts @@ -1,7 +1,6 @@ import { addDependenciesToPackageJson, addProjectConfiguration, - convertNxGenerator, ensurePackage, formatFiles, generateFiles, @@ -494,4 +493,3 @@ async function normalizeOptions( } export default applicationGenerator; -export const applicationSchematic = convertNxGenerator(applicationGenerator); diff --git a/packages/node/src/generators/e2e-project/e2e-project.ts b/packages/node/src/generators/e2e-project/e2e-project.ts index 6d977f1f818863..3acac02165a748 100644 --- a/packages/node/src/generators/e2e-project/e2e-project.ts +++ b/packages/node/src/generators/e2e-project/e2e-project.ts @@ -1,7 +1,6 @@ import { addDependenciesToPackageJson, addProjectConfiguration, - convertNxGenerator, formatFiles, generateFiles, GeneratorCallback, @@ -167,4 +166,3 @@ async function normalizeOptions( } export default e2eProjectGenerator; -export const e2eProjectSchematic = convertNxGenerator(e2eProjectGenerator); diff --git a/packages/node/src/generators/init/init.ts b/packages/node/src/generators/init/init.ts index dded03c54edcdd..9b573f1d65bbcb 100644 --- a/packages/node/src/generators/init/init.ts +++ b/packages/node/src/generators/init/init.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, formatFiles, GeneratorCallback, removeDependenciesFromPackageJson, @@ -63,4 +62,3 @@ export async function initGenerator(tree: Tree, schema: Schema) { } export default initGenerator; -export const initSchematic = convertNxGenerator(initGenerator); diff --git a/packages/node/src/generators/library/library.ts b/packages/node/src/generators/library/library.ts index 4a56a55202c200..3d8e5a9a125428 100644 --- a/packages/node/src/generators/library/library.ts +++ b/packages/node/src/generators/library/library.ts @@ -1,5 +1,4 @@ import { - convertNxGenerator, formatFiles, generateFiles, GeneratorCallback, @@ -76,7 +75,6 @@ export async function libraryGeneratorInternal(tree: Tree, schema: Schema) { } export default libraryGenerator; -export const librarySchematic = convertNxGenerator(libraryGenerator); async function normalizeOptions( tree: Tree, diff --git a/packages/node/src/generators/setup-docker/setup-docker.ts b/packages/node/src/generators/setup-docker/setup-docker.ts index d15d355437793f..5176b71fe9d1d2 100644 --- a/packages/node/src/generators/setup-docker/setup-docker.ts +++ b/packages/node/src/generators/setup-docker/setup-docker.ts @@ -1,5 +1,4 @@ import { - convertNxGenerator, formatFiles, generateFiles, GeneratorCallback, @@ -81,4 +80,3 @@ export async function setupDockerGenerator( } export default setupDockerGenerator; -export const setupDockerSchematic = convertNxGenerator(setupDockerGenerator); diff --git a/packages/nuxt/src/generators/init/init.ts b/packages/nuxt/src/generators/init/init.ts index 194efdb3994940..081500907eaf78 100644 --- a/packages/nuxt/src/generators/init/init.ts +++ b/packages/nuxt/src/generators/init/init.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, GeneratorCallback, runTasksInSerial, Tree, @@ -63,4 +62,3 @@ export async function nuxtInitGenerator(host: Tree, schema: InitSchema) { } export default nuxtInitGenerator; -export const nuxtInitSchematic = convertNxGenerator(nuxtInitGenerator); diff --git a/packages/nx/executors.json b/packages/nx/executors.json index 859cde08719f13..c69d5eb941fbf7 100644 --- a/packages/nx/executors.json +++ b/packages/nx/executors.json @@ -1,16 +1,4 @@ { - "builders": { - "run-commands": { - "implementation": "./src/executors/run-commands/compat", - "schema": "./src/executors/run-commands/schema.json", - "description": "Run any custom commands with Nx." - }, - "run-script": { - "implementation": "./src/executors/run-script/compat", - "schema": "./src/executors/run-script/schema.json", - "description": "Run an NPM script using Nx." - } - }, "executors": { "noop": { "implementation": "./src/executors/noop/noop.impl", diff --git a/packages/nx/src/adapter/ngcli-adapter.ts b/packages/nx/src/adapter/ngcli-adapter.ts index d88c92b88c1256..a9f5c469ec647f 100644 --- a/packages/nx/src/adapter/ngcli-adapter.ts +++ b/packages/nx/src/adapter/ngcli-adapter.ts @@ -792,30 +792,6 @@ function resolveMigrationsCollection(name: string): string { let collectionResolutionOverrides = null; let mockedSchematics = null; -/** - * By default, Angular Devkit schematic collections will be resolved using the Node resolution. - * This doesn't work if you are testing schematics that refer to other schematics in the - * same repo. - * - * This function can can be used to override the resolution behaviour. - * - * Example: - * - * ```typescript - * overrideCollectionResolutionForTesting({ - * '@nx/workspace': path.join(__dirname, '../../../../workspace/generators.json'), - * '@nx/angular': path.join(__dirname, '../../../../angular/generators.json'), - * '@nx/linter': path.join(__dirname, '../../../../linter/generators.json') - * }); - * - * ``` - */ -export function overrideCollectionResolutionForTesting(collections: { - [name: string]: string; -}) { - collectionResolutionOverrides = collections; -} - /** * If you have an Nx Devkit generator invoking the wrapped Angular Devkit schematic, * and you don't want the Angular Devkit schematic to run, you can mock it up using this function. @@ -1035,6 +1011,7 @@ async function getWrappedWorkspaceNodeModulesArchitectHost( constructor(private workspace, private root) { super(workspace, root); } + async resolveBuilder(builderStr: string): Promise { const [packageName, builderName] = builderStr.split(':'); diff --git a/packages/nx/src/command-line/init/implementation/angular/integrated-workspace.ts b/packages/nx/src/command-line/init/implementation/angular/integrated-workspace.ts index 00bf332cc72cbd..0ca59a6bccbdd7 100644 --- a/packages/nx/src/command-line/init/implementation/angular/integrated-workspace.ts +++ b/packages/nx/src/command-line/init/implementation/angular/integrated-workspace.ts @@ -3,5 +3,5 @@ import { getPackageManagerCommand } from '../../../../utils/package-manager'; export function setupIntegratedWorkspace(): void { const pmc = getPackageManagerCommand(); - execSync(`${pmc.exec} ng g @nx/angular:ng-add`, { stdio: [0, 1, 2] }); + execSync(`${pmc.exec} nx g @nx/angular:ng-add`, { stdio: [0, 1, 2] }); } diff --git a/packages/nx/src/executors/run-commands/compat.ts b/packages/nx/src/executors/run-commands/compat.ts deleted file mode 100644 index fc6201313b8f04..00000000000000 --- a/packages/nx/src/executors/run-commands/compat.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { convertNxExecutor } from '../utils/convert-nx-executor'; -import { default as runCommandsExecutor } from './run-commands.impl'; - -export default convertNxExecutor(runCommandsExecutor); diff --git a/packages/nx/src/executors/run-script/compat.ts b/packages/nx/src/executors/run-script/compat.ts deleted file mode 100644 index 08ac4ce5999a21..00000000000000 --- a/packages/nx/src/executors/run-script/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '../utils/convert-nx-executor'; - -import { default as runScriptExecutor } from './run-script.impl'; - -export default convertNxExecutor(runScriptExecutor); diff --git a/packages/playwright/executors.json b/packages/playwright/executors.json index 5cf4695be53924..dcb3239e10a206 100644 --- a/packages/playwright/executors.json +++ b/packages/playwright/executors.json @@ -1,11 +1,4 @@ { - "builders": { - "playwright": { - "implementation": "./src/executors/playwright/compat", - "schema": "./src/executors/playwright/schema.json", - "description": "Run Playwright tests." - } - }, "executors": { "playwright": { "implementation": "./src/executors/playwright/playwright", diff --git a/packages/playwright/generators.json b/packages/playwright/generators.json index c8d82df7d69f36..3584b886670d18 100644 --- a/packages/playwright/generators.json +++ b/packages/playwright/generators.json @@ -1,18 +1,6 @@ { "name": "Nx Playwright", "version": "0.1", - "schematics": { - "configuration": { - "factory": "./src/generators/configuration/configuration#configurationSchematic", - "schema": "./src/generators/configuration/schema.json", - "description": "Add Nx Playwright configuration to your project" - }, - "init": { - "factory": "./src/generators/init/init#initSchematic", - "schema": "./src/generators/init/schema.json", - "description": "Initializes a Playwright project in the current workspace" - } - }, "generators": { "configuration": { "factory": "./src/generators/configuration/configuration", diff --git a/packages/playwright/src/executors/playwright/compat.ts b/packages/playwright/src/executors/playwright/compat.ts deleted file mode 100644 index ca72a5cebe7c0e..00000000000000 --- a/packages/playwright/src/executors/playwright/compat.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; -import { playwrightExecutor } from './playwright'; - -export default convertNxExecutor(playwrightExecutor); diff --git a/packages/playwright/src/generators/configuration/configuration.ts b/packages/playwright/src/generators/configuration/configuration.ts index caa18204765f0d..40278071c3abad 100644 --- a/packages/playwright/src/generators/configuration/configuration.ts +++ b/packages/playwright/src/generators/configuration/configuration.ts @@ -1,5 +1,4 @@ import { - convertNxGenerator, formatFiles, generateFiles, GeneratorCallback, @@ -101,6 +100,3 @@ Rename or remove the existing e2e target.`); } export default configurationGenerator; -export const configurationSchematic = convertNxGenerator( - configurationGenerator -); diff --git a/packages/playwright/src/generators/init/init.ts b/packages/playwright/src/generators/init/init.ts index 21fc7bd2a66f2a..2768b79d2bb05f 100644 --- a/packages/playwright/src/generators/init/init.ts +++ b/packages/playwright/src/generators/init/init.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, formatFiles, GeneratorCallback, getPackageManagerCommand, @@ -72,4 +71,3 @@ export async function initGenerator(tree: Tree, options: InitGeneratorSchema) { } export default initGenerator; -export const initSchematic = convertNxGenerator(initGenerator); diff --git a/packages/plugin/executors.json b/packages/plugin/executors.json index 8a5bcb9852a51f..91bdd162fe74ff 100644 --- a/packages/plugin/executors.json +++ b/packages/plugin/executors.json @@ -1,12 +1,4 @@ { - "builders": { - "e2e": { - "implementation": "./src/executors/e2e/compat", - "schema": "./src/executors/e2e/schema.json", - "description": "Creates and runs the E2E tests for an Nx Plugin.", - "x-deprecated": "@nx/plugin:e2e is deprecated and will be removed in Nx 18. Use @nx/jest:jest instead." - } - }, "executors": { "e2e": { "implementation": "./src/executors/e2e/e2e.impl", diff --git a/packages/plugin/generators.json b/packages/plugin/generators.json index 91502f26bcd9cf..8b86e8349bd120 100644 --- a/packages/plugin/generators.json +++ b/packages/plugin/generators.json @@ -45,37 +45,5 @@ "hidden": true, "x-use-standalone-layout": true } - }, - "schematics": { - "plugin": { - "factory": "./src/generators/plugin/plugin#pluginSchematic", - "schema": "./src/generators/plugin/schema.json", - "description": "Create a Nx Plugin." - }, - "create-package": { - "factory": "./src/generators/create-package/create-package#createPackageSchematic", - "schema": "./src/generators/create-package/schema.json", - "description": "Create a package which can be used by npx to create a new workspace" - }, - "e2e-project": { - "factory": "./src/generators/e2e-project/e2e#e2eProjectSchematic", - "schema": "./src/generators/e2e-project/schema.json", - "description": "Create a E2E application for a Nx Plugin." - }, - "migration": { - "factory": "./src/generators/migration/migration#migrationSchematic", - "schema": "./src/generators/migration/schema.json", - "description": "Create a migration for an Nx Plugin." - }, - "generator": { - "factory": "./src/generators/generator/generator#generatorSchematic", - "schema": "./src/generators/generator/schema.json", - "description": "Create a generator for an Nx Plugin." - }, - "executor": { - "factory": "./src/generators/executor/executor#executorSchematic", - "schema": "./src/generators/executor/schema.json", - "description": "Create an executor for an Nx Plugin." - } } } diff --git a/packages/plugin/package.json b/packages/plugin/package.json index b52aca1e9e93fe..c4270f0d1ab0a8 100644 --- a/packages/plugin/package.json +++ b/packages/plugin/package.json @@ -21,8 +21,8 @@ "url": "https://github.com/nrwl/nx/issues" }, "homepage": "https://nx.dev", - "schematics": "./generators.json", - "builders": "./executors.json", + "generators": "./generators.json", + "executors": "./executors.json", "ng-update": { "requirements": {}, "migrations": "./migrations.json" diff --git a/packages/plugin/src/executors/e2e/compat.ts b/packages/plugin/src/executors/e2e/compat.ts deleted file mode 100644 index 1b9fcf07a7ea68..00000000000000 --- a/packages/plugin/src/executors/e2e/compat.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; -import { nxPluginE2EExecutor } from './e2e.impl'; - -export const nxPluginE2EBuilder = convertNxExecutor(nxPluginE2EExecutor); diff --git a/packages/plugin/src/generators/create-package/create-package.ts b/packages/plugin/src/generators/create-package/create-package.ts index 55d2487035b072..2b765712261bbc 100644 --- a/packages/plugin/src/generators/create-package/create-package.ts +++ b/packages/plugin/src/generators/create-package/create-package.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, formatFiles, generateFiles, GeneratorCallback, @@ -187,6 +186,3 @@ function addE2eProject(host: Tree, options: NormalizedSchema) { } export default createPackageGenerator; -export const createPackageSchematic = convertNxGenerator( - createPackageGenerator -); diff --git a/packages/plugin/src/generators/e2e-project/e2e.ts b/packages/plugin/src/generators/e2e-project/e2e.ts index ca28e54602a230..11811296957f22 100644 --- a/packages/plugin/src/generators/e2e-project/e2e.ts +++ b/packages/plugin/src/generators/e2e-project/e2e.ts @@ -1,7 +1,6 @@ import type { Tree } from '@nx/devkit'; import { addProjectConfiguration, - convertNxGenerator, extractLayoutDirectory, formatFiles, generateFiles, @@ -215,4 +214,3 @@ export async function e2eProjectGeneratorInternal(host: Tree, schema: Schema) { } export default e2eProjectGenerator; -export const e2eProjectSchematic = convertNxGenerator(e2eProjectGenerator); diff --git a/packages/plugin/src/generators/executor/executor.ts b/packages/plugin/src/generators/executor/executor.ts index e3705f412f8f4e..5c8ffda94120c9 100644 --- a/packages/plugin/src/generators/executor/executor.ts +++ b/packages/plugin/src/generators/executor/executor.ts @@ -1,7 +1,6 @@ import { readProjectConfiguration, names, - convertNxGenerator, generateFiles, updateJson, getWorkspaceLayout, @@ -197,4 +196,3 @@ export async function executorGenerator(host: Tree, schema: Schema) { } export default executorGenerator; -export const executorSchematic = convertNxGenerator(executorGenerator); diff --git a/packages/plugin/src/generators/generator/generator.ts b/packages/plugin/src/generators/generator/generator.ts index c228b2dca75082..e36a8e1106d7bb 100644 --- a/packages/plugin/src/generators/generator/generator.ts +++ b/packages/plugin/src/generators/generator/generator.ts @@ -4,7 +4,6 @@ import { joinPathFragments, Tree, writeJson, - convertNxGenerator, generateFiles, getWorkspaceLayout, names, @@ -187,4 +186,3 @@ export async function generatorGenerator(host: Tree, schema: Schema) { } export default generatorGenerator; -export const generatorSchematic = convertNxGenerator(generatorGenerator); diff --git a/packages/plugin/src/generators/migration/migration.ts b/packages/plugin/src/generators/migration/migration.ts index 29fac57de980ae..32a4383d49f7d1 100644 --- a/packages/plugin/src/generators/migration/migration.ts +++ b/packages/plugin/src/generators/migration/migration.ts @@ -1,7 +1,6 @@ import { readProjectConfiguration, names, - convertNxGenerator, generateFiles, updateProjectConfiguration, updateJson, @@ -16,6 +15,7 @@ import * as path from 'path'; import { addMigrationJsonChecks } from '../lint-checks/generator'; import { PackageJson, readNxMigrateConfig } from 'nx/src/utils/package-json'; import { nxVersion } from '../../utils/versions'; + interface NormalizedSchema extends Schema { projectRoot: string; projectSourceRoot: string; @@ -166,4 +166,3 @@ export async function migrationGenerator(host: Tree, schema: Schema) { } export default migrationGenerator; -export const migrationSchematic = convertNxGenerator(migrationGenerator); diff --git a/packages/plugin/src/generators/plugin/plugin.ts b/packages/plugin/src/generators/plugin/plugin.ts index 96f195e4450282..bab8142284d0b5 100644 --- a/packages/plugin/src/generators/plugin/plugin.ts +++ b/packages/plugin/src/generators/plugin/plugin.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, formatFiles, generateFiles, GeneratorCallback, @@ -151,4 +150,3 @@ export async function pluginGeneratorInternal(host: Tree, schema: Schema) { } export default pluginGenerator; -export const pluginSchematic = convertNxGenerator(pluginGenerator); diff --git a/packages/react-native/executors.json b/packages/react-native/executors.json index f8dd98f444a060..08be40c7d455f2 100644 --- a/packages/react-native/executors.json +++ b/packages/react-native/executors.json @@ -50,57 +50,5 @@ "schema": "./src/executors/pod-install/schema.json", "description": "Run `pod install` in the `ios` directory." } - }, - "builders": { - "run-android": { - "implementation": "./src/executors/run-android/compat", - "schema": "./src/executors/run-android/schema.json", - "description": "Runs Android application." - }, - "run-ios": { - "implementation": "./src/executors/run-ios/compat", - "schema": "./src/executors/run-ios/schema.json", - "description": "Runs iOS application." - }, - "bundle": { - "implementation": "./src/executors/bundle/compat", - "schema": "./src/executors/bundle/schema.json", - "description": "Builds the JavaScript bundle for offline use." - }, - "build-android": { - "implementation": "./src/executors/build-android/compat", - "schema": "./src/executors/build-android/schema.json", - "description": "Release Build for Android." - }, - "build-ios": { - "implementation": "./src/executors/build-ios/compat", - "schema": "./src/executors/build-ios/schema.json", - "description": "Build iOS app" - }, - "start": { - "implementation": "./src/executors/start/compat", - "schema": "./src/executors/start/schema.json", - "description": "Starts the Javascript server that communicates with connected devices." - }, - "sync-deps": { - "implementation": "./src/executors/sync-deps/compat", - "schema": "./src/executors/sync-deps/schema.json", - "description": "Syncs dependencies to `package.json` (required for autolinking)." - }, - "ensure-symlink": { - "implementation": "./src/executors/ensure-symlink/compat", - "schema": "./src/executors/ensure-symlink//schema.json", - "description": "Ensure workspace `node_modules` is symlink under app's `node_modules` folder." - }, - "storybook": { - "implementation": "./src/executors/storybook/compat", - "schema": "./src/executors/storybook/schema.json", - "description": "Serve React Native Storybook." - }, - "pod-install": { - "implementation": "./src/executors/pod-install/compat", - "schema": "./src/executors/pod-install/schema.json", - "description": "Run `pod install` in the `ios` directory." - } } } diff --git a/packages/react-native/generators.json b/packages/react-native/generators.json index aec2a322ff8e4c..975087282b8593 100644 --- a/packages/react-native/generators.json +++ b/packages/react-native/generators.json @@ -2,58 +2,6 @@ "name": "Nx React Native", "version": "0.1", "extends": ["@nx/workspace"], - "schematics": { - "init": { - "factory": "./src/generators/init/init#reactNativeInitSchematic", - "schema": "./src/generators/init/schema.json", - "description": "Initialize the `@nrwl/react-native` plugin.", - "hidden": true - }, - "application": { - "factory": "./src/generators/application/application#reactNativeApplicationSchematic", - "schema": "./src/generators/application/schema.json", - "aliases": ["app"], - "x-type": "application", - "description": "Create a React Native application." - }, - "library": { - "factory": "./src/generators/library/library#reactNativeLibrarySchematic", - "schema": "./src/generators/library/schema.json", - "aliases": ["lib"], - "x-type": "library", - "description": "Create a React Native library." - }, - "component": { - "factory": "./src/generators/component/component#reactNativeComponentSchematic", - "schema": "./src/generators/component/schema.json", - "description": "Create a React Native component.", - "aliases": ["c"] - }, - "storybook-configuration": { - "factory": "./src/generators/storybook-configuration/configuration#storybookConfigurationSchematic", - "schema": "./src/generators/storybook-configuration/schema.json", - "description": "Set up Storybook for a React-native application or library.", - "hidden": false - }, - "component-story": { - "factory": "./src/generators/component-story/component-story#componentStorySchematic", - "schema": "./src/generators/component-story/schema.json", - "description": "Generate Storybook story for a React-native component.", - "hidden": false - }, - "stories": { - "factory": "./src/generators/stories/stories#storiesSchematic", - "schema": "./src/generators/stories/schema.json", - "description": "Create stories for all components declared in an application or library.", - "hidden": false - }, - "upgrade-native": { - "factory": "./src/generators/upgrade-native/upgrade-native#reactNativeUpgradeNativeSchematic", - "schema": "./src/generators/upgrade-native/schema.json", - "description": "Destructive command to upgrade native iOS and Android code to latest.", - "hidden": false - } - }, "generators": { "init": { "factory": "./src/generators/init/init#reactNativeInitGenerator", diff --git a/packages/react-native/package.json b/packages/react-native/package.json index a50cab6ab76aba..a2053e828e42c1 100644 --- a/packages/react-native/package.json +++ b/packages/react-native/package.json @@ -47,12 +47,12 @@ "peerDependencies": { "react-native": ">= 0.72.0 < 0.73.0" }, - "builders": "./executors.json", + "executors": "./executors.json", "ng-update": { "requirements": {}, "migrations": "./migrations.json" }, - "schematics": "./generators.json", + "generators": "./generators.json", "publishConfig": { "access": "public" } diff --git a/packages/react-native/src/executors/build-android/compat.ts b/packages/react-native/src/executors/build-android/compat.ts deleted file mode 100644 index bc72a9a5a624c9..00000000000000 --- a/packages/react-native/src/executors/build-android/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import buildAndroidExecutor from './build-android.impl'; - -export default convertNxExecutor(buildAndroidExecutor); diff --git a/packages/react-native/src/executors/build-ios/compat.ts b/packages/react-native/src/executors/build-ios/compat.ts deleted file mode 100644 index 9e5d0e5510d7f7..00000000000000 --- a/packages/react-native/src/executors/build-ios/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import buildIosExecutor from './build-ios.impl'; - -export default convertNxExecutor(buildIosExecutor); diff --git a/packages/react-native/src/executors/bundle/compat.ts b/packages/react-native/src/executors/bundle/compat.ts deleted file mode 100644 index 18728208bdba7b..00000000000000 --- a/packages/react-native/src/executors/bundle/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import bundleExecutor from './bundle.impl'; - -export default convertNxExecutor(bundleExecutor); diff --git a/packages/react-native/src/executors/ensure-symlink/compat.ts b/packages/react-native/src/executors/ensure-symlink/compat.ts deleted file mode 100644 index 2b1fbac1599191..00000000000000 --- a/packages/react-native/src/executors/ensure-symlink/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import ensureSymlinkExecutor from './ensure-symlink.impl'; - -export default convertNxExecutor(ensureSymlinkExecutor); diff --git a/packages/react-native/src/executors/pod-install/compat.ts b/packages/react-native/src/executors/pod-install/compat.ts deleted file mode 100644 index d3b90a4005b332..00000000000000 --- a/packages/react-native/src/executors/pod-install/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import podInstall from './pod-install.impl'; - -export default convertNxExecutor(podInstall); diff --git a/packages/react-native/src/executors/run-android/compat.ts b/packages/react-native/src/executors/run-android/compat.ts deleted file mode 100644 index 3cc09a92e51a8f..00000000000000 --- a/packages/react-native/src/executors/run-android/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import runAndroidExecutor from './run-android.impl'; - -export default convertNxExecutor(runAndroidExecutor); diff --git a/packages/react-native/src/executors/run-ios/compat.ts b/packages/react-native/src/executors/run-ios/compat.ts deleted file mode 100644 index beedbf9d6067e5..00000000000000 --- a/packages/react-native/src/executors/run-ios/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import runIosExecutor from './run-ios.impl'; - -export default convertNxExecutor(runIosExecutor); diff --git a/packages/react-native/src/executors/start/compat.ts b/packages/react-native/src/executors/start/compat.ts deleted file mode 100644 index d0a895af818ad6..00000000000000 --- a/packages/react-native/src/executors/start/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import startExecutor from './start.impl'; - -export default convertNxExecutor(startExecutor); diff --git a/packages/react-native/src/executors/storybook/compat.ts b/packages/react-native/src/executors/storybook/compat.ts deleted file mode 100644 index 9ed1507ccc038d..00000000000000 --- a/packages/react-native/src/executors/storybook/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import storybookExecutor from './storybook.impl'; - -export default convertNxExecutor(storybookExecutor); diff --git a/packages/react-native/src/executors/sync-deps/compat.ts b/packages/react-native/src/executors/sync-deps/compat.ts deleted file mode 100644 index a0a363f75c0eea..00000000000000 --- a/packages/react-native/src/executors/sync-deps/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import syncDepsExecutor from './sync-deps.impl'; - -export default convertNxExecutor(syncDepsExecutor); diff --git a/packages/react-native/src/generators/application/application.ts b/packages/react-native/src/generators/application/application.ts index 089a1ea597f609..94df014947934b 100644 --- a/packages/react-native/src/generators/application/application.ts +++ b/packages/react-native/src/generators/application/application.ts @@ -1,5 +1,4 @@ import { - convertNxGenerator, formatFiles, GeneratorCallback, joinPathFragments, @@ -76,6 +75,3 @@ export async function reactNativeApplicationGeneratorInternal( } export default reactNativeApplicationGenerator; -export const reactNativeApplicationSchematic = convertNxGenerator( - reactNativeApplicationGenerator -); diff --git a/packages/react-native/src/generators/component-story/component-story.ts b/packages/react-native/src/generators/component-story/component-story.ts index 8f3354fab6f22d..93c0ac8312ec22 100644 --- a/packages/react-native/src/generators/component-story/component-story.ts +++ b/packages/react-native/src/generators/component-story/component-story.ts @@ -1,5 +1,4 @@ import { - convertNxGenerator, formatFiles, generateFiles, getProjects, @@ -150,6 +149,3 @@ export async function componentStoryGenerator( } export default componentStoryGenerator; -export const componentStorySchematic = convertNxGenerator( - componentStoryGenerator -); diff --git a/packages/react-native/src/generators/component/component.ts b/packages/react-native/src/generators/component/component.ts index 0ca810744f3461..8bdedbe89f5105 100644 --- a/packages/react-native/src/generators/component/component.ts +++ b/packages/react-native/src/generators/component/component.ts @@ -1,7 +1,6 @@ import { Schema } from './schema'; import { applyChangesToString, - convertNxGenerator, formatFiles, generateFiles, getProjects, @@ -55,6 +54,7 @@ function createComponentFiles(host: Tree, options: NormalizedSchema) { } let tsModule: typeof import('typescript'); + function addExportsToBarrel(host: Tree, options: NormalizedSchema) { if (!tsModule) { tsModule = ensureTypescript(); @@ -88,6 +88,3 @@ function addExportsToBarrel(host: Tree, options: NormalizedSchema) { } export default reactNativeComponentGenerator; -export const reactNativeComponentSchematic = convertNxGenerator( - reactNativeComponentGenerator -); diff --git a/packages/react-native/src/generators/init/init.ts b/packages/react-native/src/generators/init/init.ts index e26532da53cf4c..7dec268124b71a 100644 --- a/packages/react-native/src/generators/init/init.ts +++ b/packages/react-native/src/generators/init/init.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, detectPackageManager, formatFiles, GeneratorCallback, @@ -125,6 +124,3 @@ function moveDependency(host: Tree) { } export default reactNativeInitGenerator; -export const reactNativeInitSchematic = convertNxGenerator( - reactNativeInitGenerator -); diff --git a/packages/react-native/src/generators/library/library.ts b/packages/react-native/src/generators/library/library.ts index f0b7a09f941414..0f4287e5f271c4 100644 --- a/packages/react-native/src/generators/library/library.ts +++ b/packages/react-native/src/generators/library/library.ts @@ -1,6 +1,5 @@ import { addProjectConfiguration, - convertNxGenerator, ensurePackage, formatFiles, generateFiles, @@ -219,6 +218,3 @@ function maybeJs(options: NormalizedSchema, path: string): string { } export default reactNativeLibraryGenerator; -export const reactNativeLibrarySchematic = convertNxGenerator( - reactNativeLibraryGenerator -); diff --git a/packages/react-native/src/generators/stories/stories.ts b/packages/react-native/src/generators/stories/stories.ts index 8ddc53eca34734..06874ef57e31b1 100644 --- a/packages/react-native/src/generators/stories/stories.ts +++ b/packages/react-native/src/generators/stories/stories.ts @@ -1,5 +1,4 @@ import { - convertNxGenerator, ensurePackage, formatFiles, getProjects, @@ -82,4 +81,3 @@ export async function storiesGenerator( } export default storiesGenerator; -export const storiesSchematic = convertNxGenerator(storiesGenerator); diff --git a/packages/react-native/src/generators/storybook-configuration/configuration.ts b/packages/react-native/src/generators/storybook-configuration/configuration.ts index 3503690ab41627..f848dd0dad0106 100644 --- a/packages/react-native/src/generators/storybook-configuration/configuration.ts +++ b/packages/react-native/src/generators/storybook-configuration/configuration.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, ensurePackage, formatFiles, GeneratorCallback, @@ -87,6 +86,3 @@ function addStorybookTask(host: Tree, projectName: string) { } export default storybookConfigurationGenerator; -export const storybookConfigurationSchematic = convertNxGenerator( - storybookConfigurationGenerator -); diff --git a/packages/react-native/src/generators/upgrade-native/upgrade-native.ts b/packages/react-native/src/generators/upgrade-native/upgrade-native.ts index 4e5d5620d4e96a..f1c027a1f0bd31 100644 --- a/packages/react-native/src/generators/upgrade-native/upgrade-native.ts +++ b/packages/react-native/src/generators/upgrade-native/upgrade-native.ts @@ -4,7 +4,6 @@ */ import { - convertNxGenerator, GeneratorCallback, joinPathFragments, readProjectConfiguration, @@ -51,6 +50,3 @@ export async function reactNativeUpgradeNativeGenerator( } export default reactNativeUpgradeNativeGenerator; -export const reactNativeUpgradeNativeSchematic = convertNxGenerator( - reactNativeUpgradeNativeGenerator -); diff --git a/packages/react/executors.json b/packages/react/executors.json index 91a086fe2ce0c7..a82dd5af31f254 100644 --- a/packages/react/executors.json +++ b/packages/react/executors.json @@ -1,16 +1,4 @@ { - "builders": { - "module-federation-dev-server": { - "implementation": "./src/executors/module-federation-dev-server/compat", - "schema": "./src/executors/module-federation-dev-server/schema.json", - "description": "Serve a host or remote application." - }, - "module-federation-ssr-dev-server": { - "implementation": "./src/executors/module-federation-ssr-dev-server/compat", - "schema": "./src/executors/module-federation-ssr-dev-server/schema.json", - "description": "Serve a host application along with it's known remotes." - } - }, "executors": { "module-federation-dev-server": { "implementation": "./src/executors/module-federation-dev-server/module-federation-dev-server.impl", diff --git a/packages/react/generators.json b/packages/react/generators.json index c19b87080d1d45..a1db78e9c8ac5c 100644 --- a/packages/react/generators.json +++ b/packages/react/generators.json @@ -2,115 +2,6 @@ "name": "Nx React", "version": "0.1", "extends": ["@nx/workspace"], - "schematics": { - "init": { - "factory": "./src/generators/init/init#reactInitSchematic", - "schema": "./src/generators/init/schema.json", - "description": "Initialize the `@nrwl/react` plugin.", - "aliases": ["ng-add"], - "hidden": true - }, - - "application": { - "factory": "./src/generators/application/application#applicationSchematic", - "schema": "./src/generators/application/schema.json", - "aliases": ["app"], - "x-type": "application", - "description": "Create a React application." - }, - - "library": { - "factory": "./src/generators/library/library#librarySchematic", - "schema": "./src/generators/library/schema.json", - "aliases": ["lib"], - "x-type": "library", - "description": "Create a React library." - }, - - "component": { - "factory": "./src/generators/component/component#componentSchematic", - "schema": "./src/generators/component/schema.json", - "description": "Create a React component.", - "aliases": ["c"] - }, - - "redux": { - "factory": "./src/generators/redux/redux#reduxSchematic", - "schema": "./src/generators/redux/schema.json", - "description": "Create a Redux slice for a project.", - "aliases": ["slice"] - }, - - "storybook-configuration": { - "factory": "./src/generators/storybook-configuration/configuration#storybookConfigurationSchematic", - "schema": "./src/generators/storybook-configuration/schema.json", - "description": "Set up storybook for a React app or library.", - "hidden": false - }, - - "component-story": { - "factory": "./src/generators/component-story/component-story#componentStorySchematic", - "schema": "./src/generators/component-story/schema.json", - "description": "Generate storybook story for a React component.", - "hidden": false - }, - - "stories": { - "factory": "./src/generators/stories/stories#storiesSchematic", - "schema": "./src/generators/stories/schema.json", - "description": "Create stories/specs for all components declared in an app or library.", - "hidden": false - }, - - "component-cypress-spec": { - "factory": "./src/generators/component-cypress-spec/component-cypress-spec#componentCypressSchematic", - "schema": "./src/generators/component-cypress-spec/schema.json", - "description": "Create a Cypress spec for a UI component that has a story.", - "hidden": false - }, - - "hook": { - "factory": "./src/generators/hook/hook#hookSchematic", - "schema": "./src/generators/hook/schema.json", - "description": "Create a hook.", - "aliases": ["h"] - }, - - "cypress-component-configuration": { - "factory": "./src/generators/cypress-component-configuration/cypress-component-configuration#cypressComponentConfigGenerator", - "schema": "./src/generators/cypress-component-configuration/schema.json", - "description": "Setup Cypress component testing for a React project.", - "hidden": false - }, - - "component-test": { - "factory": "./src/generators/component-test/component-test#componentTestGenerator", - "schema": "./src/generators/component-test/schema.json", - "description": "Generate a Cypress component test for a React component.", - "hidden": false - }, - - "setup-tailwind": { - "factory": "./src/generators/setup-tailwind/setup-tailwind#setupTailwindSchematic", - "schema": "./src/generators/setup-tailwind/schema.json", - "description": "Set up Tailwind configuration for a project.", - "hidden": false - }, - - "setup-ssr": { - "factory": "./src/generators/setup-ssr/setup-ssr#setupSsrSchematic", - "schema": "./src/generators/setup-ssr/schema.json", - "description": "Set up SSR configuration for a project.", - "hidden": false - }, - - "federate-module": { - "factory": "./src/generators/federate-module/federate-module#federateModuleSchematic", - "schema": "./src/generators/federate-module/schema.json", - "description": "Federate a module.", - "hidden": false - } - }, "generators": { "init": { "factory": "./src/generators/init/init#reactInitGenerator", @@ -119,7 +10,6 @@ "aliases": ["ng-add"], "hidden": true }, - "application": { "factory": "./src/generators/application/application#applicationGeneratorInternal", "schema": "./src/generators/application/schema.json", @@ -127,7 +17,6 @@ "x-type": "application", "description": "Create a React application." }, - "library": { "factory": "./src/generators/library/library#libraryGeneratorInternal", "schema": "./src/generators/library/schema.json", @@ -135,98 +24,84 @@ "x-type": "library", "description": "Create a React library." }, - "component": { "factory": "./src/generators/component/component#componentGenerator", "schema": "./src/generators/component/schema.json", "description": "Create a React component.", "aliases": ["c"] }, - "redux": { "factory": "./src/generators/redux/redux#reduxGenerator", "schema": "./src/generators/redux/schema.json", "description": "Create a Redux slice for a project.", "aliases": ["slice"] }, - "storybook-configuration": { "factory": "./src/generators/storybook-configuration/configuration#storybookConfigurationGenerator", "schema": "./src/generators/storybook-configuration/schema.json", "description": "Set up storybook for a React app or library.", "hidden": false }, - "component-story": { "factory": "./src/generators/component-story/component-story#componentStoryGenerator", "schema": "./src/generators/component-story/schema.json", "description": "Generate storybook story for a React component", "hidden": false }, - "stories": { "factory": "./src/generators/stories/stories#storiesGenerator", "schema": "./src/generators/stories/schema.json", "description": "Create stories/specs for all components declared in an app or library.", "hidden": false }, - "component-cypress-spec": { "factory": "./src/generators/component-cypress-spec/component-cypress-spec#componentCypressGenerator", "schema": "./src/generators/component-cypress-spec/schema.json", "description": "Create a Cypress spec for a UI component that has a story.", "hidden": false }, - "hook": { "factory": "./src/generators/hook/hook#hookGenerator", "schema": "./src/generators/hook/schema.json", "description": "Create a hook.", "aliases": ["c"] }, - "host": { "factory": "./src/generators/host/host#hostGeneratorInternal", "schema": "./src/generators/host/schema.json", "x-type": "application", "description": "Generate a host react application" }, - "remote": { "factory": "./src/generators/remote/remote#remoteGeneratorInternal", "schema": "./src/generators/remote/schema.json", "x-type": "application", "description": "Generate a remote react application" }, - "cypress-component-configuration": { "factory": "./src/generators/cypress-component-configuration/cypress-component-configuration#cypressComponentConfigGenerator", "schema": "./src/generators/cypress-component-configuration/schema.json", "description": "Setup Cypress component testing for a React project", "hidden": false }, - "component-test": { "factory": "./src/generators/component-test/component-test#componentTestGenerator", "schema": "./src/generators/component-test/schema.json", "description": "Generate a Cypress component test for a React component", "hidden": false }, - "setup-tailwind": { "factory": "./src/generators/setup-tailwind/setup-tailwind#setupTailwindGenerator", "schema": "./src/generators/setup-tailwind/schema.json", "description": "Set up Tailwind configuration for a project.", "hidden": false }, - "setup-ssr": { "factory": "./src/generators/setup-ssr/setup-ssr#setupSsrGenerator", "schema": "./src/generators/setup-ssr/schema.json", "description": "Set up SSR configuration for a project.", "hidden": false }, - "federate-module": { "factory": "./src/generators/federate-module/federate-module#federateModuleGenerator", "schema": "./src/generators/federate-module/schema.json", diff --git a/packages/react/package.json b/packages/react/package.json index 2bc7c4d2e92251..21b6a5b45caa42 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -24,8 +24,8 @@ "url": "https://github.com/nrwl/nx/issues" }, "homepage": "https://nx.dev", - "builders": "./executors.json", - "schematics": "./generators.json", + "executors": "./executors.json", + "generators": "./generators.json", "ng-update": { "requirements": {}, "migrations": "./migrations.json" diff --git a/packages/react/src/executors/module-federation-dev-server/compat.ts b/packages/react/src/executors/module-federation-dev-server/compat.ts deleted file mode 100644 index ed735f06370ea1..00000000000000 --- a/packages/react/src/executors/module-federation-dev-server/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import devServer from './module-federation-dev-server.impl'; - -export default convertNxExecutor(devServer); diff --git a/packages/react/src/executors/module-federation-ssr-dev-server/compat.ts b/packages/react/src/executors/module-federation-ssr-dev-server/compat.ts deleted file mode 100644 index 2b8297f689c7b3..00000000000000 --- a/packages/react/src/executors/module-federation-ssr-dev-server/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import ssrDevServer from './module-federation-ssr-dev-server.impl'; - -export default convertNxExecutor(ssrDevServer); diff --git a/packages/react/src/generators/application/application.ts b/packages/react/src/generators/application/application.ts index de7aa3e5402bb9..4fc587c915780b 100644 --- a/packages/react/src/generators/application/application.ts +++ b/packages/react/src/generators/application/application.ts @@ -10,7 +10,6 @@ import { setDefaults } from './lib/set-defaults'; import { addStyledModuleDependencies } from '../../rules/add-styled-dependencies'; import { addDependenciesToPackageJson, - convertNxGenerator, ensurePackage, formatFiles, GeneratorCallback, @@ -305,4 +304,3 @@ export async function applicationGeneratorInternal( } export default applicationGenerator; -export const applicationSchematic = convertNxGenerator(applicationGenerator); diff --git a/packages/react/src/generators/component-cypress-spec/component-cypress-spec.ts b/packages/react/src/generators/component-cypress-spec/component-cypress-spec.ts index 5c5b9434e28af1..ffc9119fa6e15c 100644 --- a/packages/react/src/generators/component-cypress-spec/component-cypress-spec.ts +++ b/packages/react/src/generators/component-cypress-spec/component-cypress-spec.ts @@ -1,5 +1,4 @@ import { - convertNxGenerator, formatFiles, generateFiles, getProjects, @@ -177,6 +176,3 @@ function findPropsAndGenerateFileForCypress( } export default componentCypressGenerator; -export const componentCypressSchematic = convertNxGenerator( - componentCypressGenerator -); diff --git a/packages/react/src/generators/component-story/component-story.ts b/packages/react/src/generators/component-story/component-story.ts index 2507e1081120e7..29bc3ed0a07241 100644 --- a/packages/react/src/generators/component-story/component-story.ts +++ b/packages/react/src/generators/component-story/component-story.ts @@ -1,5 +1,4 @@ import { - convertNxGenerator, formatFiles, generateFiles, getProjects, @@ -148,6 +147,3 @@ export async function componentStoryGenerator( } export default componentStoryGenerator; -export const componentStorySchematic = convertNxGenerator( - componentStoryGenerator -); diff --git a/packages/react/src/generators/component/component.ts b/packages/react/src/generators/component/component.ts index e42161f951cff8..8c4e55ef99eb95 100644 --- a/packages/react/src/generators/component/component.ts +++ b/packages/react/src/generators/component/component.ts @@ -1,7 +1,6 @@ import { addDependenciesToPackageJson, applyChangesToString, - convertNxGenerator, formatFiles, generateFiles, GeneratorCallback, @@ -224,5 +223,3 @@ function assertValidOptions(options: Schema) { } export default componentGenerator; - -export const componentSchematic = convertNxGenerator(componentGenerator); diff --git a/packages/react/src/generators/federate-module/federate-module.ts b/packages/react/src/generators/federate-module/federate-module.ts index 9afb5672821c62..627a0047274bdf 100644 --- a/packages/react/src/generators/federate-module/federate-module.ts +++ b/packages/react/src/generators/federate-module/federate-module.ts @@ -1,7 +1,6 @@ import { GeneratorCallback, Tree, - convertNxGenerator, formatFiles, logger, readJson, @@ -73,7 +72,3 @@ export async function federateModuleGenerator(tree: Tree, schema: Schema) { } export default federateModuleGenerator; - -export const federateModuleSchematic = convertNxGenerator( - federateModuleGenerator -); diff --git a/packages/react/src/generators/hook/hook.ts b/packages/react/src/generators/hook/hook.ts index dff84d2fbe00c7..5ffad03848cf69 100644 --- a/packages/react/src/generators/hook/hook.ts +++ b/packages/react/src/generators/hook/hook.ts @@ -1,7 +1,6 @@ // TODO(jack): Remove inline renderHook function when RTL releases with its own version import { applyChangesToString, - convertNxGenerator, formatFiles, generateFiles, getProjects, @@ -62,6 +61,7 @@ function createFiles(host: Tree, options: NormalizedSchema) { } let tsModule: typeof import('typescript'); + function addExportsToBarrel(host: Tree, options: NormalizedSchema) { if (!tsModule) { tsModule = ensureTypescript(); @@ -178,5 +178,3 @@ function assertValidOptions(options: Schema) { } export default hookGenerator; - -export const hookSchematic = convertNxGenerator(hookGenerator); diff --git a/packages/react/src/generators/init/init.ts b/packages/react/src/generators/init/init.ts index 426dbb6ebf7213..0d749a532a24b0 100755 --- a/packages/react/src/generators/init/init.ts +++ b/packages/react/src/generators/init/init.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, ensurePackage, GeneratorCallback, readNxJson, @@ -94,5 +93,3 @@ export async function reactInitGenerator(host: Tree, schema: InitSchema) { } export default reactInitGenerator; - -export const reactInitSchematic = convertNxGenerator(reactInitGenerator); diff --git a/packages/react/src/generators/library/library.ts b/packages/react/src/generators/library/library.ts index 969cc4b8d0917c..4912bd9861266f 100644 --- a/packages/react/src/generators/library/library.ts +++ b/packages/react/src/generators/library/library.ts @@ -1,6 +1,5 @@ import { addProjectConfiguration, - convertNxGenerator, ensurePackage, formatFiles, GeneratorCallback, @@ -229,4 +228,3 @@ export async function libraryGeneratorInternal(host: Tree, schema: Schema) { } export default libraryGenerator; -export const librarySchematic = convertNxGenerator(libraryGenerator); diff --git a/packages/react/src/generators/redux/redux.ts b/packages/react/src/generators/redux/redux.ts index 0784b516291c35..9328bf384d053d 100644 --- a/packages/react/src/generators/redux/redux.ts +++ b/packages/react/src/generators/redux/redux.ts @@ -9,7 +9,6 @@ import { NormalizedSchema, Schema } from './schema'; import { addDependenciesToPackageJson, applyChangesToString, - convertNxGenerator, formatFiles, generateFiles, getProjects, @@ -204,4 +203,3 @@ function normalizeOptions(host: Tree, options: Schema): NormalizedSchema { } export default reduxGenerator; -export const reduxSchematic = convertNxGenerator(reduxGenerator); diff --git a/packages/react/src/generators/setup-ssr/setup-ssr.ts b/packages/react/src/generators/setup-ssr/setup-ssr.ts index 6f3975bccf3fbc..2fe028079b40a2 100644 --- a/packages/react/src/generators/setup-ssr/setup-ssr.ts +++ b/packages/react/src/generators/setup-ssr/setup-ssr.ts @@ -2,7 +2,6 @@ import type * as ts from 'typescript'; import { addDependenciesToPackageJson, applyChangesToString, - convertNxGenerator, formatFiles, generateFiles, joinPathFragments, @@ -241,5 +240,3 @@ export async function setupSsrGenerator(tree: Tree, options: Schema) { } export default setupSsrGenerator; - -export const setupSsrSchematic = convertNxGenerator(setupSsrGenerator); diff --git a/packages/react/src/generators/setup-tailwind/setup-tailwind.ts b/packages/react/src/generators/setup-tailwind/setup-tailwind.ts index d7ee99fa75c0af..cbb8e93b551ba6 100644 --- a/packages/react/src/generators/setup-tailwind/setup-tailwind.ts +++ b/packages/react/src/generators/setup-tailwind/setup-tailwind.ts @@ -1,7 +1,6 @@ import type { GeneratorCallback, Tree } from '@nx/devkit'; import { addDependenciesToPackageJson, - convertNxGenerator, formatFiles, generateFiles, joinPathFragments, @@ -67,7 +66,3 @@ export async function setupTailwindGenerator( } export default setupTailwindGenerator; - -export const setupTailwindSchematic = convertNxGenerator( - setupTailwindGenerator -); diff --git a/packages/react/src/generators/stories/stories.ts b/packages/react/src/generators/stories/stories.ts index 64b7a06a3f4ba9..ca31cfd18bae37 100644 --- a/packages/react/src/generators/stories/stories.ts +++ b/packages/react/src/generators/stories/stories.ts @@ -6,7 +6,6 @@ import { } from '../../utils/ast-utils'; import { addDependenciesToPackageJson, - convertNxGenerator, ensurePackage, formatFiles, GeneratorCallback, @@ -203,4 +202,3 @@ export async function storiesGenerator( } export default storiesGenerator; -export const storiesSchematic = convertNxGenerator(storiesGenerator); diff --git a/packages/react/src/generators/storybook-configuration/configuration.ts b/packages/react/src/generators/storybook-configuration/configuration.ts index 4d27122974a37d..6561dde48b4f79 100644 --- a/packages/react/src/generators/storybook-configuration/configuration.ts +++ b/packages/react/src/generators/storybook-configuration/configuration.ts @@ -1,7 +1,6 @@ import { StorybookConfigureSchema } from './schema'; import storiesGenerator from '../stories/stories'; import { - convertNxGenerator, ensurePackage, formatFiles, readProjectConfiguration, @@ -76,6 +75,3 @@ export async function storybookConfigurationGenerator( } export default storybookConfigurationGenerator; -export const storybookConfigurationSchematic = convertNxGenerator( - storybookConfigurationGenerator -); diff --git a/packages/rollup/executors.json b/packages/rollup/executors.json index c40811cf29363a..2e87d990bfe3d5 100644 --- a/packages/rollup/executors.json +++ b/packages/rollup/executors.json @@ -1,11 +1,4 @@ { - "builders": { - "rollup": { - "implementation": "./src/executors/rollup/compat", - "schema": "./src/executors/rollup/schema.json", - "description": "Bundle a package using Rollup." - } - }, "executors": { "rollup": { "implementation": "./src/executors/rollup/rollup.impl", diff --git a/packages/rollup/generators.json b/packages/rollup/generators.json index 28fe87e7adc5f1..9dc2fe8c7524ac 100644 --- a/packages/rollup/generators.json +++ b/packages/rollup/generators.json @@ -1,20 +1,6 @@ { "name": "Nx rollup", "version": "0.1", - "schematics": { - "init": { - "factory": "./src/generators/init/init#rollupInitSchematic", - "schema": "./src/generators/init/schema.json", - "description": "Initialize the `@nrwl/rollup` plugin.", - "hidden": true - }, - "configuration": { - "aliases": ["rollup-project"], - "factory": "./src/generators/configuration/configuration#compat", - "schema": "./src/generators/configuration/schema.json", - "description": "Add rollup configuration to a project." - } - }, "generators": { "init": { "factory": "./src/generators/init/init#rollupInitGenerator", diff --git a/packages/rollup/package.json b/packages/rollup/package.json index 24e1c2f18a3516..2c92b54193c7c8 100644 --- a/packages/rollup/package.json +++ b/packages/rollup/package.json @@ -22,8 +22,8 @@ "url": "https://github.com/nrwl/nx/issues" }, "homepage": "https://nx.dev", - "schematics": "./generators.json", - "builders": "./executors.json", + "generators": "./generators.json", + "executors": "./executors.json", "ng-update": { "requirements": {}, "migrations": "./migrations.json" diff --git a/packages/rollup/src/executors/rollup/compat.ts b/packages/rollup/src/executors/rollup/compat.ts deleted file mode 100644 index 4681ebee42de54..00000000000000 --- a/packages/rollup/src/executors/rollup/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import rollupExecutor from './rollup.impl'; - -export default convertNxExecutor(rollupExecutor); diff --git a/packages/rollup/src/generators/configuration/configuration.ts b/packages/rollup/src/generators/configuration/configuration.ts index 863d7896336beb..fa18877803bd9f 100644 --- a/packages/rollup/src/generators/configuration/configuration.ts +++ b/packages/rollup/src/generators/configuration/configuration.ts @@ -1,6 +1,5 @@ import type { Tree } from '@nx/devkit'; import { - convertNxGenerator, formatFiles, joinPathFragments, readProjectConfiguration, @@ -114,5 +113,3 @@ function addBuildTarget(tree: Tree, options: RollupProjectSchema) { } export default configurationGenerator; - -export const compat = convertNxGenerator(configurationGenerator); diff --git a/packages/rollup/src/generators/init/init.ts b/packages/rollup/src/generators/init/init.ts index 761bb50ee30bd3..698e5863e07ff5 100644 --- a/packages/rollup/src/generators/init/init.ts +++ b/packages/rollup/src/generators/init/init.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, formatFiles, GeneratorCallback, Tree, @@ -12,7 +11,6 @@ import { swcLoaderVersion, tsLibVersion, } from '../../utils/versions'; -import { addBabelInputs } from '@nx/js/src/utils/add-babel-inputs'; export async function rollupInitGenerator(tree: Tree, schema: Schema) { let task: GeneratorCallback; @@ -47,5 +45,3 @@ export async function rollupInitGenerator(tree: Tree, schema: Schema) { } export default rollupInitGenerator; - -export const rollupInitSchematic = convertNxGenerator(rollupInitGenerator); diff --git a/packages/storybook/executors.json b/packages/storybook/executors.json index 99af4021176117..b70a57e3998655 100644 --- a/packages/storybook/executors.json +++ b/packages/storybook/executors.json @@ -1,16 +1,4 @@ { - "builders": { - "storybook": { - "implementation": "./src/executors/storybook/compat", - "schema": "./src/executors/storybook/schema.json", - "description": "Serve Storybook." - }, - "build": { - "implementation": "./src/executors/build-storybook/compat", - "schema": "./src/executors/build-storybook/schema.json", - "description": "Build Storybook." - } - }, "executors": { "storybook": { "implementation": "./src/executors/storybook/storybook.impl", diff --git a/packages/storybook/generators.json b/packages/storybook/generators.json index 20161857ed11b6..1eb483e4bd1882 100644 --- a/packages/storybook/generators.json +++ b/packages/storybook/generators.json @@ -1,33 +1,6 @@ { "name": "Nx Storybook", "version": "0.1", - "schematics": { - "init": { - "factory": "./src/generators/init/init#initSchematic", - "schema": "./src/generators/init/schema.json", - "description": "Add Storybook configuration to the workspace.", - "aliases": ["ng-add"], - "hidden": true - }, - "configuration": { - "factory": "./src/generators/configuration/configuration#configurationSchematic", - "schema": "./src/generators/configuration/schema.json", - "description": "Add Storybook configuration to a UI library or an application.", - "hidden": false - }, - "cypress-project": { - "factory": "./src/generators/cypress-project/cypress-project#cypressProjectSchematic", - "schema": "./src/generators/cypress-project/schema.json", - "description": "Add cypress e2e app to test a UI library that is set up for Storybook.", - "hidden": false - }, - "migrate-7": { - "factory": "./src/generators/migrate-7/migrate-7#migrate7Schematic", - "schema": "./src/generators/migrate-7/schema.json", - "description": "Migrate to Storybook version 7.", - "hidden": false - } - }, "generators": { "init": { "factory": "./src/generators/init/init", diff --git a/packages/storybook/package.json b/packages/storybook/package.json index bcf6a7f76af9ce..6893fdfa4c1af0 100644 --- a/packages/storybook/package.json +++ b/packages/storybook/package.json @@ -23,8 +23,8 @@ "url": "https://github.com/nrwl/nx/issues" }, "homepage": "https://nx.dev", - "schematics": "./generators.json", - "builders": "./executors.json", + "generators": "./generators.json", + "executors": "./executors.json", "ng-update": { "requirements": {}, "migrations": "./migrations.json" diff --git a/packages/storybook/src/executors/build-storybook/compat.ts b/packages/storybook/src/executors/build-storybook/compat.ts deleted file mode 100644 index 3edcd4e5839746..00000000000000 --- a/packages/storybook/src/executors/build-storybook/compat.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; -import buildStorybookExecutor from './build-storybook.impl'; - -export default convertNxExecutor(buildStorybookExecutor); diff --git a/packages/storybook/src/executors/storybook/compat.ts b/packages/storybook/src/executors/storybook/compat.ts deleted file mode 100644 index 0297cd761897b0..00000000000000 --- a/packages/storybook/src/executors/storybook/compat.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; -import storybookExecutor from './storybook.impl'; - -export default convertNxExecutor(storybookExecutor); diff --git a/packages/storybook/src/generators/configuration/configuration.ts b/packages/storybook/src/generators/configuration/configuration.ts index 9d926ea9318095..606c1e297bb85a 100644 --- a/packages/storybook/src/generators/configuration/configuration.ts +++ b/packages/storybook/src/generators/configuration/configuration.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, formatFiles, GeneratorCallback, logger, @@ -229,6 +228,3 @@ function normalizeSchema( } export default configurationGenerator; -export const configurationSchematic = convertNxGenerator( - configurationGenerator -); diff --git a/packages/storybook/src/generators/cypress-project/cypress-project.ts b/packages/storybook/src/generators/cypress-project/cypress-project.ts index 40b2bacc57d9eb..f43b85f802b604 100644 --- a/packages/storybook/src/generators/cypress-project/cypress-project.ts +++ b/packages/storybook/src/generators/cypress-project/cypress-project.ts @@ -7,11 +7,9 @@ import { getUnscopedLibName, } from '@nx/cypress/src/utils/project-name'; import { - convertNxGenerator, formatFiles, generateFiles, GeneratorCallback, - joinPathFragments, readJson, readProjectConfiguration, runTasksInSerial, @@ -154,6 +152,3 @@ function projectAlreadyHasCypress(tree: Tree): boolean { } export default cypressProjectGenerator; -export const cypressProjectSchematic = convertNxGenerator( - cypressProjectGenerator -); diff --git a/packages/storybook/src/generators/init/init.ts b/packages/storybook/src/generators/init/init.ts index 287612c2731bc1..6d70d36deb999e 100644 --- a/packages/storybook/src/generators/init/init.ts +++ b/packages/storybook/src/generators/init/init.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, detectPackageManager, GeneratorCallback, readJson, @@ -209,4 +208,3 @@ export async function initGenerator(tree: Tree, schema: Schema) { } export default initGenerator; -export const initSchematic = convertNxGenerator(initGenerator); diff --git a/packages/storybook/src/generators/migrate-7/migrate-7.ts b/packages/storybook/src/generators/migrate-7/migrate-7.ts index 1daeee2eed3e17..553a1e6878af2d 100644 --- a/packages/storybook/src/generators/migrate-7/migrate-7.ts +++ b/packages/storybook/src/generators/migrate-7/migrate-7.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, formatFiles, GeneratorCallback, readJson, @@ -107,4 +106,3 @@ export async function migrate7Generator(tree: Tree, schema: Schema) { } export default migrate7Generator; -export const migrate7Schematic = convertNxGenerator(migrate7Generator); diff --git a/packages/vite/generators.json b/packages/vite/generators.json index e268573ad59677..ecc8f42a0c51b6 100644 --- a/packages/vite/generators.json +++ b/packages/vite/generators.json @@ -1,27 +1,6 @@ { "name": "Nx Vite", "version": "0.1", - "schematics": { - "init": { - "factory": "./src/generators/init/init#initSchematic", - "schema": "./src/generators/init/schema.json", - "description": "Initialize Vite in the workspace.", - "aliases": ["ng-add"], - "hidden": true - }, - "configuration": { - "factory": "./src/generators/configuration/configuration#configurationSchematic", - "schema": "./src/generators/configuration/schema.json", - "description": "Configure a project to use Vite.js.", - "aliases": ["config"], - "hidden": false - }, - "vitest": { - "factory": "./src/generators/vitest/vitest-generator#vitestSchematic", - "schema": "./src/generators/vitest/schema.json", - "description": "Generate a vitest configuration" - } - }, "generators": { "init": { "factory": "./src/generators/init/init", diff --git a/packages/vite/package.json b/packages/vite/package.json index ed9f35ffc88740..0af4bccffc27ea 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -22,8 +22,8 @@ "url": "https://github.com/nrwl/nx/issues" }, "homepage": "https://nx.dev", - "schematics": "./generators.json", - "builders": "./executors.json", + "generators": "./generators.json", + "executors": "./executors.json", "ng-update": { "requirements": {}, "migrations": "./migrations.json" diff --git a/packages/vite/src/generators/configuration/configuration.ts b/packages/vite/src/generators/configuration/configuration.ts index f433f5f9dfa751..6d13ed00b099a0 100644 --- a/packages/vite/src/generators/configuration/configuration.ts +++ b/packages/vite/src/generators/configuration/configuration.ts @@ -1,5 +1,4 @@ import { - convertNxGenerator, formatFiles, GeneratorCallback, joinPathFragments, @@ -246,6 +245,3 @@ export async function viteConfigurationGenerator( } export default viteConfigurationGenerator; -export const configurationSchematic = convertNxGenerator( - viteConfigurationGenerator -); diff --git a/packages/vite/src/generators/init/init.ts b/packages/vite/src/generators/init/init.ts index 9a52754d89163e..38af46007a1b5a 100644 --- a/packages/vite/src/generators/init/init.ts +++ b/packages/vite/src/generators/init/init.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, logger, readJson, readNxJson, @@ -120,4 +119,3 @@ export async function initGenerator(tree: Tree, schema: InitGeneratorSchema) { } export default initGenerator; -export const initSchematic = convertNxGenerator(initGenerator); diff --git a/packages/vite/src/generators/vitest/vitest-generator.ts b/packages/vite/src/generators/vitest/vitest-generator.ts index 9cfab4d019defc..95921b4a577d9f 100644 --- a/packages/vite/src/generators/vitest/vitest-generator.ts +++ b/packages/vite/src/generators/vitest/vitest-generator.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, formatFiles, generateFiles, GeneratorCallback, @@ -220,4 +219,3 @@ function getCoverageProviderDependency( } export default vitestGenerator; -export const vitestSchematic = convertNxGenerator(vitestGenerator); diff --git a/packages/vue/src/generators/stories/stories.ts b/packages/vue/src/generators/stories/stories.ts index 89e66a10fcf948..c9bb3149c86093 100644 --- a/packages/vue/src/generators/stories/stories.ts +++ b/packages/vue/src/generators/stories/stories.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, ensurePackage, formatFiles, GeneratorCallback, @@ -109,4 +108,3 @@ export async function storiesGenerator( } export default storiesGenerator; -export const storiesSchematic = convertNxGenerator(storiesGenerator); diff --git a/packages/vue/src/generators/storybook-configuration/configuration.ts b/packages/vue/src/generators/storybook-configuration/configuration.ts index 6a1d806ed5ee96..4cfc3ba8588565 100644 --- a/packages/vue/src/generators/storybook-configuration/configuration.ts +++ b/packages/vue/src/generators/storybook-configuration/configuration.ts @@ -1,11 +1,6 @@ import { StorybookConfigureSchema } from './schema'; import storiesGenerator from '../stories/stories'; -import { - convertNxGenerator, - ensurePackage, - formatFiles, - Tree, -} from '@nx/devkit'; +import { ensurePackage, formatFiles, Tree } from '@nx/devkit'; import { nxVersion } from '../../utils/versions'; async function generateStories(host: Tree, schema: StorybookConfigureSchema) { @@ -47,6 +42,3 @@ export async function storybookConfigurationGenerator( } export default storybookConfigurationGenerator; -export const storybookConfigurationSchematic = convertNxGenerator( - storybookConfigurationGenerator -); diff --git a/packages/web/generators.json b/packages/web/generators.json index d647f86dec2d3a..10156d1e1a6753 100644 --- a/packages/web/generators.json +++ b/packages/web/generators.json @@ -21,25 +21,5 @@ "schema": "./src/generators/static-serve/schema.json", "description": "Add a new static-serve target to a project." } - }, - "schematics": { - "init": { - "factory": "./src/generators/init/init#webInitSchematic", - "schema": "./src/generators/init/schema.json", - "description": "Add `@nrwl/web` to a project.", - "hidden": true - }, - "application": { - "factory": "./src/generators/application/application#applicationSchematic", - "schema": "./src/generators/application/schema.json", - "aliases": ["app"], - "x-type": "application", - "description": "Create an web application." - }, - "static-config": { - "factory": "./src/generators/static-serve/static-serve-configuration#compat", - "schema": "./src/generators/static-serve/schema.json", - "description": "Add a new static-serve target to a project." - } } } diff --git a/packages/web/package.json b/packages/web/package.json index 301b47700eac1d..bf5dca7662dd0d 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -23,8 +23,8 @@ "url": "https://github.com/nrwl/nx/issues" }, "homepage": "https://nx.dev", - "schematics": "./generators.json", - "builders": "./executors.json", + "generators": "./generators.json", + "executors": "./executors.json", "ng-update": { "requirements": {}, "migrations": "./migrations.json" diff --git a/packages/web/src/executors/file-server/compat.ts b/packages/web/src/executors/file-server/compat.ts index d1efb972769d10..be847322ae28f6 100644 --- a/packages/web/src/executors/file-server/compat.ts +++ b/packages/web/src/executors/file-server/compat.ts @@ -1,5 +1,4 @@ import { convertNxExecutor } from '@nx/devkit'; +import fileServer from './file-server.impl'; -import fileServerExecutor from './file-server.impl'; - -export default convertNxExecutor(fileServerExecutor); +export default convertNxExecutor(fileServer); diff --git a/packages/web/src/generators/application/application.ts b/packages/web/src/generators/application/application.ts index 994069655d7e89..16021d5b73f13b 100644 --- a/packages/web/src/generators/application/application.ts +++ b/packages/web/src/generators/application/application.ts @@ -1,7 +1,6 @@ import { addDependenciesToPackageJson, addProjectConfiguration, - convertNxGenerator, ensurePackage, formatFiles, generateFiles, @@ -398,4 +397,3 @@ async function normalizeOptions( } export default applicationGenerator; -export const applicationSchematic = convertNxGenerator(applicationGenerator); diff --git a/packages/web/src/generators/init/init.ts b/packages/web/src/generators/init/init.ts index c980dd592e7e44..60b00a322814d4 100644 --- a/packages/web/src/generators/init/init.ts +++ b/packages/web/src/generators/init/init.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, ensurePackage, formatFiles, GeneratorCallback, @@ -80,4 +79,3 @@ export async function webInitGenerator(tree: Tree, schema: Schema) { } export default webInitGenerator; -export const webInitSchematic = convertNxGenerator(webInitGenerator); diff --git a/packages/web/src/generators/static-serve/static-serve-configuration.ts b/packages/web/src/generators/static-serve/static-serve-configuration.ts index 33fa76d2645fad..4d2e89efb479da 100644 --- a/packages/web/src/generators/static-serve/static-serve-configuration.ts +++ b/packages/web/src/generators/static-serve/static-serve-configuration.ts @@ -1,5 +1,4 @@ import { - convertNxGenerator, logger, parseTargetString, readProjectConfiguration, @@ -9,6 +8,7 @@ import { updateProjectConfiguration, } from '@nx/devkit'; import { Schema as FileServerExecutorSchema } from '../../executors/file-server/schema.d'; + interface WebStaticServeSchema { buildTarget: string; outputPath?: string; @@ -108,5 +108,4 @@ function addStaticConfig(tree: Tree, opts: NormalizedWebStaticServeSchema) { updateProjectConfiguration(tree, opts.projectName, projectConfig); } -export const compat = convertNxGenerator(webStaticServeGenerator); export default webStaticServeGenerator; diff --git a/packages/webpack/executors.json b/packages/webpack/executors.json index 41fc3cf3003e8b..9d4a1d6135ea4c 100644 --- a/packages/webpack/executors.json +++ b/packages/webpack/executors.json @@ -1,21 +1,4 @@ { - "builders": { - "webpack": { - "implementation": "./src/executors/webpack/compat", - "schema": "./src/executors/webpack/schema.json", - "description": "Run webpack build." - }, - "dev-server": { - "implementation": "./src/executors/dev-server/compat", - "schema": "./src/executors/dev-server/schema.json", - "description": "Serve a web application." - }, - "ssr-dev-server": { - "implementation": "./src/executors/ssr-dev-server/compat", - "schema": "./src/executors/ssr-dev-server/schema.json", - "description": "Serve a SSR application." - } - }, "executors": { "webpack": { "implementation": "./src/executors/webpack/webpack.impl", diff --git a/packages/webpack/generators.json b/packages/webpack/generators.json index 9179cd979a2ea6..4490102f61b6f6 100644 --- a/packages/webpack/generators.json +++ b/packages/webpack/generators.json @@ -1,21 +1,6 @@ { "name": "Nx Webpack", "version": "0.1", - "schematics": { - "init": { - "factory": "./src/generators/init/init#webpackInitSchematic", - "schema": "./src/generators/init/schema.json", - "description": "Initialize the `@nrwl/webpack` plugin.", - "hidden": true - }, - "configuration": { - "aliases": ["webpack-project"], - "factory": "./src/generators/configuration/configuration#compat", - "schema": "./src/generators/configuration/schema.json", - "description": "Add webpack configuration to a project.", - "hidden": true - } - }, "generators": { "init": { "factory": "./src/generators/init/init#webpackInitGenerator", diff --git a/packages/webpack/package.json b/packages/webpack/package.json index 9a11fd70aba98e..aa3d8c56f9d14e 100644 --- a/packages/webpack/package.json +++ b/packages/webpack/package.json @@ -22,8 +22,8 @@ "url": "https://github.com/nrwl/nx/issues" }, "homepage": "https://nx.dev", - "schematics": "./generators.json", - "builders": "./executors.json", + "generators": "./generators.json", + "executors": "./executors.json", "ng-update": { "requirements": {}, "migrations": "./migrations.json" diff --git a/packages/webpack/src/executors/dev-server/compat.ts b/packages/webpack/src/executors/dev-server/compat.ts deleted file mode 100644 index 34b277b04ec4ad..00000000000000 --- a/packages/webpack/src/executors/dev-server/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import devServerExecutor from './dev-server.impl'; - -export default convertNxExecutor(devServerExecutor); diff --git a/packages/webpack/src/executors/ssr-dev-server/compat.ts b/packages/webpack/src/executors/ssr-dev-server/compat.ts deleted file mode 100644 index 1ce89e1e8899bd..00000000000000 --- a/packages/webpack/src/executors/ssr-dev-server/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import ssrDevServerExecutor from './ssr-dev-server.impl'; - -export default convertNxExecutor(ssrDevServerExecutor); diff --git a/packages/webpack/src/executors/webpack/compat.ts b/packages/webpack/src/executors/webpack/compat.ts deleted file mode 100644 index e04afb8239a55f..00000000000000 --- a/packages/webpack/src/executors/webpack/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nx/devkit'; - -import { webpackExecutor } from './webpack.impl'; - -export default convertNxExecutor(webpackExecutor); diff --git a/packages/webpack/src/generators/configuration/configuration.ts b/packages/webpack/src/generators/configuration/configuration.ts index 8778f1504a491a..4d2a953f955786 100644 --- a/packages/webpack/src/generators/configuration/configuration.ts +++ b/packages/webpack/src/generators/configuration/configuration.ts @@ -1,6 +1,5 @@ import type { Tree } from '@nx/devkit'; import { - convertNxGenerator, formatFiles, joinPathFragments, readProjectConfiguration, @@ -154,5 +153,3 @@ function addServeTarget(tree: Tree, options: ConfigurationGeneratorSchema) { } export default configurationGenerator; - -export const compat = convertNxGenerator(configurationGenerator); diff --git a/packages/webpack/src/generators/init/init.ts b/packages/webpack/src/generators/init/init.ts index 81ab64d5b8bfab..ea94976c026b68 100644 --- a/packages/webpack/src/generators/init/init.ts +++ b/packages/webpack/src/generators/init/init.ts @@ -1,6 +1,5 @@ import { addDependenciesToPackageJson, - convertNxGenerator, formatFiles, GeneratorCallback, runTasksInSerial, @@ -59,5 +58,3 @@ export async function webpackInitGenerator(tree: Tree, schema: Schema) { } export default webpackInitGenerator; - -export const webpackInitSchematic = convertNxGenerator(webpackInitGenerator); diff --git a/packages/workspace/generators.json b/packages/workspace/generators.json index ee73b5fcd72ad3..aadabfccde8722 100644 --- a/packages/workspace/generators.json +++ b/packages/workspace/generators.json @@ -1,37 +1,6 @@ { "name": "nx/workspace", "version": "0.1", - "schematics": { - "move": { - "factory": "./src/generators/move/move#moveSchematic", - "schema": "./src/generators/move/schema.json", - "aliases": ["mv"], - "description": "Move an application or library to another folder." - }, - "remove": { - "factory": "./src/generators/remove/remove#removeSchematic", - "schema": "./src/generators/remove/schema.json", - "aliases": ["rm"], - "description": "Remove an application or library." - }, - "convert-to-monorepo": { - "factory": "./src/generators/convert-to-monorepo/convert-to-monorepo#monorepoSchematic", - "schema": "./src/generators/convert-to-monorepo/schema.json", - "description": "Convert a Nx project to a monorepo." - }, - "run-commands": { - "factory": "./src/generators/run-commands/run-commands#runCommandsSchematic", - "schema": "./src/generators/run-commands/schema.json", - "aliases": ["run-command", "target"], - "description": "Generates a target to run any command in the terminal." - }, - "npm-package": { - "factory": "./src/generators/npm-package/npm-package#npmPackageSchematic", - "schema": "./src/generators/npm-package/schema.json", - "description": "Create a minimal NPM package.", - "x-type": "library" - } - }, "generators": { "preset": { "factory": "./src/generators/preset/preset#presetGenerator", diff --git a/packages/workspace/index.ts b/packages/workspace/index.ts index dd278a00fd4ebf..3741c8c50e21b1 100644 --- a/packages/workspace/index.ts +++ b/packages/workspace/index.ts @@ -43,9 +43,6 @@ export { checkAndCleanWithSemver } from './src/utils/version-utils'; export { moveGenerator } from './src/generators/move/move'; export { removeGenerator } from './src/generators/remove/remove'; export { runCommandsGenerator } from './src/generators/run-commands/run-commands'; -export { - convertToNxProjectGenerator, - convertToNxProjectSchematic, -} from './src/generators/convert-to-nx-project/convert-to-nx-project'; +export { convertToNxProjectGenerator } from './src/generators/convert-to-nx-project/convert-to-nx-project'; export const stringUtils = strings; diff --git a/packages/workspace/package.json b/packages/workspace/package.json index 5ccbe64da8992d..18f0efa20a903c 100644 --- a/packages/workspace/package.json +++ b/packages/workspace/package.json @@ -27,8 +27,8 @@ "url": "https://github.com/nrwl/nx/issues" }, "homepage": "https://nx.dev", - "schematics": "./generators.json", - "builders": "./executors.json", + "generators": "./generators.json", + "executors": "./executors.json", "ng-update": { "requirements": {}, "migrations": "./migrations.json", diff --git a/packages/workspace/src/generators/ci-workflow/ci-workflow.ts b/packages/workspace/src/generators/ci-workflow/ci-workflow.ts index dda72391d606c5..a2a9e59f500728 100644 --- a/packages/workspace/src/generators/ci-workflow/ci-workflow.ts +++ b/packages/workspace/src/generators/ci-workflow/ci-workflow.ts @@ -2,7 +2,6 @@ import { Tree, names, generateFiles, - joinPathFragments, getPackageManagerCommand, readJson, NxJsonConfiguration, diff --git a/packages/workspace/src/generators/convert-to-monorepo/convert-to-monorepo.ts b/packages/workspace/src/generators/convert-to-monorepo/convert-to-monorepo.ts index f3dead4470a3c5..fdea588dd0d481 100644 --- a/packages/workspace/src/generators/convert-to-monorepo/convert-to-monorepo.ts +++ b/packages/workspace/src/generators/convert-to-monorepo/convert-to-monorepo.ts @@ -1,5 +1,4 @@ import { - convertNxGenerator, getProjects, joinPathFragments, ProjectConfiguration, @@ -52,5 +51,3 @@ export async function monorepoGenerator(tree: Tree, options: {}) { } export default monorepoGenerator; - -export const monorepoSchematic = convertNxGenerator(monorepoGenerator); diff --git a/packages/workspace/src/generators/convert-to-nx-project/convert-to-nx-project.ts b/packages/workspace/src/generators/convert-to-nx-project/convert-to-nx-project.ts index effc2ecb8aab03..9b8c66373531f2 100644 --- a/packages/workspace/src/generators/convert-to-nx-project/convert-to-nx-project.ts +++ b/packages/workspace/src/generators/convert-to-nx-project/convert-to-nx-project.ts @@ -1,6 +1,5 @@ import { addProjectConfiguration, - convertNxGenerator, formatFiles, readJson, Tree, @@ -101,7 +100,3 @@ export async function convertToNxProjectGenerator(host: Tree, schema: Schema) { } export default convertToNxProjectGenerator; - -export const convertToNxProjectSchematic = convertNxGenerator( - convertToNxProjectGenerator -); diff --git a/packages/workspace/src/generators/move/move.ts b/packages/workspace/src/generators/move/move.ts index 07ff3bd763aa3e..15f1037038eec4 100644 --- a/packages/workspace/src/generators/move/move.ts +++ b/packages/workspace/src/generators/move/move.ts @@ -1,5 +1,4 @@ import { - convertNxGenerator, formatFiles, readProjectConfiguration, removeProjectConfiguration, @@ -71,5 +70,3 @@ export async function moveGeneratorInternal(tree: Tree, rawSchema: Schema) { } export default moveGenerator; - -export const moveSchematic = convertNxGenerator(moveGenerator); diff --git a/packages/workspace/src/generators/npm-package/npm-package.ts b/packages/workspace/src/generators/npm-package/npm-package.ts index 8c192f9ef1b794..de54925a267005 100644 --- a/packages/workspace/src/generators/npm-package/npm-package.ts +++ b/packages/workspace/src/generators/npm-package/npm-package.ts @@ -1,6 +1,5 @@ import { addProjectConfiguration, - convertNxGenerator, formatFiles, generateFiles, Tree, @@ -18,6 +17,7 @@ export interface ProjectOptions { directory?: string; projectNameAndRootFormat?: ProjectNameAndRootFormat; } + interface NormalizedProjectOptions extends ProjectOptions { projectRoot: string; } @@ -86,5 +86,3 @@ export async function npmPackageGeneratorInternal( await formatFiles(tree); } - -export const npmPackageSchematic = convertNxGenerator(npmPackageGenerator); diff --git a/packages/workspace/src/generators/remove/remove.ts b/packages/workspace/src/generators/remove/remove.ts index c86575b38c2a3b..6fe42b651aeca0 100644 --- a/packages/workspace/src/generators/remove/remove.ts +++ b/packages/workspace/src/generators/remove/remove.ts @@ -1,9 +1,4 @@ -import { - convertNxGenerator, - formatFiles, - readProjectConfiguration, - Tree, -} from '@nx/devkit'; +import { formatFiles, readProjectConfiguration, Tree } from '@nx/devkit'; import { checkProjectIsSafeToRemove } from './lib/check-project-is-safe-to-remove'; import { checkDependencies } from './lib/check-dependencies'; @@ -29,5 +24,3 @@ export async function removeGenerator(tree: Tree, schema: Schema) { } export default removeGenerator; - -export const removeSchematic = convertNxGenerator(removeGenerator); diff --git a/packages/workspace/src/generators/run-commands/run-commands.ts b/packages/workspace/src/generators/run-commands/run-commands.ts index a121aa448486f2..e4f8825ff11064 100644 --- a/packages/workspace/src/generators/run-commands/run-commands.ts +++ b/packages/workspace/src/generators/run-commands/run-commands.ts @@ -1,6 +1,5 @@ import { Schema } from './schema'; import { - convertNxGenerator, formatFiles, joinPathFragments, readProjectConfiguration, @@ -30,5 +29,3 @@ export async function runCommandsGenerator(host: Tree, schema: Schema) { } export default runCommandsGenerator; - -export const runCommandsSchematic = convertNxGenerator(runCommandsGenerator); From 09ff419040e350ba58c821dcd5c6398196e9db8c Mon Sep 17 00:00:00 2001 From: Craigory Coppola Date: Fri, 13 Oct 2023 13:08:44 -0400 Subject: [PATCH 4/9] feat(core): remove deprecated workspace-lint (#16212) --- docs/generated/cli/workspace-lint.md | 18 ------------------ docs/generated/manifests/menus.json | 8 -------- docs/generated/manifests/nx-api.json | 11 ----------- docs/generated/manifests/tags.json | 7 ------- docs/generated/packages-metadata.json | 11 ----------- .../packages/nx/documents/workspace-lint.md | 18 ------------------ docs/map.json | 6 ------ docs/shared/mental-model/large-tasks.json | 8 -------- docs/shared/monorepo-ci-azure.md | 1 - docs/shared/reference/nxignore.md | 1 - docs/shared/reference/sitemap.md | 1 - .../src/additional-api-references.spec.ts | 1 - nx-dev/nx-dev/redirect-rules.js | 2 -- packages/nx/src/command-line/nx-commands.ts | 2 -- .../workspace-lint/command-object.ts | 15 --------------- .../workspace-lint/workspace-lint.ts | 11 ----------- 16 files changed, 121 deletions(-) delete mode 100644 docs/generated/cli/workspace-lint.md delete mode 100644 docs/generated/packages/nx/documents/workspace-lint.md delete mode 100644 packages/nx/src/command-line/workspace-lint/command-object.ts delete mode 100644 packages/nx/src/command-line/workspace-lint/workspace-lint.ts diff --git a/docs/generated/cli/workspace-lint.md b/docs/generated/cli/workspace-lint.md deleted file mode 100644 index a77e61ffa2cba1..00000000000000 --- a/docs/generated/cli/workspace-lint.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: 'workspace-lint - CLI command' -description: 'Lint nx specific workspace files (nx.json, workspace.json)' ---- - -# workspace-lint - -**Deprecated:** workspace-lint is deprecated, and will be removed in v17. The checks it used to perform are no longer relevant. See: https://nx.dev/deprecated/workspace-lint - -Lint nx specific workspace files (nx.json, workspace.json) - -## Usage - -```shell -nx workspace-lint [files..] -``` - -Install `nx` globally to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpm nx`. diff --git a/docs/generated/manifests/menus.json b/docs/generated/manifests/menus.json index aaf729c1158e84..5f632c9908c782 100644 --- a/docs/generated/manifests/menus.json +++ b/docs/generated/manifests/menus.json @@ -7550,14 +7550,6 @@ "children": [], "disableCollapsible": false }, - { - "name": "workspace-lint", - "path": "/nx-api/nx/documents/workspace-lint", - "id": "workspace-lint", - "isExternal": false, - "children": [], - "disableCollapsible": false - }, { "name": "connect-to-nx-cloud", "path": "/nx-api/nx/documents/connect-to-nx-cloud", diff --git a/docs/generated/manifests/nx-api.json b/docs/generated/manifests/nx-api.json index f3d78a32c72d1f..134288a6af0a2f 100644 --- a/docs/generated/manifests/nx-api.json +++ b/docs/generated/manifests/nx-api.json @@ -1675,17 +1675,6 @@ "tags": [], "originalFilePath": "generated/cli/list" }, - "/nx-api/nx/documents/workspace-lint": { - "id": "workspace-lint", - "name": "workspace-lint", - "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-lint", - "itemList": [], - "isExternal": false, - "path": "/nx-api/nx/documents/workspace-lint", - "tags": ["enforce-module-boundaries"], - "originalFilePath": "generated/cli/workspace-lint" - }, "/nx-api/nx/documents/connect-to-nx-cloud": { "id": "connect-to-nx-cloud", "name": "connect-to-nx-cloud", diff --git a/docs/generated/manifests/tags.json b/docs/generated/manifests/tags.json index e57578dac14d43..3b542743605c33 100644 --- a/docs/generated/manifests/tags.json +++ b/docs/generated/manifests/tags.json @@ -361,13 +361,6 @@ "id": "format-write", "name": "format:write", "path": "/nx-api/nx/documents/format-write" - }, - { - "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.", - "file": "generated/packages/generated/packages/nx/documents/workspace-lint", - "id": "workspace-lint", - "name": "workspace-lint", - "path": "/nx-api/nx/documents/workspace-lint" } ], "integrate-with-editors": [ diff --git a/docs/generated/packages-metadata.json b/docs/generated/packages-metadata.json index 2b01aefc29df8a..701d8f6c1f3e10 100644 --- a/docs/generated/packages-metadata.json +++ b/docs/generated/packages-metadata.json @@ -1656,17 +1656,6 @@ "tags": [], "originalFilePath": "generated/cli/list" }, - { - "id": "workspace-lint", - "name": "workspace-lint", - "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-lint", - "itemList": [], - "isExternal": false, - "path": "nx/documents/workspace-lint", - "tags": ["enforce-module-boundaries"], - "originalFilePath": "generated/cli/workspace-lint" - }, { "id": "connect-to-nx-cloud", "name": "connect-to-nx-cloud", diff --git a/docs/generated/packages/nx/documents/workspace-lint.md b/docs/generated/packages/nx/documents/workspace-lint.md deleted file mode 100644 index a77e61ffa2cba1..00000000000000 --- a/docs/generated/packages/nx/documents/workspace-lint.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: 'workspace-lint - CLI command' -description: 'Lint nx specific workspace files (nx.json, workspace.json)' ---- - -# workspace-lint - -**Deprecated:** workspace-lint is deprecated, and will be removed in v17. The checks it used to perform are no longer relevant. See: https://nx.dev/deprecated/workspace-lint - -Lint nx specific workspace files (nx.json, workspace.json) - -## Usage - -```shell -nx workspace-lint [files..] -``` - -Install `nx` globally to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpm nx`. diff --git a/docs/map.json b/docs/map.json index be544d272c9f97..4e5a7df55f6886 100644 --- a/docs/map.json +++ b/docs/map.json @@ -1855,12 +1855,6 @@ "id": "list", "file": "generated/cli/list" }, - { - "name": "workspace-lint", - "id": "workspace-lint", - "tags": ["enforce-module-boundaries"], - "file": "generated/cli/workspace-lint" - }, { "name": "connect-to-nx-cloud", "id": "connect-to-nx-cloud", diff --git a/docs/shared/mental-model/large-tasks.json b/docs/shared/mental-model/large-tasks.json index 1cdf36e72cc427..2010d74a49f738 100644 --- a/docs/shared/mental-model/large-tasks.json +++ b/docs/shared/mental-model/large-tasks.json @@ -24995,10 +24995,6 @@ "file": "docs/generated/cli/workspace-generator.md", "hash": "c602609d311a8f3b028cdde9d83a1bd860a53870" }, - { - "file": "docs/generated/cli/workspace-lint.md", - "hash": "c5bc40d3a8198ca5eebdcd851dff5e85d9ce3912" - }, { "file": "docs/generated/devkit/index.md", "hash": "0d2ed5a146246b4ead2e2ed41f1fccb36f744f2b" @@ -25435,10 +25431,6 @@ "file": "docs/nx-cloud/set-up/record-report.png", "hash": "53bc7135364d69e45ba9c9c03ae5dc369ff8770f" }, - { - "file": "docs/nx-cloud/set-up/record-workspace-lint.png", - "hash": "c5f64a0d41f8e206e0ba69f3aa256fd418dbb9c5" - }, { "file": "docs/packages.json", "hash": "4b70f786be62411165df5819ee41d8787287d841" diff --git a/docs/shared/monorepo-ci-azure.md b/docs/shared/monorepo-ci-azure.md index f2a9ec219ebc3e..4b858217c574dc 100644 --- a/docs/shared/monorepo-ci-azure.md +++ b/docs/shared/monorepo-ci-azure.md @@ -141,7 +141,6 @@ jobs: - script: npm ci - - script: npx nx workspace-lint - script: npx nx format:check - script: npx nx affected --base=$(BASE_SHA) -t lint --parallel=3 diff --git a/docs/shared/reference/nxignore.md b/docs/shared/reference/nxignore.md index 0288ff21278e50..0cd6155b6f3123 100644 --- a/docs/shared/reference/nxignore.md +++ b/docs/shared/reference/nxignore.md @@ -9,4 +9,3 @@ a [`.gitignore` file](https://git-scm.com/book/en/v2/Git-Basics-Recording-Change **When a file is specified in the `.nxignore` file:** 1. Changes to that file are not taken into account in the `affected` calculations. -2. Even if the file is outside an app or library, `nx workspace-lint` won't warn about it. diff --git a/docs/shared/reference/sitemap.md b/docs/shared/reference/sitemap.md index a8d45897ecfac8..95edbb72bc7501 100644 --- a/docs/shared/reference/sitemap.md +++ b/docs/shared/reference/sitemap.md @@ -497,7 +497,6 @@ - [migrate](/nx-api/nx/documents/migrate) - [report](/nx-api/nx/documents/report) - [list](/nx-api/nx/documents/list) - - [workspace-lint](/nx-api/nx/documents/workspace-lint) - [connect-to-nx-cloud](/nx-api/nx/documents/connect-to-nx-cloud) - [reset](/nx-api/nx/documents/reset) - [repair](/nx-api/nx/documents/repair) diff --git a/nx-dev/nx-dev-e2e/src/additional-api-references.spec.ts b/nx-dev/nx-dev-e2e/src/additional-api-references.spec.ts index 445567899bb4b5..1a74ea58caeee5 100644 --- a/nx-dev/nx-dev-e2e/src/additional-api-references.spec.ts +++ b/nx-dev/nx-dev-e2e/src/additional-api-references.spec.ts @@ -16,7 +16,6 @@ const pages: Array<{ title: string; path: string }> = [ { title: 'migrate', path: '/cli/migrate' }, { title: 'report', path: '/cli/report' }, { title: 'list', path: '/cli/list' }, - { title: 'workspace-lint', path: '/cli/workspace-lint' }, { title: 'connect', path: '/cli/connect-to-nx-cloud' }, { title: 'reset', path: '/cli/reset' }, { title: 'Storybook', path: '/storybook/overview-react' }, diff --git a/nx-dev/nx-dev/redirect-rules.js b/nx-dev/nx-dev/redirect-rules.js index d4e2e371c3cab0..bedbe912c3bc93 100644 --- a/nx-dev/nx-dev/redirect-rules.js +++ b/nx-dev/nx-dev/redirect-rules.js @@ -337,7 +337,6 @@ const cliUrls = { '/cli/migrate': '/nx/migrate', '/cli/report': '/nx/report', '/cli/list': '/nx/list', - '/cli/workspace-lint': '/nx/workspace-lint', '/cli/connect-to-nx-cloud': '/nx/connect-to-nx-cloud', '/cli/reset': '/nx/reset', }; @@ -576,7 +575,6 @@ const packagesDocuments = { '/nx/migrate': '/packages/nx/documents/migrate', '/nx/report': '/packages/nx/documents/report', '/nx/list': '/packages/nx/documents/list', - '/nx/workspace-lint': '/packages/nx/documents/workspace-lint', '/nx/workspace-generator': '/packages/nx/documents/workspace-generator', '/nx/connect-to-nx-cloud': '/packages/nx/documents/connect-to-nx-cloud', '/nx/reset': '/packages/nx/documents/reset', diff --git a/packages/nx/src/command-line/nx-commands.ts b/packages/nx/src/command-line/nx-commands.ts index 7fe5aec64d6b74..46879e81f50050 100644 --- a/packages/nx/src/command-line/nx-commands.ts +++ b/packages/nx/src/command-line/nx-commands.ts @@ -35,7 +35,6 @@ import { yargsRunCommand } from './run/command-object'; import { yargsRunManyCommand } from './run-many/command-object'; import { yargsShowCommand } from './show/command-object'; import { yargsWatchCommand } from './watch/command-object'; -import { yargsWorkspaceLintCommand } from './workspace-lint/command-object'; import { yargsResetCommand } from './reset/command-object'; import { yargsReleaseCommand } from './release/command-object'; @@ -85,7 +84,6 @@ export const commandsObject = yargs .command(yargsShowCommand) .command(yargsViewLogsCommand) .command(yargsWatchCommand) - .command(yargsWorkspaceLintCommand) .scriptName('nx') .help() // NOTE: we handle --version in nx.ts, this just tells yargs that the option exists diff --git a/packages/nx/src/command-line/workspace-lint/command-object.ts b/packages/nx/src/command-line/workspace-lint/command-object.ts deleted file mode 100644 index 41da302bcd1b45..00000000000000 --- a/packages/nx/src/command-line/workspace-lint/command-object.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { CommandModule } from 'yargs'; - -/** - * @deprecated workspace-lint is deprecated, and will be removed in v17. The checks it used to perform are no longer relevant. - */ -export const yargsWorkspaceLintCommand: CommandModule = { - command: 'workspace-lint [files..]', - describe: 'Lint nx specific workspace files (nx.json, workspace.json)', - deprecated: - 'workspace-lint is deprecated, and will be removed in v17. The checks it used to perform are no longer relevant. See: https://nx.dev/deprecated/workspace-lint', - handler: async () => { - await (await import('./workspace-lint')).workspaceLint(); - process.exit(0); - }, -}; diff --git a/packages/nx/src/command-line/workspace-lint/workspace-lint.ts b/packages/nx/src/command-line/workspace-lint/workspace-lint.ts deleted file mode 100644 index 7d9e53816945aa..00000000000000 --- a/packages/nx/src/command-line/workspace-lint/workspace-lint.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { output } from '../../utils/output'; - -export async function workspaceLint(): Promise { - output.warn({ - title: `"nx workspace-lint" has been deprecated.`, - bodyLines: [ - `Nx has been reworked to make sure that the issues workspace-lint used to catch are no longer possible.`, - `Remove "nx workspace-lint" from your CI.`, - ], - }); -} From c83102a2c4e54c47e3f27899bda4e902d629d2c0 Mon Sep 17 00:00:00 2001 From: Emily Xiong Date: Fri, 13 Oct 2023 13:09:01 -0400 Subject: [PATCH 5/9] feat(core): add batch flag to run (#19575) Co-authored-by: FrozenPandaz --- docs/generated/cli/affected.md | 6 ++++++ docs/generated/cli/run-many.md | 6 ++++++ docs/generated/devkit/DefaultTasksRunnerOptions.md | 7 +++++++ docs/generated/packages/nx/documents/affected.md | 6 ++++++ docs/generated/packages/nx/documents/run-many.md | 6 ++++++ e2e/js/src/js-executor-tsc.test.ts | 5 ++++- .../nx/src/command-line/affected/command-object.ts | 5 ++++- .../nx/src/command-line/run-many/command-object.ts | 5 ++++- packages/nx/src/command-line/run/command-object.ts | 3 ++- .../src/command-line/yargs-utils/shared-options.ts | 13 ++++++++++++- .../nx/src/tasks-runner/default-tasks-runner.ts | 1 + packages/nx/src/tasks-runner/run-command.ts | 6 +++++- packages/nx/src/tasks-runner/tasks-schedule.ts | 2 +- packages/nx/src/utils/command-line-utils.ts | 1 + 14 files changed, 65 insertions(+), 7 deletions(-) diff --git a/docs/generated/cli/affected.md b/docs/generated/cli/affected.md index b8557f8d107264..993d5a8bb575ea 100644 --- a/docs/generated/cli/affected.md +++ b/docs/generated/cli/affected.md @@ -79,6 +79,12 @@ Type: `string` Base of the current branch (usually main) +### batch + +Type: `boolean` + +Default: `false` + ### configuration Type: `string` diff --git a/docs/generated/cli/run-many.md b/docs/generated/cli/run-many.md index 2d80356950d798..9de3dfddd6e31e 100644 --- a/docs/generated/cli/run-many.md +++ b/docs/generated/cli/run-many.md @@ -81,6 +81,12 @@ Default: `true` [deprecated] `run-many` runs all targets on all projects in the workspace if no projects are provided. This option is no longer required. +### batch + +Type: `boolean` + +Default: `false` + ### configuration Type: `string` diff --git a/docs/generated/devkit/DefaultTasksRunnerOptions.md b/docs/generated/devkit/DefaultTasksRunnerOptions.md index 886a21ce803eb1..cb51ef9d8b9f15 100644 --- a/docs/generated/devkit/DefaultTasksRunnerOptions.md +++ b/docs/generated/devkit/DefaultTasksRunnerOptions.md @@ -4,6 +4,7 @@ ### Properties +- [batch](../../devkit/documents/DefaultTasksRunnerOptions#batch): boolean - [cacheDirectory](../../devkit/documents/DefaultTasksRunnerOptions#cachedirectory): string - [cacheableOperations](../../devkit/documents/DefaultTasksRunnerOptions#cacheableoperations): string[] - [cacheableTargets](../../devkit/documents/DefaultTasksRunnerOptions#cacheabletargets): string[] @@ -16,6 +17,12 @@ ## Properties +### batch + +• `Optional` **batch**: `boolean` + +--- + ### cacheDirectory • `Optional` **cacheDirectory**: `string` diff --git a/docs/generated/packages/nx/documents/affected.md b/docs/generated/packages/nx/documents/affected.md index b8557f8d107264..993d5a8bb575ea 100644 --- a/docs/generated/packages/nx/documents/affected.md +++ b/docs/generated/packages/nx/documents/affected.md @@ -79,6 +79,12 @@ Type: `string` Base of the current branch (usually main) +### batch + +Type: `boolean` + +Default: `false` + ### configuration Type: `string` diff --git a/docs/generated/packages/nx/documents/run-many.md b/docs/generated/packages/nx/documents/run-many.md index 2d80356950d798..9de3dfddd6e31e 100644 --- a/docs/generated/packages/nx/documents/run-many.md +++ b/docs/generated/packages/nx/documents/run-many.md @@ -81,6 +81,12 @@ Default: `true` [deprecated] `run-many` runs all targets on all projects in the workspace if no projects are provided. This option is no longer required. +### batch + +Type: `boolean` + +Default: `false` + ### configuration Type: `string` diff --git a/e2e/js/src/js-executor-tsc.test.ts b/e2e/js/src/js-executor-tsc.test.ts index 5a202c902b6496..c43c777e9658c5 100644 --- a/e2e/js/src/js-executor-tsc.test.ts +++ b/e2e/js/src/js-executor-tsc.test.ts @@ -152,7 +152,7 @@ describe('js:tsc executor', () => { // check batch build rmDist(); - const batchBuildOutput = runCLI(`build ${parentLib} --skip-nx-cache`, { + let batchBuildOutput = runCLI(`build ${parentLib} --skip-nx-cache`, { env: { NX_BATCH_MODE: 'true' }, }); @@ -173,6 +173,9 @@ describe('js:tsc executor', () => { `Successfully ran target build for project ${parentLib} and 1 task it depends on` ); + batchBuildOutput = runCLI(`build ${parentLib} --skip-nx-cache --batch`); + expect(batchBuildOutput).toContain(`Running 2 tasks with @nx/js:tsc`); + checkFilesExist( // parent `dist/libs/${parentLib}/package.json`, diff --git a/packages/nx/src/command-line/affected/command-object.ts b/packages/nx/src/command-line/affected/command-object.ts index 2127fa624cef92..b989a3ca8f8df4 100644 --- a/packages/nx/src/command-line/affected/command-object.ts +++ b/packages/nx/src/command-line/affected/command-object.ts @@ -2,6 +2,7 @@ import { boolean, CommandModule, middleware } from 'yargs'; import { linkToNxDevAndExamples } from '../yargs-utils/documentation'; import { withAffectedOptions, + withBatch, withConfiguration, withDepGraphOptions, withOutputStyleOption, @@ -17,7 +18,9 @@ export const yargsAffectedCommand: CommandModule = { linkToNxDevAndExamples( withAffectedOptions( withRunOptions( - withOutputStyleOption(withTargetAndConfigurationOption(yargs)) + withOutputStyleOption( + withTargetAndConfigurationOption(withBatch(yargs)) + ) ) ) .option('all', { diff --git a/packages/nx/src/command-line/run-many/command-object.ts b/packages/nx/src/command-line/run-many/command-object.ts index 2b4fdf55024344..afe7167d8d0488 100644 --- a/packages/nx/src/command-line/run-many/command-object.ts +++ b/packages/nx/src/command-line/run-many/command-object.ts @@ -5,6 +5,7 @@ import { withOutputStyleOption, withTargetAndConfigurationOption, withOverrides, + withBatch, } from '../yargs-utils/shared-options'; export const yargsRunManyCommand: CommandModule = { @@ -13,7 +14,9 @@ export const yargsRunManyCommand: CommandModule = { builder: (yargs) => linkToNxDevAndExamples( withRunManyOptions( - withOutputStyleOption(withTargetAndConfigurationOption(yargs)) + withOutputStyleOption( + withTargetAndConfigurationOption(withBatch(yargs)) + ) ), 'run-many' ), diff --git a/packages/nx/src/command-line/run/command-object.ts b/packages/nx/src/command-line/run/command-object.ts index 2c25e378c71c43..4461ec5c3d0d05 100644 --- a/packages/nx/src/command-line/run/command-object.ts +++ b/packages/nx/src/command-line/run/command-object.ts @@ -1,5 +1,6 @@ import { CommandModule } from 'yargs'; import { + withBatch, withOverrides, withRunOneOptions, } from '../yargs-utils/shared-options'; @@ -13,7 +14,7 @@ export const yargsRunCommand: CommandModule = { (e.g., nx serve myapp --configuration=production) You can skip the use of Nx cache by using the --skip-nx-cache option.`, - builder: (yargs) => withRunOneOptions(yargs), + builder: (yargs) => withRunOneOptions(withBatch(yargs)), handler: async (args) => (await import('./run-one')).runOne(process.cwd(), withOverrides(args)), }; diff --git a/packages/nx/src/command-line/yargs-utils/shared-options.ts b/packages/nx/src/command-line/yargs-utils/shared-options.ts index 9a294df04719ff..7cdc97820a7b56 100644 --- a/packages/nx/src/command-line/yargs-utils/shared-options.ts +++ b/packages/nx/src/command-line/yargs-utils/shared-options.ts @@ -25,6 +25,7 @@ export interface RunOptions { skipNxCache: boolean; cloud: boolean; dte: boolean; + batch: boolean; } export function withRunOptions(yargs: Argv): Argv { @@ -89,7 +90,7 @@ export function withRunOptions(yargs: Argv): Argv { .options('dte', { type: 'boolean', hidden: true, - }) as Argv> as any; + }) as Argv> as any; } export function withTargetAndConfigurationOption( @@ -116,6 +117,16 @@ export function withConfiguration(yargs: Argv) { }); } +export function withBatch(yargs: Argv) { + return yargs.options('batch', { + type: 'boolean', + coerce: (v) => { + return v || process.env.BATCH_MODE === 'true'; + }, + default: false, + }) as any; +} + export function withAffectedOptions(yargs: Argv) { return withExcludeOption(yargs) .parserConfiguration({ diff --git a/packages/nx/src/tasks-runner/default-tasks-runner.ts b/packages/nx/src/tasks-runner/default-tasks-runner.ts index ff3dc631f587a3..75e80cdc9386b8 100644 --- a/packages/nx/src/tasks-runner/default-tasks-runner.ts +++ b/packages/nx/src/tasks-runner/default-tasks-runner.ts @@ -24,6 +24,7 @@ export interface DefaultTasksRunnerOptions { lifeCycle: LifeCycle; captureStderr?: boolean; skipNxCache?: boolean; + batch?: boolean; } export const defaultTasksRunner: TasksRunner< diff --git a/packages/nx/src/tasks-runner/run-command.ts b/packages/nx/src/tasks-runner/run-command.ts index acdcc9f9e9a843..077342d055f11e 100644 --- a/packages/nx/src/tasks-runner/run-command.ts +++ b/packages/nx/src/tasks-runner/run-command.ts @@ -194,7 +194,11 @@ export async function runCommand( } function setEnvVarsBasedOnArgs(nxArgs: NxArgs, loadDotEnvFiles: boolean) { - if (nxArgs.outputStyle == 'stream' || process.env.NX_BATCH_MODE === 'true') { + if ( + nxArgs.outputStyle == 'stream' || + process.env.NX_BATCH_MODE === 'true' || + nxArgs.batch + ) { process.env.NX_STREAM_OUTPUT = 'true'; process.env.NX_PREFIX_OUTPUT = 'true'; } diff --git a/packages/nx/src/tasks-runner/tasks-schedule.ts b/packages/nx/src/tasks-runner/tasks-schedule.ts index 21d7b345b6a582..23776248b0567c 100644 --- a/packages/nx/src/tasks-runner/tasks-schedule.ts +++ b/packages/nx/src/tasks-runner/tasks-schedule.ts @@ -71,7 +71,7 @@ export class TasksSchedule { } private async scheduleTasks() { - if (process.env.NX_BATCH_MODE === 'true') { + if (this.options.batch || process.env.NX_BATCH_MODE === 'true') { await this.scheduleBatches(); } for (let root of this.notScheduledTaskGraph.roots) { diff --git a/packages/nx/src/utils/command-line-utils.ts b/packages/nx/src/utils/command-line-utils.ts index 1348a16d82f452..cc5a731c92cc17 100644 --- a/packages/nx/src/utils/command-line-utils.ts +++ b/packages/nx/src/utils/command-line-utils.ts @@ -35,6 +35,7 @@ export interface NxArgs { nxBail?: boolean; nxIgnoreCycles?: boolean; type?: string; + batch?: boolean; } export function createOverrides(__overrides_unparsed__: string[] = []) { From 8249ace5a2da6697d659095d9f89b101b8b28446 Mon Sep 17 00:00:00 2001 From: Jason Jean Date: Fri, 13 Oct 2023 13:20:10 -0400 Subject: [PATCH 6/9] feat(nx-plugin): add as provided prompt for executor generator (#19602) --- .../packages/plugin/generators/executor.json | 20 ++- packages/devkit/internal-testing-utils.ts | 1 + .../artifact-name-and-directory-utils.spec.ts | 55 +++++++- .../artifact-name-and-directory-utils.ts | 40 ++++-- packages/plugin/generators.json | 2 +- packages/plugin/project.json | 2 +- .../src/generators/executor/executor.spec.ts | 120 +++++++++++++----- .../src/generators/executor/executor.ts | 87 ++++++++----- ...c.ts__tmpl__ => executor.spec.ts.template} | 0 ...ecutor.ts__tmpl__ => executor.ts.template} | 0 ...hema.d.ts__tmpl__ => schema.d.ts.template} | 0 ...hema.json__tmpl__ => schema.json.template} | 0 ...pec.ts__tmpl__ => hasher.spec.ts.template} | 0 .../hasher.ts__tmpl__ => hasher.ts.template} | 0 .../src/generators/executor/schema.d.ts | 6 +- .../src/generators/executor/schema.json | 16 ++- 16 files changed, 253 insertions(+), 96 deletions(-) rename packages/plugin/src/generators/executor/files/executor/{__fileName__/executor.spec.ts__tmpl__ => executor.spec.ts.template} (100%) rename packages/plugin/src/generators/executor/files/executor/{__fileName__/executor.ts__tmpl__ => executor.ts.template} (100%) rename packages/plugin/src/generators/executor/files/executor/{__fileName__/schema.d.ts__tmpl__ => schema.d.ts.template} (100%) rename packages/plugin/src/generators/executor/files/executor/{__fileName__/schema.json__tmpl__ => schema.json.template} (100%) rename packages/plugin/src/generators/executor/files/hasher/{__fileName__/hasher.spec.ts__tmpl__ => hasher.spec.ts.template} (100%) rename packages/plugin/src/generators/executor/files/hasher/{__fileName__/hasher.ts__tmpl__ => hasher.ts.template} (100%) diff --git a/docs/generated/packages/plugin/generators/executor.json b/docs/generated/packages/plugin/generators/executor.json index c051d667f6d525..f01e864586914d 100644 --- a/docs/generated/packages/plugin/generators/executor.json +++ b/docs/generated/packages/plugin/generators/executor.json @@ -1,6 +1,6 @@ { "name": "executor", - "factory": "./src/generators/executor/executor", + "factory": "./src/generators/executor/executor#executorGeneratorInternal", "schema": { "$schema": "http://json-schema.org/schema", "cli": "nx", @@ -20,9 +20,7 @@ "type": "string", "description": "The name of the project.", "alias": "p", - "$default": { "$source": "projectName" }, - "x-prompt": "What is the name of the project for the executor?", - "x-priority": "important" + "$default": { "$source": "projectName" } }, "name": { "type": "string", @@ -31,6 +29,11 @@ "x-prompt": "What name would you like to use for the executor?", "x-priority": "important" }, + "directory": { + "type": "string", + "description": "The directory at which to create the executor file. When `--nameAndDirectoryFormat=as-provided`, it will be relative to the current working directory. Otherwise, it will be relative to the workspace root.", + "aliases": ["dir"] + }, "description": { "type": "string", "description": "Executor description." @@ -51,6 +54,11 @@ "default": false, "description": "Do not add an eslint configuration for plugin json files." }, + "nameAndDirectoryFormat": { + "description": "Whether to generate the component in the directory as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).", + "type": "string", + "enum": ["as-provided", "derived"] + }, "skipFormat": { "type": "boolean", "description": "Skip formatting files.", @@ -58,12 +66,12 @@ "x-priority": "internal" } }, - "required": ["project", "name"], + "required": ["name"], "additionalProperties": false, "presets": [] }, "description": "Create an executor for an Nx Plugin.", - "implementation": "/packages/plugin/src/generators/executor/executor.ts", + "implementation": "/packages/plugin/src/generators/executor/executor#executorGeneratorInternal.ts", "aliases": [], "hidden": false, "path": "/packages/plugin/src/generators/executor/schema.json", diff --git a/packages/devkit/internal-testing-utils.ts b/packages/devkit/internal-testing-utils.ts index edef8ec37b65e7..a17b1b90ebf933 100644 --- a/packages/devkit/internal-testing-utils.ts +++ b/packages/devkit/internal-testing-utils.ts @@ -3,3 +3,4 @@ export * from 'nx/src/internal-testing-utils/assert-valid-migrations'; export * from 'nx/src/internal-testing-utils/run-migration-against-this-workspace'; export * from 'nx/src/internal-testing-utils/with-environment'; export * from 'nx/src/internal-testing-utils/temp-fs'; +export { setCwd } from './src/generators/artifact-name-and-directory-utils'; diff --git a/packages/devkit/src/generators/artifact-name-and-directory-utils.spec.ts b/packages/devkit/src/generators/artifact-name-and-directory-utils.spec.ts index 2b4656c63a769f..da5d29ff5a068d 100644 --- a/packages/devkit/src/generators/artifact-name-and-directory-utils.spec.ts +++ b/packages/devkit/src/generators/artifact-name-and-directory-utils.spec.ts @@ -2,9 +2,10 @@ import * as enquirer from 'enquirer'; import { addProjectConfiguration } from 'nx/src/devkit-exports'; import { createTreeWithEmptyWorkspace } from 'nx/src/generators/testing-utils/create-tree-with-empty-workspace'; import type { Tree } from 'nx/src/generators/tree'; -import { workspaceRoot } from 'nx/src/utils/workspace-root'; -import { join } from 'path'; -import { determineArtifactNameAndDirectoryOptions } from './artifact-name-and-directory-utils'; +import { + determineArtifactNameAndDirectoryOptions, + setCwd, +} from './artifact-name-and-directory-utils'; describe('determineArtifactNameAndDirectoryOptions', () => { let tree: Tree; @@ -25,10 +26,6 @@ describe('determineArtifactNameAndDirectoryOptions', () => { process.stdout.isTTY = originalIsTTYValue; } - function setCwd(path: string) { - process.env.INIT_CWD = join(workspaceRoot, path); - } - function restoreCwd() { if (originalInitCwd === undefined) { delete process.env.INIT_CWD; @@ -39,6 +36,7 @@ describe('determineArtifactNameAndDirectoryOptions', () => { beforeEach(() => { tree = createTreeWithEmptyWorkspace(); + setCwd(''); jest.clearAllMocks(); originalInteractiveValue = process.env.NX_INTERACTIVE; @@ -47,6 +45,49 @@ describe('determineArtifactNameAndDirectoryOptions', () => { originalInitCwd = process.env.INIT_CWD; }); + it('should accept a derivedDirectory which is relative to the project source root', async () => { + addProjectConfiguration(tree, 'app1', { + root: 'apps/app1', + sourceRoot: 'apps/app1/src', + projectType: 'application', + }); + + const res = await determineArtifactNameAndDirectoryOptions(tree, { + name: 'myComponent', + artifactType: 'component', + callingGenerator: '@my-org/my-plugin:component', + directory: 'components', + derivedDirectory: 'components', + project: 'app1', + nameAndDirectoryFormat: 'derived', + }); + + expect(res.filePath).toEqual( + 'apps/app1/src/components/my-component/my-component.ts' + ); + }); + + it('should accept a derivedDirectory which is relative to the project root', async () => { + addProjectConfiguration(tree, 'app1', { + root: 'apps/app1', + projectType: 'application', + }); + + const res = await determineArtifactNameAndDirectoryOptions(tree, { + name: 'myComponent', + artifactType: 'component', + callingGenerator: '@my-org/my-plugin:component', + directory: 'components', + derivedDirectory: 'components', + project: 'app1', + nameAndDirectoryFormat: 'derived', + }); + + expect(res.filePath).toEqual( + 'apps/app1/components/my-component/my-component.ts' + ); + }); + it('should throw an error when the resolver directory is not under any project root', async () => { addProjectConfiguration(tree, 'app1', { root: 'apps/app1', diff --git a/packages/devkit/src/generators/artifact-name-and-directory-utils.ts b/packages/devkit/src/generators/artifact-name-and-directory-utils.ts index faa34888e5692a..fcf2872ee42481 100644 --- a/packages/devkit/src/generators/artifact-name-and-directory-utils.ts +++ b/packages/devkit/src/generators/artifact-name-and-directory-utils.ts @@ -1,7 +1,7 @@ import { prompt } from 'enquirer'; import type { ProjectConfiguration } from 'nx/src/config/workspace-json-project-json'; import type { Tree } from 'nx/src/generators/tree'; -import { relative } from 'path'; +import { join, relative } from 'path'; import { requireNx } from '../../nx'; import { names } from '../utils/names'; @@ -31,6 +31,7 @@ export type ArtifactGenerationOptions = { pascalCaseFile?: boolean; project?: string; suffix?: string; + derivedDirectory?: string; }; export type NameAndDirectoryOptions = { @@ -74,6 +75,7 @@ export async function determineArtifactNameAndDirectoryOptions( options.nameAndDirectoryFormat ?? (await determineFormat(formats, options)); validateResolvedProject( + tree, formats[format]?.project, options, formats[format]?.directory @@ -173,6 +175,7 @@ function getNameAndDirectoryOptionFormats( if (!options.project) { validateResolvedProject( + tree, asProvidedOptions.project, options, asProvidedOptions.directory @@ -278,14 +281,25 @@ function getDerivedOptions( project.projectType === 'application' ? 'app' : 'lib', extractedDirectory ?? '' ); - const derivedDirectory = options.flat - ? normalizePath(baseDirectory) - : joinPathFragments( - baseDirectory, - options.pascalCaseDirectory - ? names(derivedName).className - : names(derivedName).fileName - ); + const derivedDirectory = + typeof options.derivedDirectory === 'string' + ? joinPathFragments( + project.sourceRoot ?? project.root, + options.derivedDirectory, + options.flat + ? '' + : options.pascalCaseDirectory + ? names(derivedName).className + : names(derivedName).fileName + ) + : options.flat + ? normalizePath(baseDirectory) + : joinPathFragments( + baseDirectory, + options.pascalCaseDirectory + ? names(derivedName).className + : names(derivedName).fileName + ); if ( options.directory && @@ -333,6 +347,7 @@ function getDerivedOptions( } function validateResolvedProject( + tree: Tree, project: string | undefined, options: ArtifactGenerationOptions, normalizedDirectory: string @@ -392,6 +407,13 @@ function getRelativeCwd(): string { return normalizePath(relative(workspaceRoot, getCwd())); } +/** + * Function for setting cwd during testing + */ +export function setCwd(path: string): void { + process.env.INIT_CWD = join(workspaceRoot, path); +} + function getCwd(): string { return process.env.INIT_CWD?.startsWith(workspaceRoot) ? process.env.INIT_CWD diff --git a/packages/plugin/generators.json b/packages/plugin/generators.json index 8b86e8349bd120..9c49a325b27b58 100644 --- a/packages/plugin/generators.json +++ b/packages/plugin/generators.json @@ -29,7 +29,7 @@ "description": "Create a generator for an Nx Plugin." }, "executor": { - "factory": "./src/generators/executor/executor", + "factory": "./src/generators/executor/executor#executorGeneratorInternal", "schema": "./src/generators/executor/schema.json", "description": "Create an executor for an Nx Plugin." }, diff --git a/packages/plugin/project.json b/packages/plugin/project.json index 9e08c7cdfb6865..5f4961d05f4567 100644 --- a/packages/plugin/project.json +++ b/packages/plugin/project.json @@ -1,7 +1,7 @@ { "name": "plugin", "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "packages/plugin", + "sourceRoot": "packages/plugin/src", "projectType": "library", "targets": { "test": {}, diff --git a/packages/plugin/src/generators/executor/executor.spec.ts b/packages/plugin/src/generators/executor/executor.spec.ts index 5ae34d90c3e033..274530a5db5f9e 100644 --- a/packages/plugin/src/generators/executor/executor.spec.ts +++ b/packages/plugin/src/generators/executor/executor.spec.ts @@ -3,6 +3,7 @@ import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; import { executorGenerator } from './executor'; import { pluginGenerator } from '../plugin/plugin'; import { libraryGenerator as jsLibraryGenerator } from '@nx/js'; +import { setCwd } from '@nx/devkit/internal-testing-utils'; describe('NxPlugin Executor Generator', () => { let tree: Tree; @@ -10,7 +11,8 @@ describe('NxPlugin Executor Generator', () => { beforeEach(async () => { projectName = 'my-plugin'; - tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); + tree = createTreeWithEmptyWorkspace(); + setCwd(''); await pluginGenerator(tree, { name: projectName, @@ -18,6 +20,52 @@ describe('NxPlugin Executor Generator', () => { }); it('should generate files', async () => { + await executorGenerator(tree, { + name: 'my-executor', + directory: 'my-plugin/src/executors/my-executor', + unitTestRunner: 'jest', + includeHasher: false, + nameAndDirectoryFormat: 'as-provided', + }); + + expect( + tree.exists('my-plugin/src/executors/my-executor/schema.d.ts') + ).toBeTruthy(); + expect( + tree.exists('my-plugin/src/executors/my-executor/schema.json') + ).toBeTruthy(); + expect( + tree.exists('my-plugin/src/executors/my-executor/executor.ts') + ).toBeTruthy(); + expect( + tree.exists('my-plugin/src/executors/my-executor/executor.spec.ts') + ).toBeTruthy(); + }); + + it('should generate files relative to the cwd', async () => { + setCwd('my-plugin/src/executors/my-executor'); + await executorGenerator(tree, { + name: 'my-executor', + unitTestRunner: 'jest', + includeHasher: false, + nameAndDirectoryFormat: 'as-provided', + }); + + expect( + tree.exists('my-plugin/src/executors/my-executor/schema.d.ts') + ).toBeTruthy(); + expect( + tree.exists('my-plugin/src/executors/my-executor/schema.json') + ).toBeTruthy(); + expect( + tree.exists('my-plugin/src/executors/my-executor/executor.ts') + ).toBeTruthy(); + expect( + tree.exists('my-plugin/src/executors/my-executor/executor.spec.ts') + ).toBeTruthy(); + }); + + it('should generate files for derived', async () => { await executorGenerator(tree, { project: projectName, name: 'my-executor', @@ -26,29 +74,29 @@ describe('NxPlugin Executor Generator', () => { }); expect( - tree.exists('libs/my-plugin/src/executors/my-executor/schema.d.ts') + tree.exists('my-plugin/src/executors/my-executor/schema.d.ts') ).toBeTruthy(); expect( - tree.exists('libs/my-plugin/src/executors/my-executor/schema.json') + tree.exists('my-plugin/src/executors/my-executor/schema.json') ).toBeTruthy(); expect( - tree.exists('libs/my-plugin/src/executors/my-executor/executor.ts') + tree.exists('my-plugin/src/executors/my-executor/executor.ts') ).toBeTruthy(); expect( - tree.exists('libs/my-plugin/src/executors/my-executor/executor.spec.ts') + tree.exists('my-plugin/src/executors/my-executor/executor.spec.ts') ).toBeTruthy(); }); it('should update executors.json', async () => { await executorGenerator(tree, { - project: projectName, name: 'my-executor', - description: 'my-executor description', + directory: 'my-plugin/src/executors/my-executor', unitTestRunner: 'jest', includeHasher: false, + nameAndDirectoryFormat: 'as-provided', }); - const executorJson = readJson(tree, 'libs/my-plugin/executors.json'); + const executorJson = readJson(tree, 'my-plugin/executors.json'); expect(executorJson.executors['my-executor'].implementation).toEqual( './src/executors/my-executor/executor' @@ -57,11 +105,11 @@ describe('NxPlugin Executor Generator', () => { './src/executors/my-executor/schema.json' ); expect(executorJson.executors['my-executor'].description).toEqual( - 'my-executor description' + 'my-executor executor' ); }); - it('should generate default description', async () => { + it('should update executors.json for derived', async () => { await executorGenerator(tree, { project: projectName, name: 'my-executor', @@ -69,23 +117,30 @@ describe('NxPlugin Executor Generator', () => { includeHasher: false, }); - const executorsJson = readJson(tree, 'libs/my-plugin/executors.json'); + const executorJson = readJson(tree, 'my-plugin/executors.json'); - expect(executorsJson.executors['my-executor'].description).toEqual( + expect(executorJson.executors['my-executor'].implementation).toEqual( + './src/executors/my-executor/executor' + ); + expect(executorJson.executors['my-executor'].schema).toEqual( + './src/executors/my-executor/schema.json' + ); + expect(executorJson.executors['my-executor'].description).toEqual( 'my-executor executor' ); }); it('should generate custom description', async () => { await executorGenerator(tree, { - project: projectName, name: 'my-executor', + directory: 'my-plugin/src/executors/my-executor', description: 'my-executor custom description', unitTestRunner: 'jest', includeHasher: false, + nameAndDirectoryFormat: 'as-provided', }); - const executorsJson = readJson(tree, 'libs/my-plugin/executors.json'); + const executorsJson = readJson(tree, 'my-plugin/executors.json'); expect(executorsJson.executors['my-executor'].description).toEqual( 'my-executor custom description' @@ -96,13 +151,16 @@ describe('NxPlugin Executor Generator', () => { await jsLibraryGenerator(tree, { name: 'test-js-lib', bundler: 'tsc', + projectNameAndRootFormat: 'as-provided', }); const libConfig = readProjectConfiguration(tree, 'test-js-lib'); + await executorGenerator(tree, { - project: 'test-js-lib', - includeHasher: false, name: 'test-executor', + directory: 'test-js-lib/src/executors/my-executor', unitTestRunner: 'jest', + includeHasher: false, + nameAndDirectoryFormat: 'as-provided', }); expect(() => tree.exists(`${libConfig.root}/executors.json`)).not.toThrow(); @@ -115,20 +173,18 @@ describe('NxPlugin Executor Generator', () => { describe('none', () => { it('should not generate unit test files', async () => { await executorGenerator(tree, { - project: projectName, name: 'my-executor', - description: 'my-executor description', + directory: 'my-plugin/src/executors/my-executor', unitTestRunner: 'none', - includeHasher: true, + includeHasher: false, + nameAndDirectoryFormat: 'as-provided', }); expect( - tree.exists( - 'libs/my-plugin/src/executors/my-executor/executor.spec.ts' - ) + tree.exists('my-plugin/src/executors/my-executor/executor.spec.ts') ).toBeFalsy(); expect( - tree.exists('libs/my-plugin/src/executors/my-executor/hasher.spec.ts') + tree.exists('my-plugin/src/executors/my-executor/hasher.spec.ts') ).toBeFalsy(); }); }); @@ -137,18 +193,17 @@ describe('NxPlugin Executor Generator', () => { describe('--includeHasher', () => { it('should generate hasher files', async () => { await executorGenerator(tree, { - project: projectName, name: 'my-executor', - includeHasher: true, + directory: 'my-plugin/src/executors/my-executor', unitTestRunner: 'jest', + includeHasher: true, + nameAndDirectoryFormat: 'as-provided', }); expect( - tree.exists('libs/my-plugin/src/executors/my-executor/hasher.spec.ts') + tree.exists('my-plugin/src/executors/my-executor/hasher.spec.ts') ).toBeTruthy(); expect( - tree - .read('libs/my-plugin/src/executors/my-executor/hasher.ts') - .toString() + tree.read('my-plugin/src/executors/my-executor/hasher.ts').toString() ).toMatchInlineSnapshot(` "import { CustomHasher } from '@nx/devkit'; @@ -168,13 +223,14 @@ describe('NxPlugin Executor Generator', () => { it('should update executors.json', async () => { await executorGenerator(tree, { - project: projectName, name: 'my-executor', - includeHasher: true, + directory: 'my-plugin/src/executors/my-executor', unitTestRunner: 'jest', + includeHasher: true, + nameAndDirectoryFormat: 'as-provided', }); - const executorsJson = readJson(tree, 'libs/my-plugin/executors.json'); + const executorsJson = readJson(tree, 'my-plugin/executors.json'); expect(executorsJson.executors['my-executor'].hasher).toEqual( './src/executors/my-executor/hasher' ); diff --git a/packages/plugin/src/generators/executor/executor.ts b/packages/plugin/src/generators/executor/executor.ts index 5c8ffda94120c9..8004653f20beeb 100644 --- a/packages/plugin/src/generators/executor/executor.ts +++ b/packages/plugin/src/generators/executor/executor.ts @@ -3,12 +3,12 @@ import { names, generateFiles, updateJson, - getWorkspaceLayout, joinPathFragments, writeJson, readJson, ExecutorsJson, formatFiles, + normalizePath, } from '@nx/devkit'; import type { Tree } from '@nx/devkit'; import type { Schema } from './schema'; @@ -16,13 +16,17 @@ import * as path from 'path'; import { PackageJson } from 'nx/src/utils/package-json'; import pluginLintCheckGenerator from '../lint-checks/generator'; import { nxVersion } from '../../utils/versions'; +import { getNpmScope } from '@nx/js/src/utils/package-json/get-npm-scope'; +import { determineArtifactNameAndDirectoryOptions } from '@nx/devkit/src/generators/artifact-name-and-directory-utils'; +import { join, relative } from 'path'; interface NormalizedSchema extends Schema { fileName: string; className: string; propertyName: string; projectRoot: string; - projectSourceRoot: string; + filePath: string; + directory: string; npmScope: string; } @@ -30,22 +34,14 @@ function addFiles(host: Tree, options: NormalizedSchema) { generateFiles( host, path.join(__dirname, './files/executor'), - `${options.projectSourceRoot}/executors`, + options.directory, { ...options, - tmpl: '', } ); if (options.unitTestRunner === 'none') { - host.delete( - joinPathFragments( - options.projectSourceRoot, - 'executors', - options.fileName, - `executor.spec.ts` - ) - ); + host.delete(joinPathFragments(options.directory, `executor.spec.ts`)); } } @@ -53,22 +49,14 @@ function addHasherFiles(host: Tree, options: NormalizedSchema) { generateFiles( host, path.join(__dirname, './files/hasher'), - `${options.projectSourceRoot}/executors`, + options.directory, { ...options, - tmpl: '', } ); if (options.unitTestRunner === 'none') { - host.delete( - joinPathFragments( - options.projectSourceRoot, - 'executors', - options.fileName, - 'hasher.spec.ts' - ) - ); + host.delete(joinPathFragments(options.directory, 'hasher.spec.ts')); } } @@ -139,14 +127,18 @@ async function updateExecutorJson(host: Tree, options: NormalizedSchema) { let executors = json.executors ?? json.builders; executors ||= {}; executors[options.name] = { - implementation: `./src/executors/${options.fileName}/executor`, - schema: `./src/executors/${options.fileName}/schema.json`, + implementation: `./${normalizePath( + relative(options.projectRoot, join(options.directory, 'executor')) + )}`, + schema: `./${normalizePath( + relative(options.projectRoot, join(options.directory, 'schema.json')) + )}`, description: options.description, }; if (options.includeHasher) { - executors[ - options.name - ].hasher = `./src/executors/${options.fileName}/hasher`; + executors[options.name].hasher = `./${normalizePath( + relative(options.projectRoot, join(options.directory, 'hasher')) + )}`; } json.executors = executors; @@ -154,12 +146,28 @@ async function updateExecutorJson(host: Tree, options: NormalizedSchema) { }); } -function normalizeOptions(host: Tree, options: Schema): NormalizedSchema { - const { npmScope } = getWorkspaceLayout(host); - const { fileName, className, propertyName } = names(options.name); +async function normalizeOptions( + tree: Tree, + options: Schema +): Promise { + const npmScope = getNpmScope(tree); + + const res = await determineArtifactNameAndDirectoryOptions(tree, { + artifactType: 'executor', + callingGenerator: '@nx/plugin:executor', + name: options.name, + nameAndDirectoryFormat: options.nameAndDirectoryFormat, + project: options.project, + directory: options.directory, + fileName: 'executor', + derivedDirectory: 'executors', + }); + + const { project, fileName, artifactName, filePath, directory } = res; - const { root: projectRoot, sourceRoot: projectSourceRoot } = - readProjectConfiguration(host, options.project); + const { className, propertyName } = names(artifactName); + + const { root: projectRoot } = readProjectConfiguration(tree, project); let description: string; if (options.description) { @@ -170,18 +178,27 @@ function normalizeOptions(host: Tree, options: Schema): NormalizedSchema { return { ...options, + filePath, + project, + directory, fileName, className, propertyName, description, projectRoot, - projectSourceRoot, npmScope, }; } -export async function executorGenerator(host: Tree, schema: Schema) { - const options = normalizeOptions(host, schema); +export async function executorGenerator(tree: Tree, rawOptions: Schema) { + await executorGeneratorInternal(tree, { + nameAndDirectoryFormat: 'derived', + ...rawOptions, + }); +} + +export async function executorGeneratorInternal(host: Tree, schema: Schema) { + const options = await normalizeOptions(host, schema); addFiles(host, options); if (options.includeHasher) { diff --git a/packages/plugin/src/generators/executor/files/executor/__fileName__/executor.spec.ts__tmpl__ b/packages/plugin/src/generators/executor/files/executor/executor.spec.ts.template similarity index 100% rename from packages/plugin/src/generators/executor/files/executor/__fileName__/executor.spec.ts__tmpl__ rename to packages/plugin/src/generators/executor/files/executor/executor.spec.ts.template diff --git a/packages/plugin/src/generators/executor/files/executor/__fileName__/executor.ts__tmpl__ b/packages/plugin/src/generators/executor/files/executor/executor.ts.template similarity index 100% rename from packages/plugin/src/generators/executor/files/executor/__fileName__/executor.ts__tmpl__ rename to packages/plugin/src/generators/executor/files/executor/executor.ts.template diff --git a/packages/plugin/src/generators/executor/files/executor/__fileName__/schema.d.ts__tmpl__ b/packages/plugin/src/generators/executor/files/executor/schema.d.ts.template similarity index 100% rename from packages/plugin/src/generators/executor/files/executor/__fileName__/schema.d.ts__tmpl__ rename to packages/plugin/src/generators/executor/files/executor/schema.d.ts.template diff --git a/packages/plugin/src/generators/executor/files/executor/__fileName__/schema.json__tmpl__ b/packages/plugin/src/generators/executor/files/executor/schema.json.template similarity index 100% rename from packages/plugin/src/generators/executor/files/executor/__fileName__/schema.json__tmpl__ rename to packages/plugin/src/generators/executor/files/executor/schema.json.template diff --git a/packages/plugin/src/generators/executor/files/hasher/__fileName__/hasher.spec.ts__tmpl__ b/packages/plugin/src/generators/executor/files/hasher/hasher.spec.ts.template similarity index 100% rename from packages/plugin/src/generators/executor/files/hasher/__fileName__/hasher.spec.ts__tmpl__ rename to packages/plugin/src/generators/executor/files/hasher/hasher.spec.ts.template diff --git a/packages/plugin/src/generators/executor/files/hasher/__fileName__/hasher.ts__tmpl__ b/packages/plugin/src/generators/executor/files/hasher/hasher.ts.template similarity index 100% rename from packages/plugin/src/generators/executor/files/hasher/__fileName__/hasher.ts__tmpl__ rename to packages/plugin/src/generators/executor/files/hasher/hasher.ts.template diff --git a/packages/plugin/src/generators/executor/schema.d.ts b/packages/plugin/src/generators/executor/schema.d.ts index 4e896a3f909f60..025ca41cf4f3e9 100644 --- a/packages/plugin/src/generators/executor/schema.d.ts +++ b/packages/plugin/src/generators/executor/schema.d.ts @@ -1,9 +1,13 @@ +import type { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils'; + export interface Schema { - project: string; + project?: string; name: string; + directory?: string; description?: string; unitTestRunner: 'jest' | 'none'; includeHasher: boolean; + nameAndDirectoryFormat?: NameAndDirectoryFormat; skipLintChecks?: boolean; skipFormat?: boolean; } diff --git a/packages/plugin/src/generators/executor/schema.json b/packages/plugin/src/generators/executor/schema.json index 211c25b01a1df4..8ae5d22b5fdb2a 100644 --- a/packages/plugin/src/generators/executor/schema.json +++ b/packages/plugin/src/generators/executor/schema.json @@ -19,9 +19,7 @@ "alias": "p", "$default": { "$source": "projectName" - }, - "x-prompt": "What is the name of the project for the executor?", - "x-priority": "important" + } }, "name": { "type": "string", @@ -33,6 +31,11 @@ "x-prompt": "What name would you like to use for the executor?", "x-priority": "important" }, + "directory": { + "type": "string", + "description": "The directory at which to create the executor file. When `--nameAndDirectoryFormat=as-provided`, it will be relative to the current working directory. Otherwise, it will be relative to the workspace root.", + "aliases": ["dir"] + }, "description": { "type": "string", "description": "Executor description." @@ -53,6 +56,11 @@ "default": false, "description": "Do not add an eslint configuration for plugin json files." }, + "nameAndDirectoryFormat": { + "description": "Whether to generate the component in the directory as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).", + "type": "string", + "enum": ["as-provided", "derived"] + }, "skipFormat": { "type": "boolean", "description": "Skip formatting files.", @@ -60,6 +68,6 @@ "x-priority": "internal" } }, - "required": ["project", "name"], + "required": ["name"], "additionalProperties": false } From 0e1962237bb2822d29ce2e2cd1a1dc3a2e927c69 Mon Sep 17 00:00:00 2001 From: Isaac Mann Date: Fri, 13 Oct 2023 15:47:33 -0400 Subject: [PATCH 7/9] fix(nx-dev): fix internal link checker (#19606) --- nx-dev/nx-dev/project.json | 6 +++ .../documentation/internal-link-checker.ts | 38 +------------------ 2 files changed, 7 insertions(+), 37 deletions(-) diff --git a/nx-dev/nx-dev/project.json b/nx-dev/nx-dev/project.json index 3da429313b11d4..5c6685b8c6fcd3 100644 --- a/nx-dev/nx-dev/project.json +++ b/nx-dev/nx-dev/project.json @@ -18,6 +18,12 @@ ], "parallel": false }, + "inputs": [ + "production", + "^production", + "{workspaceRoot}/scripts/tsconfig.scripts.json", + "{workspaceRoot}/scripts/documentation/internal-link-checker.ts" + ], "outputs": ["{workspaceRoot}/dist/nx-dev/nx-dev"] }, "sitemap": { diff --git a/scripts/documentation/internal-link-checker.ts b/scripts/documentation/internal-link-checker.ts index 3571a6713c07a5..9e2dc6fd191069 100644 --- a/scripts/documentation/internal-link-checker.ts +++ b/scripts/documentation/internal-link-checker.ts @@ -83,38 +83,6 @@ function readSiteMapLinks(filePath: string): string[] { return sitemap.urlset.url.map((obj) => obj.loc); } -/** - * This function checks if a link is for a private package. - * When link is for a private package, it is not included in the sitemap. - * However, some shared docs might be written for this private package during development. - * @param link e.g. /nx-api/vite/generators/configuration - * @returns true if the link is for a private package or NODE_ENV is not development, false otherwise. - */ -function checkLinkIsForPrivatePackage(link: string) { - // skip this check in dev mode - if (process.env.NODE_ENV === 'development') { - return false; - } - const pathSegments = link.split('/').filter(Boolean); - if (pathSegments[0] === 'nx-api') { - // TODO(v17): Remove this once vue is public or once this logic is fixed - if (pathSegments[1] === 'vue') { - return true; - } - - const packageJsonPath = join( - workspaceRoot, - 'packages', - pathSegments[1], - 'package.json' - ); - if (existsSync(packageJsonPath)) { - return readJSONSync(packageJsonPath).private ?? false; - } - } - return false; -} - // Main const documentLinks = extractAllLinks(join(workspaceRoot, 'docs')); const sitemapLinks = readSiteMapIndex( @@ -124,11 +92,7 @@ const sitemapLinks = readSiteMapIndex( const errors: Array<{ file: string; link: string }> = []; for (let file in documentLinks) { for (let link of documentLinks[file]) { - // TODO(@isaacplmann): This ignores errors which are links TO private packages. It allows links FROM public packages (public docs) TO private packages (404 links) - if ( - !sitemapLinks.includes(['https://nx.dev', link].join('')) && - !checkLinkIsForPrivatePackage(link) - ) { + if (!sitemapLinks.includes(['https://nx.dev', link].join(''))) { errors.push({ file, link }); } } From d36194ad17d36e8e12f517f30f5171f4af99d556 Mon Sep 17 00:00:00 2001 From: Juri Strumpflohner Date: Fri, 13 Oct 2023 22:16:20 +0200 Subject: [PATCH 8/9] docs(nx-dev): add links to nxconf talk videos (#19590) --- .../src/lib/conf-schedule-short.tsx | 35 +++++++------------ 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/nx-dev/ui-conference/src/lib/conf-schedule-short.tsx b/nx-dev/ui-conference/src/lib/conf-schedule-short.tsx index 65bfd88e20de80..f07a61e2e39caf 100644 --- a/nx-dev/ui-conference/src/lib/conf-schedule-short.tsx +++ b/nx-dev/ui-conference/src/lib/conf-schedule-short.tsx @@ -42,8 +42,7 @@ export function ConfScheduleShort(): JSX.Element { title: 'Keynote', description: '', speakers: ['Juri Strumpflohner', 'Victor Savkin'], - videoUrl: - 'https://www.youtube.com/live/IQ5YyEYZw68?si=TQRfAG7CtNbd3Xu4&t=250', + videoUrl: 'https://youtu.be/WSqivWlEDFw', }, { type: 'event', @@ -52,8 +51,7 @@ export function ConfScheduleShort(): JSX.Element { 'Nx Cloud Workflows: Next-Gen CI with First-Class Monorepo Support', description: `We're excited to provide an exclusive preview of Nx Cloud Workflows. In our first foray into delivering CI as part of Nx Cloud, we'll demonstrate how Workflows can simplify distributed executions as part of a typical CI pipeline, before talking about our long-term vision for the product.`, speakers: ['Simon Critchley'], - videoUrl: - 'https://www.youtube.com/live/IQ5YyEYZw68?si=TQRfAG7CtNbd3Xu4&t=3369', + videoUrl: 'https://youtu.be/JG1FWfZFByM', }, { type: 'event', @@ -64,8 +62,7 @@ export function ConfScheduleShort(): JSX.Element { This talk covers the tactics we apply to avoid interrupting the teams' workflow and onboard them to Nx and a monorepo workflow. An important part is what we call the Migration Toolkit. This custom Nx plugin helps teams prepare their repo by identifying the minimum requirements for migrating to the Nx monorepo workspace and offering custom Nx migration generators.`, speakers: ['Michael Hladky'], - videoUrl: - 'https://www.youtube.com/live/IQ5YyEYZw68?si=TQRfAG7CtNbd3Xu4&t=5027', + videoUrl: 'https://youtu.be/i0UdoImryJQ', }, { type: 'break', @@ -82,8 +79,7 @@ export function ConfScheduleShort(): JSX.Element { title: 'Redefining Projects with Nx: A Dive into the New Inference API', description: `In a continuous strive for improvement, we have revamped the project inference API, aiming to provide greater flexibility and power in defining and managing projects. This talk will walk through the evolution of the project inference API, highlighting the transition from a 1:1 file-to-project mapping to a more nuanced approach that handles complex project configurations. We'll explore the key advantages of the new API, including the ability to define multiple projects within a single file and set more comprehensive project properties. Join us to learn about these exciting changes and understand how they can enhance your work with Nx.`, speakers: ['Craigory Coppola'], - videoUrl: - 'https://www.youtube.com/live/IQ5YyEYZw68?si=TQRfAG7CtNbd3Xu4&t=8514', + videoUrl: 'https://youtu.be/bnjOu7iOrMg', }, { type: 'event', @@ -93,8 +89,7 @@ export function ConfScheduleShort(): JSX.Element { Starting from a package-based repo, we'll enforce module boundaries, create and use code generators and, finally, use task executors and automate updating dependencies. Together, these improvements add up to one giant leap forward in developer experience.`, speakers: ['Isaac Mann'], - videoUrl: - 'https://www.youtube.com/live/IQ5YyEYZw68?si=TQRfAG7CtNbd3Xu4&t=9966', + videoUrl: 'https://youtu.be/nY0_o7zWBLM', }, { type: 'event', @@ -103,8 +98,7 @@ export function ConfScheduleShort(): JSX.Element { description: 'In this talk we will dig into practical examples of various approaches to versioning and publishing packages from an Nx workspace.', speakers: ['James Henry'], - videoUrl: - 'https://www.youtube.com/live/IQ5YyEYZw68?si=TQRfAG7CtNbd3Xu4&t=11515', + videoUrl: 'https://youtu.be/p5qW5-2nKqI', }, { type: 'break', @@ -121,8 +115,7 @@ export function ConfScheduleShort(): JSX.Element { 'Lightning Talk: What if your stories were - already - your e2e tests?', description: `Storybook interaction tests allow developers to verify the functional aspects of UI components by simulating user behavior and checking UI and state updates. They integrate with Storybook's existing stories, utilizing a 'play' function to recreate user interactions, effectively transforming these stories into comprehensive e2e tests. Nx enhances the testing process by providing generators for Storybook interaction tests. This means that you don't need third-party tools for e2e tests if you're already using Storybook. What's awesome is that everything is fully integrated into your project right off the bat, with zero extra setup needed. So you can focus on what matters: building amazing UIs, with the peace of mind that testing is taken care of.`, speakers: ['Katerina Skroumpelou'], - videoUrl: - 'https://www.youtube.com/live/IQ5YyEYZw68?si=TQRfAG7CtNbd3Xu4&t=20443', + videoUrl: 'https://youtu.be/SWlvsDNXCsQ', }, { type: 'event', @@ -130,8 +123,7 @@ export function ConfScheduleShort(): JSX.Element { title: 'Lightning Talk: Nx Cloud Demo', description: `We're going to take a tour through some of the features of our latest release of Nx Cloud. We'll show you some of the latest analytics, organization management tools and ways that Nx Cloud can help you figure out what's really going on in CI without digging through endless logs.`, speakers: ['Johanna Pearce'], - videoUrl: - 'https://www.youtube.com/live/IQ5YyEYZw68?si=TQRfAG7CtNbd3Xu4&t=21381', + videoUrl: 'https://youtu.be/xc6fJpwk4Lo', }, { type: 'event', @@ -139,8 +131,7 @@ export function ConfScheduleShort(): JSX.Element { title: 'From DIY to DTE - An Enterprise Experience', description: `Nobody likes a slow CI/CD pipeline. When working in a monorepo with hundreds of projects, it can be difficult to optimize your CI/CD for performance and efficiency. Sure, you can DIY a crafty solution for it, but why DIY when you can DTE? Nx distributed task execution (DTE) is designed to fully optimize your CI/CD performance. Although configuring DTE for large monorepos can be challenging, it's not impossible. In this talk, we'll explore an enterprise experience, where we start with a DIY solution for CI/CD performance, realize its limitations, and embark on a bumpy but promising journey towards Nx DTE.`, speakers: ['Adrian Baran'], - videoUrl: - 'https://www.youtube.com/live/IQ5YyEYZw68?si=TQRfAG7CtNbd3Xu4&t=22493', + videoUrl: 'https://youtu.be/MsUN0wQHPAs', }, { type: 'event', @@ -150,8 +141,7 @@ export function ConfScheduleShort(): JSX.Element { This talk will take us on an epic journey with Nx and the powerful monorepo wizardry to show us how good tooling eventually defeats even the scariest of dev ops monsters.`, speakers: ['Miroslav Jonas'], - videoUrl: - 'https://www.youtube.com/live/IQ5YyEYZw68?si=TQRfAG7CtNbd3Xu4&t=23948', + videoUrl: 'https://youtu.be/jGF8vo2ChfI', }, { type: 'break', @@ -167,8 +157,7 @@ export function ConfScheduleShort(): JSX.Element { title: 'Optimizing your OSS infrastructure with Nx Plugins', description: `When building and maintaining open source projects, offloading maintenance is vital to continue working on the features you want to ship. Building, testing, distribution are all part of maintaining an open source project. This talk shows how to optimize your open source workflow through an Nx Plugin.`, speakers: ['Brandon Roberts'], - videoUrl: - 'https://www.youtube.com/live/IQ5YyEYZw68?si=TQRfAG7CtNbd3Xu4&t=27725', + videoUrl: 'https://youtu.be/bNuXH25CTO0', }, { type: 'event', @@ -179,7 +168,7 @@ export function ConfScheduleShort(): JSX.Element { We will dive into the key features of Nx Console and demonstrate how it enhances code generation and boosts your ability to navigate and understand complex codebases. Leverage the full potential of Nx Console in your daily development workflow! `, speakers: ['Jonathan Cammisuli', 'Max Kless'], - videoUrl: 'https://www.youtube.com/watch?v=IQ5YyEYZw68&t=9967s', + videoUrl: 'https://youtu.be/TTjVcWCdwVY', }, { type: 'event', From 2fb735d33f3f010549597b2c02e5d89842a0c185 Mon Sep 17 00:00:00 2001 From: Jason Jean Date: Fri, 13 Oct 2023 16:25:13 -0400 Subject: [PATCH 9/9] feat(core): update version of axios used (#19607) --- package.json | 2 +- packages/create-nx-workspace/package.json | 2 +- packages/nx/package.json | 2 +- packages/nx/src/nx-cloud/update-manager.ts | 14 ++++++-------- pnpm-lock.yaml | 18 +++++++++--------- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 31f72674c7ad6b..644c3a1adac30a 100644 --- a/package.json +++ b/package.json @@ -324,7 +324,7 @@ "@yarnpkg/lockfile": "^1.1.0", "@yarnpkg/parsers": "3.0.0-rc.46", "@zkochan/js-yaml": "0.0.6", - "axios": "1.0.0", + "axios": "^1.5.1", "classnames": "^2.3.1", "cliui": "^8.0.1", "core-js": "^3.6.5", diff --git a/packages/create-nx-workspace/package.json b/packages/create-nx-workspace/package.json index 4fdf734b9879df..606ef43484e883 100644 --- a/packages/create-nx-workspace/package.json +++ b/packages/create-nx-workspace/package.json @@ -36,7 +36,7 @@ "tmp": "~0.2.1", "tslib": "^2.3.0", "yargs": "^17.6.2", - "axios": "^1.0.0" + "axios": "^1.5.1" }, "publishConfig": { "access": "public" diff --git a/packages/nx/package.json b/packages/nx/package.json index 70ecf6d6aa37b4..a2d5acd0f541ad 100644 --- a/packages/nx/package.json +++ b/packages/nx/package.json @@ -37,7 +37,7 @@ "@yarnpkg/lockfile": "^1.1.0", "@yarnpkg/parsers": "3.0.0-rc.46", "@zkochan/js-yaml": "0.0.6", - "axios": "^1.0.0", + "axios": "^1.5.1", "chalk": "^4.1.0", "cli-cursor": "3.1.0", "cli-spinners": "2.6.1", diff --git a/packages/nx/src/nx-cloud/update-manager.ts b/packages/nx/src/nx-cloud/update-manager.ts index 6d8fadae9070f7..ffdf014237311c 100644 --- a/packages/nx/src/nx-cloud/update-manager.ts +++ b/packages/nx/src/nx-cloud/update-manager.ts @@ -215,14 +215,12 @@ async function verifyCurrentBundle( currentBundle: CloudBundleInstall | null ): Promise> { const contentHash = getBundleContentHash(currentBundle); - const queryParams = - currentBundle && contentHash - ? `?${new URLSearchParams({ - version: currentBundle.version, - contentHash: contentHash, - }).toString()}` - : ''; - return axios.get('/nx-cloud/client/verify' + queryParams); + return axios.get('/nx-cloud/client/verify', { + params: { + version: currentBundle.version, + contentHash: contentHash, + }, + }); } function getLatestBundleVerificationTimestamp(): number | null { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bd11267477090b..f0e34e4e1eefb4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -58,8 +58,8 @@ dependencies: specifier: 0.0.6 version: 0.0.6 axios: - specifier: 1.0.0 - version: 1.0.0 + specifier: ^1.5.1 + version: 1.5.1 classnames: specifier: ^2.3.1 version: 2.3.2 @@ -11696,24 +11696,24 @@ packages: - debug dev: true - /axios@1.0.0: - resolution: {integrity: sha512-SsHsGFN1qNPFT5QhSoSD37SHDfGyLSW5AESmyLk2JeCMHv5g0I9g0Hz/zQHx2KNe0jGXh2q2hAm7OdkXm360CA==} + /axios@1.1.3: + resolution: {integrity: sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA==} dependencies: follow-redirects: 1.15.2(debug@4.3.2) form-data: 4.0.0 proxy-from-env: 1.1.0 transitivePeerDependencies: - debug + dev: true - /axios@1.1.3: - resolution: {integrity: sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA==} + /axios@1.5.1: + resolution: {integrity: sha512-Q28iYCWzNHjAm+yEAot5QaAMxhMghWLFVf7rRdwhUI+c2jix2DUXjAHXVi+s1ibs3mjPO/cCgbA++3BjD0vP/A==} dependencies: follow-redirects: 1.15.2(debug@4.3.2) form-data: 4.0.0 proxy-from-env: 1.1.0 transitivePeerDependencies: - debug - dev: true /axobject-query@2.2.0: resolution: {integrity: sha512-Td525n+iPOOyUQIeBfcASuG6uJsDOITl7Mds5gFyerkWiX7qhUTdYUBlSgNMyVqtSJqwpt1kXGLdUt6SykLMRA==} @@ -20836,7 +20836,7 @@ packages: '@yarnpkg/lockfile': 1.1.0 '@yarnpkg/parsers': 3.0.0-rc.46 '@zkochan/js-yaml': 0.0.6 - axios: 1.0.0 + axios: 1.5.1 chalk: 4.1.2 cli-cursor: 3.1.0 cli-spinners: 2.6.1 @@ -20899,7 +20899,7 @@ packages: '@yarnpkg/lockfile': 1.1.0 '@yarnpkg/parsers': 3.0.0-rc.46 '@zkochan/js-yaml': 0.0.6 - axios: 1.0.0 + axios: 1.5.1 chalk: 4.1.2 cli-cursor: 3.1.0 cli-spinners: 2.6.1