@nx/angular 20.0.0-beta.5 → 20.0.0-beta.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/executors.d.ts +1 -6
  2. package/executors.js +2 -3
  3. package/migrations.json +0 -981
  4. package/package.json +8 -8
  5. package/src/builders/utilities/webpack.js +3 -3
  6. package/src/generators/application/application.js +3 -1
  7. package/src/generators/application/lib/normalize-options.js +3 -4
  8. package/src/generators/application/schema.d.ts +2 -4
  9. package/src/generators/application/schema.json +7 -12
  10. package/src/generators/component/lib/normalize-options.js +1 -2
  11. package/src/generators/component/schema.d.ts +2 -5
  12. package/src/generators/component/schema.json +7 -13
  13. package/src/generators/directive/lib/normalize-options.js +1 -2
  14. package/src/generators/directive/schema.d.ts +2 -3
  15. package/src/generators/directive/schema.json +8 -14
  16. package/src/generators/federate-module/lib/add-remote.js +0 -2
  17. package/src/generators/federate-module/schema.d.ts +0 -2
  18. package/src/generators/federate-module/schema.json +0 -5
  19. package/src/generators/host/host.js +6 -5
  20. package/src/generators/host/schema.d.ts +2 -4
  21. package/src/generators/host/schema.json +10 -13
  22. package/src/generators/init/init.js +3 -1
  23. package/src/generators/library/lib/add-standalone-component.js +3 -2
  24. package/src/generators/library/lib/normalize-options.js +1 -1
  25. package/src/generators/library/lib/normalized-schema.d.ts +2 -2
  26. package/src/generators/library/library.js +2 -0
  27. package/src/generators/library/schema.d.ts +2 -4
  28. package/src/generators/library/schema.json +7 -13
  29. package/src/generators/move/schema.d.ts +0 -3
  30. package/src/generators/move/schema.json +0 -5
  31. package/src/generators/pipe/lib/normalize-options.js +1 -2
  32. package/src/generators/pipe/schema.d.ts +2 -3
  33. package/src/generators/pipe/schema.json +7 -22
  34. package/src/generators/remote/remote.js +6 -5
  35. package/src/generators/remote/schema.d.ts +2 -4
  36. package/src/generators/remote/schema.json +10 -13
  37. package/src/generators/scam/lib/normalize-options.js +1 -2
  38. package/src/generators/scam/scam.js +0 -2
  39. package/src/generators/scam/schema.d.ts +3 -3
  40. package/src/generators/scam/schema.json +8 -23
  41. package/src/generators/scam-directive/lib/normalize-options.js +1 -2
  42. package/src/generators/scam-directive/scam-directive.js +0 -2
  43. package/src/generators/scam-directive/schema.d.ts +3 -3
  44. package/src/generators/scam-directive/schema.json +8 -3
  45. package/src/generators/scam-pipe/lib/normalize-options.js +1 -2
  46. package/src/generators/scam-pipe/scam-pipe.js +0 -2
  47. package/src/generators/scam-pipe/schema.d.ts +3 -3
  48. package/src/generators/scam-pipe/schema.json +8 -23
  49. package/src/generators/utils/testing.js +14 -17
  50. package/src/utils/mf/with-module-federation-ssr.js +1 -1
  51. package/src/utils/mf/with-module-federation.js +1 -1
  52. package/src/utils/versions.d.ts +1 -1
  53. package/src/utils/versions.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "20.0.0-beta.5",
3
+ "version": "20.0.0-beta.7",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Playwright and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -79,13 +79,13 @@
79
79
  "tslib": "^2.3.0",
80
80
  "webpack-merge": "^5.8.0",
81
81
  "webpack": "^5.88.0",
