diff --git a/docs/generated/packages/angular/generators/library.json b/docs/generated/packages/angular/generators/library.json index 003c2cba87..18cf21eb42 100644 --- a/docs/generated/packages/angular/generators/library.json +++ b/docs/generated/packages/angular/generators/library.json @@ -47,7 +47,8 @@ "simpleName": { "description": "Don't include the directory in the name of the module or standalone component entry of the library.", "type": "boolean", - "default": false + "default": false, + "x-deprecated": "Use the --name option to provide the exact name instead. This option will be removed in Nx 22." }, "addModuleSpec": { "description": "Add a module spec file.", diff --git a/docs/generated/packages/js/generators/library.json b/docs/generated/packages/js/generators/library.json index 1f15de9846..75cc00ac2c 100644 --- a/docs/generated/packages/js/generators/library.json +++ b/docs/generated/packages/js/generators/library.json @@ -130,7 +130,8 @@ "simpleName": { "description": "Don't include the directory in the generated file name.", "type": "boolean", - "default": false + "default": false, + "x-deprecated": "Use the --name option to provide the exact name instead. This option will be removed in Nx 22." }, "useProjectJson": { "type": "boolean", diff --git a/docs/generated/packages/nest/generators/library.json b/docs/generated/packages/nest/generators/library.json index 3e60336887..bff889b650 100644 --- a/docs/generated/packages/nest/generators/library.json +++ b/docs/generated/packages/nest/generators/library.json @@ -132,7 +132,8 @@ "simpleName": { "description": "Don't include the directory in the name of the module of the library.", "type": "boolean", - "default": false + "default": false, + "x-deprecated": "Use the --name option to provide the exact name instead. This option will be removed in Nx 22." }, "useProjectJson": { "type": "boolean", diff --git a/docs/generated/packages/react/generators/library.json b/docs/generated/packages/react/generators/library.json index 0bd0ea4e5d..d74531b1fd 100644 --- a/docs/generated/packages/react/generators/library.json +++ b/docs/generated/packages/react/generators/library.json @@ -183,7 +183,8 @@ "simpleName": { "description": "Don't include the directory in the name of the module of the library.", "type": "boolean", - "default": false + "default": false, + "x-deprecated": "Use the --name option to provide the exact name instead. This option will be removed in Nx 22." }, "useProjectJson": { "type": "boolean", diff --git a/packages/angular/src/generators/library/library.ts b/packages/angular/src/generators/library/library.ts index 95597c824a..ec0f960675 100644 --- a/packages/angular/src/generators/library/library.ts +++ b/packages/angular/src/generators/library/library.ts @@ -3,6 +3,7 @@ import { formatFiles, GeneratorCallback, installPackagesTask, + logger, runTasksInSerial, Tree, } from '@nx/devkit'; @@ -47,6 +48,13 @@ export async function libraryGenerator( ); } + if (schema.simpleName !== undefined && schema.simpleName !== false) { + // TODO(v22): Remove simpleName as user should be using name. + logger.warn( + `The "--simpleName" option is deprecated and will be removed in Nx 22. Please use the "--name" option to provide the exact name you want for the library.` + ); + } + if (schema.addTailwind && !schema.buildable && !schema.publishable) { throw new Error( `To use "--addTailwind" option, you have to set either "--buildable" or "--publishable".` diff --git a/packages/angular/src/generators/library/schema.json b/packages/angular/src/generators/library/schema.json index 1a3fc4a809..66fe7918f6 100644 --- a/packages/angular/src/generators/library/schema.json +++ b/packages/angular/src/generators/library/schema.json @@ -47,7 +47,8 @@ "simpleName": { "description": "Don't include the directory in the name of the module or standalone component entry of the library.", "type": "boolean", - "default": false + "default": false, + "x-deprecated": "Use the --name option to provide the exact name instead. This option will be removed in Nx 22." }, "addModuleSpec": { "description": "Add a module spec file.", diff --git a/packages/js/src/generators/library/library.ts b/packages/js/src/generators/library/library.ts index afc2782508..74d592a311 100644 --- a/packages/js/src/generators/library/library.ts +++ b/packages/js/src/generators/library/library.ts @@ -7,6 +7,7 @@ import { GeneratorCallback, installPackagesTask, joinPathFragments, + logger, names, offsetFromRoot, ProjectConfiguration, @@ -102,6 +103,13 @@ export async function libraryGeneratorInternal( ); const options = await normalizeOptions(tree, schema); + if (schema.simpleName !== undefined && schema.simpleName !== false) { + // TODO(v22): Remove simpleName as user should be using name. + logger.warn( + `The "--simpleName" option is deprecated and will be removed in Nx 22. Please use the "--name" option to provide the exact name you want for the library.` + ); + } + createFiles(tree, options); await configureProject(tree, options); diff --git a/packages/js/src/generators/library/schema.json b/packages/js/src/generators/library/schema.json index f7242d1e7c..5ca5f820e1 100644 --- a/packages/js/src/generators/library/schema.json +++ b/packages/js/src/generators/library/schema.json @@ -130,7 +130,8 @@ "simpleName": { "description": "Don't include the directory in the generated file name.", "type": "boolean", - "default": false + "default": false, + "x-deprecated": "Use the --name option to provide the exact name instead. This option will be removed in Nx 22." }, "useProjectJson": { "type": "boolean", diff --git a/packages/nest/src/generators/library/library.ts b/packages/nest/src/generators/library/library.ts index 4d2be70f91..4ab7fdec07 100644 --- a/packages/nest/src/generators/library/library.ts +++ b/packages/nest/src/generators/library/library.ts @@ -2,6 +2,7 @@ import type { GeneratorCallback, Tree } from '@nx/devkit'; import { formatFiles, joinPathFragments, + logger, readJson, runTasksInSerial, writeJson, @@ -37,6 +38,14 @@ export async function libraryGeneratorInternal( rawOptions: LibraryGeneratorOptions ): Promise { const options = await normalizeOptions(tree, rawOptions); + + if (rawOptions.simpleName !== undefined && rawOptions.simpleName !== false) { + // TODO(v22): Remove simpleName as user should be using name. + logger.warn( + `The "--simpleName" option is deprecated and will be removed in Nx 22. Please use the "--name" option to provide the exact name you want for the library.` + ); + } + const jsLibraryTask = await jsLibraryGenerator( tree, toJsLibraryGeneratorOptions(options) diff --git a/packages/nest/src/generators/library/schema.json b/packages/nest/src/generators/library/schema.json index 46cd20eb76..5093cf38aa 100644 --- a/packages/nest/src/generators/library/schema.json +++ b/packages/nest/src/generators/library/schema.json @@ -132,7 +132,8 @@ "simpleName": { "description": "Don't include the directory in the name of the module of the library.", "type": "boolean", - "default": false + "default": false, + "x-deprecated": "Use the --name option to provide the exact name instead. This option will be removed in Nx 22." }, "useProjectJson": { "type": "boolean", diff --git a/packages/react/src/generators/library/library.ts b/packages/react/src/generators/library/library.ts index f0168729b9..191fd52728 100644 --- a/packages/react/src/generators/library/library.ts +++ b/packages/react/src/generators/library/library.ts @@ -5,6 +5,7 @@ import { GeneratorCallback, installPackagesTask, joinPathFragments, + logger, readNxJson, readProjectConfiguration, runTasksInSerial, @@ -73,6 +74,14 @@ export async function libraryGeneratorInternal(host: Tree, schema: Schema) { `For publishable libs you have to provide a proper "--importPath" which needs to be a valid npm package name (e.g. my-awesome-lib or @myorg/my-lib)` ); } + + if (schema.simpleName !== undefined && schema.simpleName !== false) { + // TODO(v22): Remove simpleName as user should be using name. + logger.warn( + `The "--simpleName" option is deprecated and will be removed in Nx 22. Please use the "--name" option to provide the exact name you want for the library.` + ); + } + if (!options.component) { options.style = 'none'; } diff --git a/packages/react/src/generators/library/schema.json b/packages/react/src/generators/library/schema.json index 40ff84a432..9eb9076828 100644 --- a/packages/react/src/generators/library/schema.json +++ b/packages/react/src/generators/library/schema.json @@ -189,7 +189,8 @@ "simpleName": { "description": "Don't include the directory in the name of the module of the library.", "type": "boolean", - "default": false + "default": false, + "x-deprecated": "Use the --name option to provide the exact name instead. This option will be removed in Nx 22." }, "useProjectJson": { "type": "boolean",