82
- "@module-federation/enhanced": "~0.6.0",
83
- "@nx/devkit": "20.0.0-beta.5",
84
- "@nx/js": "20.0.0-beta.5",
85
- "@nx/eslint": "20.0.0-beta.5",
86
- "@nx/webpack": "20.0.0-beta.5",
87
- "@nx/web": "20.0.0-beta.5",
88
- "@nx/workspace": "20.0.0-beta.5",
82
+ "@module-federation/enhanced": "0.6.6",
83
+ "@nx/devkit": "20.0.0-beta.7",
84
+ "@nx/js": "20.0.0-beta.7",
85
+ "@nx/eslint": "20.0.0-beta.7",
86
+ "@nx/webpack": "20.0.0-beta.7",
87
+ "@nx/web": "20.0.0-beta.7",
88
+ "@nx/workspace": "20.0.0-beta.7",
89
89
  "piscina": "^4.4.0"
90
90
  },
91
91
  "peerDependencies": {
@@ -16,11 +16,11 @@ async function mergeCustomWebpackConfig(baseWebpackConfig, pathToWebpackConfig,
16
16
  // `module.exports = new Promise(...)`. If it exports a single object, but not a Promise,
17
17
  // then await will just resolve that object.
18
18
  const config = await customWebpackConfiguration;
19
- // The extra Webpack configuration file can export a synchronous or asynchronous function,
20
- // for instance: `module.exports = async config => { ... }`.
21
19
  let newConfig;
22
20
  if (typeof config === 'function') {
23
- newConfig = config(baseWebpackConfig, options, target);
21
+ // The extra Webpack configuration file can export a synchronous or asynchronous function,
22
+ // for instance: `module.exports = async config => { ... }`.
23
+ newConfig = await config(baseWebpackConfig, options, target);
24
24
  }
25
25
  else {
26
26
  newConfig = (0, webpack_merge_1.merge)(baseWebpackConfig, config);
@@ -2,14 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.applicationGenerator = applicationGenerator;
4
4
  const devkit_1 = require("@nx/devkit");
5
+ const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
5
6
  const js_1 = require("@nx/js");
7
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
6
8
  const init_1 = require("../init/init");
7
9
  const setup_ssr_1 = require("../setup-ssr/setup-ssr");
8
10
  const setup_tailwind_1 = require("../setup-tailwind/setup-tailwind");
9
11
  const ensure_angular_dependencies_1 = require("../utils/ensure-angular-dependencies");
10
12
  const lib_1 = require("./lib");
11
- const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
12
13
  async function applicationGenerator(tree, schema) {
14
+ (0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'angular', 'application');
13
15
  const options = await (0, lib_1.normalizeOptions)(tree, schema);
14
16
  const rootOffset = (0, devkit_1.offsetFromRoot)(options.appProjectRoot);
15
17
  await (0, js_1.initGenerator)(tree, {
@@ -7,16 +7,14 @@ const eslint_1 = require("@nx/eslint");
7
7
  const test_runners_1 = require("../../../utils/test-runners");
8
8
  const version_utils_1 = require("../../utils/version-utils");
9
9
  async function normalizeOptions(host, options) {
10
- const { projectName: appProjectName, projectRoot: appProjectRoot, projectNameAndRootFormat, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
10
+ await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'application');
11
+ const { projectName: appProjectName, projectRoot: appProjectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
11
12
  name: options.name,
12
13
  projectType: 'application',
13
14
  directory: options.directory,
14
- projectNameAndRootFormat: options.projectNameAndRootFormat,
15
15
  rootProject: options.rootProject,
16
16
  });
17
17
  options.rootProject = appProjectRoot === '.';
18
- options.projectNameAndRootFormat = projectNameAndRootFormat;
19
- const nxJson = (0, devkit_1.readNxJson)(host);
20
18
  const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`;
21
19
  const e2eProjectRoot = options.rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
22
20
  const parsedTags = options.tags
@@ -40,6 +38,7 @@ async function normalizeOptions(host, options) {
40
38
  linter: eslint_1.Linter.EsLint,
41
39
  strict: true,
42
40
  standalone: true,
41
+ directory: appProjectRoot,
43
42
  ...options,
44
43
  prefix: options.prefix || 'app',
45
44
  name: appProjectName,
@@ -1,10 +1,10 @@
1
- import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
2
1
  import type { Linter, LinterType } from '@nx/eslint';
3
2
  import type { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners';
4
3
  import type { Styles } from '../utils/types';
5
4
 
6
5
  export interface Schema {
7
- name: string;
6
+ directory: string;
7
+ name?: string;
8
8
  addTailwind?: boolean;
9
9
  skipFormat?: boolean;
10
10
  inlineStyle?: boolean;
@@ -14,8 +14,6 @@ export interface Schema {
14
14
  prefix?: string;
15
15
  style?: Styles;
16
16
  skipTests?: boolean;
17
- directory?: string;
18
- projectNameAndRootFormat?: ProjectNameAndRootFormat;
19
17
  tags?: string;
20
18
  linter?: Linter | LinterType;
21
19
  unitTestRunner?: UnitTestRunner;
@@ -6,26 +6,21 @@
6
6
  "type": "object",
7
7
  "cli": "nx",
8
8
  "properties": {
9
- "name": {
10
- "description": "The name of the application.",
9
+ "directory": {
10
+ "description": "The directory of the new application.",
11
11
  "type": "string",
12
12
  "$default": {
13
13
  "$source": "argv",
14
14
  "index": 0
15
15
  },
16
- "x-prompt": "What name would you like to use for the application?",
17
- "pattern": "^[a-zA-Z][^:]*$"
16
+ "x-prompt": "Which directory do you want to create the application in?"
18
17
  },
19
- "directory": {
20
- "description": "The directory of the new application.",
18
+ "name": {
19
+ "description": "The name of the application.",
21
20
  "type": "string",
21
+ "pattern": "^[a-zA-Z][^:]*$",
22
22
  "x-priority": "important"
23
23
  },
24
- "projectNameAndRootFormat": {
25
- "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
26
- "type": "string",
27
- "enum": ["as-provided", "derived"]
28
- },
29
24
  "style": {
30
25
  "description": "The file extension to be used for style files.",
31
26
  "type": "string",
@@ -187,6 +182,6 @@
187
182
  }
188
183
  },
189
184
  "additionalProperties": false,
190
- "required": ["name"],
185
+ "required": ["directory"],
191
186
  "examplesFile": "../../../docs/application-examples.md"
192
187
  }
@@ -8,8 +8,7 @@ async function normalizeOptions(tree, options) {
8
8
  options.type ??= 'component';
9
9
  const { artifactName: name, directory, fileName, filePath, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
10
10
  name: options.name,
11
- directory: options.directory,
12
- nameAndDirectoryFormat: options.nameAndDirectoryFormat,
11
+ path: options.path,
13
12
  suffix: options.type ?? 'component',
14
13
  });
15
14
  const { className } = (0, devkit_1.names)(name);
@@ -1,9 +1,6 @@
1
- import type { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
2
-
3
1
  export interface Schema {
4
- name: string;
5
- directory?: string;
6
- nameAndDirectoryFormat?: NameAndDirectoryFormat;
2
+ path: string;
3
+ name?: string;
7
4
  displayBlock?: boolean;
8
5
  inlineStyle?: boolean;
9
6
  inlineTemplate?: boolean;
@@ -7,25 +7,19 @@
7
7
  "description": "Creates a new Angular component.",
8
8
  "additionalProperties": false,
9
9
  "properties": {
10
- "name": {
10
+ "path": {
11
11
  "type": "string",
12
- "description": "The name of the component.",
12
+ "description": "The path at which to create the component file, relative to the workspace root. By default, it is set to the root of the project.",
13
13
  "$default": {
14
14
  "$source": "argv",
15
15
  "index": 0
16
16
  },
17
- "x-prompt": "What name would you like to use for the component?"
17
+ "x-prompt": "Where to create the component?"
18
18
  },
19
- "directory": {
20
- "type": "string",
21
- "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.",
22
- "aliases": ["dir", "path"],
23
- "x-priority": "important"
24
- },
25
- "nameAndDirectoryFormat": {
26
- "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`).",
19
+ "name": {
27
20
  "type": "string",
28
- "enum": ["as-provided", "derived"]
21
+ "description": "The name of the component.",
22
+ "x-prompt": "What name would you like to use for the component?"
29
23
  },
30
24
  "prefix": {
31
25
  "type": "string",
@@ -118,6 +112,6 @@
118
112
  "x-priority": "internal"
119
113
  }
120
114
  },
121
- "required": ["name"],
115
+ "required": ["path"],
122
116
  "examplesFile": "../../../docs/component-examples.md"
123
117
  }
@@ -7,8 +7,7 @@ const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/a
7
7
  async function normalizeOptions(tree, options) {
8
8
  const { artifactName: name, directory, fileName, filePath, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
9
9
  name: options.name,
10
- directory: options.directory,
11
- nameAndDirectoryFormat: options.nameAndDirectoryFormat,
10
+ path: options.path,
12
11
  suffix: 'directive',
13
12
  });
14
13
  const { className } = (0, devkit_1.names)(name);
@@ -1,9 +1,8 @@
1
1
  import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
2
2
 
3
3
  export interface Schema {
4
- name: string;
5
- directory?: string;
6
- nameAndDirectoryFormat?: NameAndDirectoryFormat;
4
+ path: string;
5
+ name?: string;
7
6
  prefix?: string;
8
7
  skipTests?: boolean;
9
8
  skipImport?: boolean;
@@ -7,25 +7,19 @@
7
7
  "description": "Creates a new Angular directive.",
8
8
  "additionalProperties": false,
9
9
  "properties": {
10
- "name": {
10
+ "path": {
11
11
  "type": "string",
12
- "description": "The name of the new directive.",
12
+ "description": "The path at which to create the directive file.",
13
+ "x-prompt": "Where to put the directive?",
13
14
  "$default": {
14
15
  "$source": "argv",
15
16
  "index": 0
16
- },
17
- "x-prompt": "What name would you like to use for the directive?"
18
- },
19
- "directory": {
20
- "type": "string",
21
- "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.",
22
- "aliases": ["dir", "path"],
23
- "x-priority": "important"
17
+ }
24
18
  },
25
- "nameAndDirectoryFormat": {
26
- "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`).",
19
+ "name": {
27
20
  "type": "string",
28
- "enum": ["as-provided", "derived"]
21
+ "description": "The name of the new directive.",
22
+ "x-prompt": "What name would you like to use for the directive?"
29
23
  },
30
24
  "prefix": {
31
25
  "type": "string",
@@ -77,5 +71,5 @@
77
71
  "description": "Skip formatting of files."
78
72
  }
79
73
  },
80
- "required": ["name"]
74
+ "required": ["path"]
81
75
  }
@@ -16,7 +16,6 @@ async function addRemote(tree, schema) {
16
16
  directory: schema.remoteDirectory,
17
17
  host: schema.host,
18
18
  standalone: schema.standalone,
19
- projectNameAndRootFormat: schema.projectNameAndRootFormat,
20
19
  unitTestRunner: schema.unitTestRunner ?? test_runners_1.UnitTestRunner.Jest,
21
20
  e2eTestRunner: schema.e2eTestRunner ?? test_runners_1.E2eTestRunner.Cypress,
22
21
  skipFormat: true,
@@ -26,7 +25,6 @@ async function addRemote(tree, schema) {
26
25
  name: schema.remote,
27
26
  directory: schema.remoteDirectory,
28
27
  projectType: 'application',
29
- projectNameAndRootFormat: schema.projectNameAndRootFormat,
30
28
  });
31
29
  projectRoot = remoteRoot;
32
30
  remoteName = projectName;
@@ -1,4 +1,3 @@
1
- import { type ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
2
1
  import { UnitTestRunner, E2eTestRunner } from '../utils/testing';
3
2
 
4
3
  export interface Schema {
@@ -7,7 +6,6 @@ export interface Schema {
7
6
  remote: string;
8
7
  remoteDirectory?: string;
9
8
  host?: string;
10
- projectNameAndRootFormat?: ProjectNameAndRootFormat;
11
9
  unitTestRunner?: UnitTestRunner;
12
10
  e2eTestRunner?: E2eTestRunner;
13
11
  standalone?: boolean;
@@ -37,11 +37,6 @@
37
37
  "description": "The directory of the new remote application if one needs to be created.",
38
38
  "type": "string"
39
39
  },
40
- "projectNameAndRootFormat": {
41
- "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
42
- "type": "string",
43
- "enum": ["as-provided", "derived"]
44
- },
45
40
  "style": {
46
41
  "description": "The file extension to be used for style files for the remote if one needs to be created.",
47
42
  "type": "string",
@@ -4,14 +4,16 @@ exports.host = host;
4
4
  const tslib_1 = require("tslib");
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
7
+ const js_1 = require("@nx/js");
8
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
7
9
  const test_runners_1 = require("../../utils/test-runners");
8
10
  const application_1 = tslib_1.__importDefault(require("../application/application"));
9
11
  const remote_1 = tslib_1.__importDefault(require("../remote/remote"));
10
12
  const setup_mf_1 = require("../setup-mf/setup-mf");
11
- const lib_1 = require("./lib");
12
13
  const add_mf_env_to_inputs_1 = require("../utils/add-mf-env-to-inputs");
13
- const js_1 = require("@nx/js");
14
+ const lib_1 = require("./lib");
14
15
  async function host(tree, schema) {
16
+ (0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'angular', 'host');
15
17
  const { typescriptConfiguration = true, ...options } = schema;
16
18
  options.standalone = options.standalone ?? true;
17
19
  const projects = (0, devkit_1.getProjects)(tree);
@@ -37,13 +39,12 @@ async function host(tree, schema) {
37
39
  }
38
40
  });
39
41
  }
40
- const { projectName: hostProjectName, projectNameAndRootFormat, projectRoot: appRoot, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
42
+ await (0, project_name_and_root_utils_1.ensureProjectName)(tree, options, 'application');
43
+ const { projectName: hostProjectName, projectRoot: appRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
41
44
  name: options.name,
42
45
  projectType: 'application',
43
46
  directory: options.directory,
44
- projectNameAndRootFormat: options.projectNameAndRootFormat,
45
47
  });
46
- options.projectNameAndRootFormat = projectNameAndRootFormat;
47
48
  const appInstallTask = await (0, application_1.default)(tree, {
48
49
  ...options,
49
50
  standalone: options.standalone,
@@ -1,10 +1,10 @@
1
- import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
2
1
  import type { Linter, LinterType } from '@nx/eslint';
3
2
  import type { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners';
4
3
  import type { Styles } from '../utils/types';
5
4
 
6
5
  export interface Schema {
7
- name: string;
6
+ directory: string;
7
+ name?: string;
8
8
  remotes?: string[];
9
9
  dynamic?: boolean;
10
10
  setParserOptionsProject?: boolean;
@@ -14,8 +14,6 @@ export interface Schema {
14
14
  prefix?: string;
15
15
  style?: Styles;
16
16
  skipTests?: boolean;
17
- directory?: string;
18
- projectNameAndRootFormat?: ProjectNameAndRootFormat;
19
17
  tags?: string;
20
18
  linter?: Linter | LinterType;
21
19
  unitTestRunner?: UnitTestRunner;
@@ -12,14 +12,20 @@
12
12
  }
13
13
  ],
14
14
  "properties": {
15
- "name": {
15
+ "directory": {
16
+ "description": "The directory of the new application.",
16
17
  "type": "string",
17
- "description": "The name to give to the host Angular application.",
18
18
  "$default": {
19
19
  "$source": "argv",
20
20
  "index": 0
21
21
  },
22
- "pattern": "^[a-zA-Z][^:]*$"
22
+ "x-prompt": "Which directory do you want to create the application in?"
23
+ },
24
+ "name": {
25
+ "type": "string",
26
+ "description": "The name to give to the host Angular application.",
27
+ "pattern": "^[a-zA-Z][^:]*$",
28
+ "x-priority": "important"
23
29
  },
24
30
  "remotes": {
25
31
  "type": "array",
@@ -31,15 +37,6 @@
31
37
  "description": "Should the host application use dynamic federation?",
32
38
  "default": false
33
39
  },
34
- "directory": {
35
- "description": "The directory of the new application.",
36
- "type": "string"
37
- },
38
- "projectNameAndRootFormat": {
39
- "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
40
- "type": "string",
41
- "enum": ["as-provided", "derived"]
42
- },
43
40
  "style": {
44
41
  "description": "The file extension to be used for style files.",
45
42
  "type": "string",
@@ -181,5 +178,5 @@
181
178
  }
182
179
  },
183
180
  "additionalProperties": false,
184
- "required": ["name"]
181
+ "required": ["directory"]
185
182
  }
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.angularInitGenerator = angularInitGenerator;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
6
- const version_utils_1 = require("../utils/version-utils");
6
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
7
7
  const plugin_1 = require("../../plugins/plugin");
8
+ const version_utils_1 = require("../utils/version-utils");
8
9
  async function angularInitGenerator(tree, options) {
10
+ (0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'angular', 'init');
9
11
  ignoreAngularCacheDirectory(tree);
10
12
  const installTask = installAngularDevkitCoreIfMissing(tree, options);
11
13
  // For Angular inference plugin, we only want it during import since our
@@ -9,8 +9,9 @@ async function addStandaloneComponent(tree, { libraryOptions, componentOptions }
9
9
  await (0, component_1.componentGenerator)(tree, {
10
10
  ...componentOptions,
11
11
  name: componentOptions.name,
12
- directory: (0, devkit_1.joinPathFragments)(libraryOptions.projectRoot, 'src', 'lib', componentOptions.flat ? '' : componentOptions.name),
13
- nameAndDirectoryFormat: 'as-provided',
12
+ path: (0, devkit_1.joinPathFragments)(libraryOptions.projectRoot, 'src', 'lib', componentOptions.flat
13
+ ? `${componentOptions.name}`
14
+ : `${componentOptions.name}/${componentOptions.name}`),
14
15
  standalone: true,
15
16
  export: true,
16
17
  skipFormat: true,
@@ -22,12 +22,12 @@ async function normalizeOptions(host, schema) {
22
22
  skipModule: schema.skipModule || schema.standalone,
23
23
  ...schema,
24
24
  };
25
+ await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'library');
25
26
  const { projectName, names: projectNames, projectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
26
27
  name: options.name,
27
28
  projectType: 'library',
28
29
  directory: options.directory,
29
30
  importPath: options.importPath,
30
- projectNameAndRootFormat: options.projectNameAndRootFormat,
31
31
  });
32
32
  const fileName = options.simpleName
33
33
  ? projectNames.projectSimpleName
@@ -2,12 +2,12 @@ import { UnitTestRunner } from '../../../utils/test-runners';
2
2
  import type { Linter, LinterType } from '@nx/eslint';
3
3
  export interface NormalizedSchema {
4
4
  libraryOptions: {
5
- name: string;
5
+ directory: string;
6
+ name?: string;
6
7
  addTailwind?: boolean;
7
8
  skipFormat?: boolean;
8
9
  simpleName?: boolean;
9
10
  addModuleSpec?: boolean;
10
- directory?: string;
11
11
  sourceDir?: string;
12
12
  buildable?: boolean;
13
13
  publishable?: boolean;
@@ -22,7 +22,9 @@ const add_jest_1 = require("../utils/add-jest");
22
22
  const set_generator_defaults_1 = require("./lib/set-generator-defaults");
23
23
  const ensure_angular_dependencies_1 = require("../utils/ensure-angular-dependencies");
24
24
  const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
25
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
25
26
  async function libraryGenerator(tree, schema) {
27
+ (0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'angular', 'library');
26
28
  // Do some validation checks
27
29
  if (!schema.routing && schema.lazy) {
28
30
  throw new Error(`To use "--lazy" option, "--routing" must also be set.`);
@@ -1,15 +1,13 @@
1
- import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
2
1
  import type { Linter, LinterType } from '@nx/eslint';
3
2
  import type { UnitTestRunner } from '../../utils/test-runners';
4
3
 
5
4
  export interface Schema {
6
- name: string;
5
+ directory: string;
6
+ name?: string;
7
7
  addTailwind?: boolean;
8
8
  skipFormat?: boolean;
9
9
  simpleName?: boolean;
10
10
  addModuleSpec?: boolean;
11
- directory?: string;
12
- projectNameAndRootFormat?: ProjectNameAndRootFormat;
13
11
  sourceDir?: string;
14
12
  buildable?: boolean;
15
13
  publishable?: boolean;
@@ -9,22 +9,16 @@
9
9
  "name": {
10
10
  "type": "string",
11
11
  "description": "The name of the library.",
12
- "$default": {
13
- "$source": "argv",
14
- "index": 0
15
- },
16
- "x-prompt": "What name would you like to use for the library?",
17
- "pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$"
12
+ "x-priority": "important"
18
13
  },
19
14
  "directory": {
20
15
  "type": "string",
21
16
  "description": "A directory where the library is placed.",
22
- "x-priority": "important"
23
- },
24
- "projectNameAndRootFormat": {
25
- "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
26
- "type": "string",
27
- "enum": ["as-provided", "derived"]
17
+ "$default": {
18
+ "$source": "argv",
19
+ "index": 0
20
+ },
21
+ "x-prompt": "Which directory do you want to create the library in?"
28
22
  },
29
23
  "publishable": {
30
24
  "type": "boolean",
@@ -203,6 +197,6 @@
203
197
  }
204
198
  },
205
199
  "additionalProperties": false,
206
- "required": ["name"],
200
+ "required": ["directory"],
207
201
  "examplesFile": "../../../docs/library-examples.md"
208
202
  }
@@ -1,5 +1,3 @@
1
- import { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
2
-
3
1
  export interface Schema {
4
2
  projectName: string;
5
3
  destination: string;
@@ -7,5 +5,4 @@ export interface Schema {
7
5
  importPath?: string;
8
6
  skipFormat?: boolean;
9
7
  newProjectName?: string;
10
- projectNameAndRootFormat?: ProjectNameAndRootFormat;
11
8
  }
@@ -35,11 +35,6 @@
35
35
  },
36
36
  "x-priority": "important"
37
37
  },
38
- "projectNameAndRootFormat": {
39
- "description": "Whether to generate the new project name and destination as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
40
- "type": "string",
41
- "enum": ["as-provided", "derived"]
42
- },
43
38
  "importPath": {
44
39
  "type": "string",
45
40
  "description": "The new import path to use in the `tsconfig.base.json`."
@@ -6,8 +6,7 @@ const devkit_1 = require("@nx/devkit");
6
6
  async function normalizeOptions(tree, options) {
7
7
  const { artifactName: name, directory, fileName, filePath, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
8
8
  name: options.name,
9
- directory: options.directory,
10
- nameAndDirectoryFormat: options.nameAndDirectoryFormat,
9
+ path: options.path,
11
10
  suffix: 'pipe',
12
11
  });
13
12
  const { className } = (0, devkit_1.names)(name);
@@ -1,9 +1,8 @@
1
1
  import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
2
2
 
3
3
  export interface Schema {
4
- name: string;
5
- directory?: string;
6
- nameAndDirectoryFormat?: NameAndDirectoryFormat;
4
+ path: string;
5
+ name?: string;
7
6
  skipTests?: boolean;
8
7
  skipImport?: boolean;
9
8
  standalone?: boolean;