@nx/angular 0.0.0-pr-27957-a99d5ea → 0.0.0-pr-28218-5048fd1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/generators.d.ts +0 -1
  2. package/generators.js +0 -1
  3. package/generators.json +7 -13
  4. package/package.json +11 -11
  5. package/plugin.d.ts +1 -0
  6. package/plugin.js +5 -0
  7. package/src/builders/utilities/webpack.js +28 -2
  8. package/src/generators/application/application.d.ts +0 -1
  9. package/src/generators/application/application.js +0 -7
  10. package/src/generators/application/lib/normalize-options.js +0 -1
  11. package/src/generators/component/component.d.ts +0 -1
  12. package/src/generators/component/component.js +0 -7
  13. package/src/generators/component/lib/normalize-options.js +1 -5
  14. package/src/generators/component/schema.d.ts +0 -13
  15. package/src/generators/component/schema.json +0 -15
  16. package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts +1 -2
  17. package/src/generators/cypress-component-configuration/cypress-component-configuration.js +1 -7
  18. package/src/generators/directive/lib/normalize-options.js +1 -5
  19. package/src/generators/directive/schema.d.ts +0 -12
  20. package/src/generators/directive/schema.json +0 -15
  21. package/src/generators/federate-module/lib/add-remote.js +2 -3
  22. package/src/generators/host/host.d.ts +1 -2
  23. package/src/generators/host/host.js +7 -20
  24. package/src/generators/init/init.js +12 -0
  25. package/src/generators/init/schema.d.ts +3 -0
  26. package/src/generators/library/lib/normalize-options.js +0 -1
  27. package/src/generators/library/library.d.ts +0 -1
  28. package/src/generators/library/library.js +0 -9
  29. package/src/generators/move/move.d.ts +0 -1
  30. package/src/generators/move/move.js +1 -8
  31. package/src/generators/pipe/lib/normalize-options.js +1 -5
  32. package/src/generators/pipe/schema.d.ts +0 -12
  33. package/src/generators/pipe/schema.json +0 -6
  34. package/src/generators/remote/remote.d.ts +1 -2
  35. package/src/generators/remote/remote.js +1 -9
  36. package/src/generators/scam/lib/normalize-options.js +1 -5
  37. package/src/generators/scam/schema.d.ts +0 -12
  38. package/src/generators/scam/schema.json +0 -6
  39. package/src/generators/scam-directive/lib/normalize-options.js +1 -5
  40. package/src/generators/scam-directive/schema.d.ts +0 -12
  41. package/src/generators/scam-pipe/lib/normalize-options.js +1 -5
  42. package/src/generators/scam-pipe/schema.d.ts +0 -12
  43. package/src/generators/stories/schema.d.ts +0 -2
  44. package/src/generators/stories/schema.json +0 -10
  45. package/src/generators/stories/stories.js +0 -19
  46. package/src/generators/storybook-configuration/lib/generate-stories.js +0 -6
  47. package/src/generators/storybook-configuration/lib/generate-storybook-configuration.js +0 -2
  48. package/src/generators/storybook-configuration/schema.d.ts +0 -3
  49. package/src/generators/storybook-configuration/schema.json +0 -15
  50. package/src/generators/storybook-configuration/storybook-configuration.js +0 -3
  51. package/src/generators/utils/testing.js +11 -20
  52. package/src/plugins/plugin.d.ts +19 -0
  53. package/src/plugins/plugin.js +418 -0
  54. package/src/utils/versions.d.ts +1 -1
  55. package/src/utils/versions.js +1 -1
  56. package/src/generators/component-cypress-spec/component-cypress-spec.d.ts +0 -4
  57. package/src/generators/component-cypress-spec/component-cypress-spec.js +0 -35
  58. package/src/generators/component-cypress-spec/files/__componentFileName__.__fileExt__ +0 -17
  59. package/src/generators/component-cypress-spec/lib/get-args-default-value.d.ts +0 -2
  60. package/src/generators/component-cypress-spec/lib/get-args-default-value.js +0 -24
  61. package/src/generators/component-cypress-spec/lib/get-component-selector.d.ts +0 -2
  62. package/src/generators/component-cypress-spec/lib/get-component-selector.js +0 -23
  63. package/src/generators/component-cypress-spec/schema.d.ts +0 -10
  64. package/src/generators/component-cypress-spec/schema.json +0 -66
  65. package/src/generators/stories/lib/get-e2e-project.d.ts +0 -2
  66. package/src/generators/stories/lib/get-e2e-project.js +0 -14
  67. package/src/generators/storybook-configuration/lib/validate-options.d.ts +0 -2
  68. package/src/generators/storybook-configuration/lib/validate-options.js +0 -8
package/generators.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export * from './src/generators/add-linting/add-linting';
2
2
  export * from './src/generators/application/application';
3
- export * from './src/generators/component-cypress-spec/component-cypress-spec';
4
3
  export * from './src/generators/component-story/component-story';
5
4
  export * from './src/generators/component/component';
6
5
  export * from './src/generators/directive/directive';
package/generators.js CHANGED
@@ -4,7 +4,6 @@ exports.cypressComponentConfiguration = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  tslib_1.__exportStar(require("./src/generators/add-linting/add-linting"), exports);
6
6
  tslib_1.__exportStar(require("./src/generators/application/application"), exports);
7
- tslib_1.__exportStar(require("./src/generators/component-cypress-spec/component-cypress-spec"), exports);
8
7
  tslib_1.__exportStar(require("./src/generators/component-story/component-story"), exports);
9
8
  tslib_1.__exportStar(require("./src/generators/component/component"), exports);
10
9
  tslib_1.__exportStar(require("./src/generators/directive/directive"), exports);
package/generators.json CHANGED
@@ -10,24 +10,18 @@
10
10
  "hidden": true
11
11
  },
12
12
  "application": {
13
- "factory": "./src/generators/application/application#applicationGeneratorInternal",
13
+ "factory": "./src/generators/application/application",
14
14
  "schema": "./src/generators/application/schema.json",
15
15
  "aliases": ["app"],
16
16
  "x-type": "application",
17
17
  "description": "Creates an Angular application."
18
18
  },
19
19
  "component": {
20
- "factory": "./src/generators/component/component#componentGeneratorInternal",
20
+ "factory": "./src/generators/component/component",
21
21
  "schema": "./src/generators/component/schema.json",
22
22
  "aliases": ["c"],
23
23
  "description": "Generate an Angular Component."
24
24
  },
25
- "component-cypress-spec": {
26
- "factory": "./src/generators/component-cypress-spec/component-cypress-spec",
27
- "schema": "./src/generators/component-cypress-spec/schema.json",
28
- "description": "Creates a Cypress spec for a UI component that has a story.",
29
- "hidden": true
30
- },
31
25
  "component-story": {
32
26
  "factory": "./src/generators/component-story/component-story",
33
27
  "schema": "./src/generators/component-story/schema.json",
@@ -63,7 +57,7 @@
63
57
  "hidden": true
64
58
  },
65
59
  "library": {
66
- "factory": "./src/generators/library/library#libraryGeneratorInternal",
60
+ "factory": "./src/generators/library/library",
67
61
  "schema": "./src/generators/library/schema.json",
68
62
  "aliases": ["lib"],
69
63
  "x-type": "library",
@@ -76,13 +70,13 @@
76
70
  "description": "Creates a secondary entry point for an Angular publishable library."
77
71
  },
78
72
  "remote": {
79
- "factory": "./src/generators/remote/remote#remoteInternal",
73
+ "factory": "./src/generators/remote/remote",
80
74
  "schema": "./src/generators/remote/schema.json",
81
75
  "x-type": "application",
82
76
  "description": "Generate a Remote Angular Module Federation Application."
83
77
  },
84
78
  "move": {
85
- "factory": "./src/generators/move/move#angularMoveGeneratorInternal",
79
+ "factory": "./src/generators/move/move#angularMoveGenerator",
86
80
  "schema": "./src/generators/move/schema.json",
87
81
  "aliases": ["mv"],
88
82
  "description": "Moves an Angular application or library to another folder within the workspace and updates the project configuration.",
@@ -94,7 +88,7 @@
94
88
  "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 %}"
95
89
  },
96
90
  "host": {
97
- "factory": "./src/generators/host/host#hostInternal",
91
+ "factory": "./src/generators/host/host",
98
92
  "schema": "./src/generators/host/schema.json",
99
93
  "x-type": "application",
100
94
  "description": "Generate a Host Angular Module Federation Application."
@@ -173,7 +167,7 @@
173
167
  "description": "Adds Storybook configuration to a project."
174
168
  },
175
169
  "cypress-component-configuration": {
176
- "factory": "./src/generators/cypress-component-configuration/cypress-component-configuration#cypressComponentConfigurationInternal",
170
+ "factory": "./src/generators/cypress-component-configuration/cypress-component-configuration",
177
171
  "schema": "./src/generators/cypress-component-configuration/schema.json",
178
172
  "description": "Setup Cypress component testing for a project."
179
173
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "0.0.0-pr-27957-a99d5ea",
3
+ "version": "0.0.0-pr-28218-5048fd1",
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": {
@@ -22,6 +22,7 @@
22
22
  "./executors.json": "./executors.json",
23
23
  "./generators": "./generators.js",
24
24
  "./executors": "./executors.js",
25
+ "./plugin": "./plugin.js",
25
26
  "./tailwind": "./tailwind.js",
26
27
  "./module-federation": "./module-federation/index.js",
27
28
  "./src/utils": "./src/utils/index.js",
@@ -78,15 +79,14 @@
78
79
  "tslib": "^2.3.0",
79
80
  "webpack-merge": "^5.8.0",
80
81
  "webpack": "^5.88.0",
81
- "@module-federation/enhanced": "~0.6.0",
82
- "@nx/devkit": "0.0.0-pr-27957-a99d5ea",
83
- "@nx/js": "0.0.0-pr-27957-a99d5ea",
84
- "@nx/eslint": "0.0.0-pr-27957-a99d5ea",
85
- "@nx/webpack": "0.0.0-pr-27957-a99d5ea",
86
- "@nx/web": "0.0.0-pr-27957-a99d5ea",
87
- "@nx/workspace": "0.0.0-pr-27957-a99d5ea",
88
- "piscina": "^4.4.0",
89
- "@nrwl/angular": "0.0.0-pr-27957-a99d5ea"
82
+ "@module-federation/enhanced": "0.6.6",
83
+ "@nx/devkit": "0.0.0-pr-28218-5048fd1",
84
+ "@nx/js": "0.0.0-pr-28218-5048fd1",
85
+ "@nx/eslint": "0.0.0-pr-28218-5048fd1",
86
+ "@nx/webpack": "0.0.0-pr-28218-5048fd1",
87
+ "@nx/web": "0.0.0-pr-28218-5048fd1",
88
+ "@nx/workspace": "0.0.0-pr-28218-5048fd1",
89
+ "piscina": "^4.4.0"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "@angular-devkit/build-angular": ">= 16.0.0 < 19.0.0",
@@ -101,4 +101,4 @@
101
101
  "module": "fesm2022/nx-angular.mjs",
102
102
  "typings": "index.d.ts",
103
103
  "sideEffects": false
104
- }
104
+ }
package/plugin.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { createNodesV2 } from './src/plugins/plugin';
package/plugin.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createNodesV2 = void 0;
4
+ var plugin_1 = require("./src/plugins/plugin");
5
+ Object.defineProperty(exports, "createNodesV2", { enumerable: true, get: function () { return plugin_1.createNodesV2; } });
@@ -7,6 +7,7 @@ const webpack_merge_1 = require("webpack-merge");
7
7
  const internal_1 = require("@nx/js/src/internal");
8
8
  const devkit_1 = require("@nx/devkit");
9
9
  const path_1 = require("path");
10
+ const fs_1 = require("fs");
10
11
  async function mergeCustomWebpackConfig(baseWebpackConfig, pathToWebpackConfig, options, target) {
11
12
  const customWebpackConfiguration = resolveCustomWebpackConfig(pathToWebpackConfig, options.tsConfig.startsWith(devkit_1.workspaceRoot)
12
13
  ? options.tsConfig
@@ -17,12 +18,37 @@ async function mergeCustomWebpackConfig(baseWebpackConfig, pathToWebpackConfig,
17
18
  const config = await customWebpackConfiguration;
18
19
  // The extra Webpack configuration file can export a synchronous or asynchronous function,
19
20
  // for instance: `module.exports = async config => { ... }`.
21
+ let newConfig;
20
22
  if (typeof config === 'function') {
21
- return config(baseWebpackConfig, options, target);
23
+ newConfig = config(baseWebpackConfig, options, target);
22
24
  }
23
25
  else {
24
- return (0, webpack_merge_1.merge)(baseWebpackConfig, config);
26
+ newConfig = (0, webpack_merge_1.merge)(baseWebpackConfig, config);
25
27
  }
28
+ // license-webpack-plugin will at times try to scan the monorepo's root package.json
29
+ // This will result in an error being thrown
30
+ // Ensure root package.json is excluded
31
+ const licensePlugin = newConfig.plugins.find((p) => p.constructor.name === 'LicenseWebpackPlugin');
32
+ if (licensePlugin) {
33
+ let rootPackageJsonName;
34
+ const pathToRootPackageJson = (0, path_1.join)(newConfig.context.root ?? devkit_1.workspaceRoot, 'package.json');
35
+ if ((0, fs_1.existsSync)(pathToRootPackageJson)) {
36
+ try {
37
+ const rootPackageJson = JSON.parse((0, fs_1.readFileSync)(pathToRootPackageJson, 'utf-8'));
38
+ rootPackageJsonName = rootPackageJson.name;
39
+ licensePlugin.pluginOptions.excludedPackageTest = (pkgName) => {
40
+ if (!rootPackageJsonName) {
41
+ return false;
42
+ }
43
+ return pkgName === rootPackageJsonName;
44
+ };
45
+ }
46
+ catch {
47
+ // do nothing
48
+ }
49
+ }
50
+ }
51
+ return newConfig;
26
52
  }
27
53
  function resolveCustomWebpackConfig(path, tsConfig) {
28
54
  const cleanupTranspiler = (0, internal_1.registerTsProject)(tsConfig);
@@ -1,5 +1,4 @@
1
1
  import { GeneratorCallback, Tree } from '@nx/devkit';
2
2
  import type { Schema } from './schema';
3
3
  export declare function applicationGenerator(tree: Tree, schema: Partial<Schema>): Promise<GeneratorCallback>;
4
- export declare function applicationGeneratorInternal(tree: Tree, schema: Partial<Schema>): Promise<GeneratorCallback>;
5
4
  export default applicationGenerator;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.applicationGenerator = applicationGenerator;
4
- exports.applicationGeneratorInternal = applicationGeneratorInternal;
5
4
  const devkit_1 = require("@nx/devkit");
6
5
  const js_1 = require("@nx/js");
7
6
  const init_1 = require("../init/init");
@@ -11,12 +10,6 @@ const ensure_angular_dependencies_1 = require("../utils/ensure-angular-dependenc
11
10
  const lib_1 = require("./lib");
12
11
  const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
13
12
  async function applicationGenerator(tree, schema) {
14
- return await applicationGeneratorInternal(tree, {
15
- projectNameAndRootFormat: 'derived',
16
- ...schema,
17
- });
18
- }
19
- async function applicationGeneratorInternal(tree, schema) {
20
13
  const options = await (0, lib_1.normalizeOptions)(tree, schema);
21
14
  const rootOffset = (0, devkit_1.offsetFromRoot)(options.appProjectRoot);
22
15
  await (0, js_1.initGenerator)(tree, {
@@ -13,7 +13,6 @@ async function normalizeOptions(host, options) {
13
13
  directory: options.directory,
14
14
  projectNameAndRootFormat: options.projectNameAndRootFormat,
15
15
  rootProject: options.rootProject,
16
- callingGenerator: '@nx/angular:application',
17
16
  });
18
17
  options.rootProject = appProjectRoot === '.';
19
18
  options.projectNameAndRootFormat = projectNameAndRootFormat;
@@ -1,5 +1,4 @@
1
1
  import type { Tree } from '@nx/devkit';
2
2
  import type { Schema } from './schema';
3
3
  export declare function componentGenerator(tree: Tree, rawOptions: Schema): Promise<void>;
4
- export declare function componentGeneratorInternal(tree: Tree, rawOptions: Schema): Promise<void>;
5
4
  export default componentGenerator;
@@ -1,18 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.componentGenerator = componentGenerator;
4
- exports.componentGeneratorInternal = componentGeneratorInternal;
5
4
  const devkit_1 = require("@nx/devkit");
6
5
  const utils_1 = require("../utils");
7
6
  const version_utils_1 = require("../utils/version-utils");
8
7
  const lib_1 = require("./lib");
9
8
  async function componentGenerator(tree, rawOptions) {
10
- await componentGeneratorInternal(tree, {
11
- nameAndDirectoryFormat: 'derived',
12
- ...rawOptions,
13
- });
14
- }
15
- async function componentGeneratorInternal(tree, rawOptions) {
16
9
  const options = await (0, lib_1.normalizeOptions)(tree, rawOptions);
17
10
  const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
18
11
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), options.directory, {
@@ -7,13 +7,9 @@ const selector_1 = require("../../utils/selector");
7
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
- artifactType: 'component',
11
- callingGenerator: '@nx/angular:component',
12
10
  name: options.name,
13
- directory: options.directory ?? options.path,
14
- flat: options.flat,
11
+ directory: options.directory,
15
12
  nameAndDirectoryFormat: options.nameAndDirectoryFormat,
16
- project: options.project,
17
13
  suffix: options.type ?? 'component',
18
14
  });
19
15
  const { className } = (0, devkit_1.names)(name);
@@ -20,19 +20,6 @@ export interface Schema {
20
20
  export?: boolean;
21
21
  prefix?: string;
22
22
  skipFormat?: boolean;
23
-
24
- /**
25
- * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20.
26
- */
27
- flat?: boolean;
28
- /**
29
- * @deprecated Provide the `directory` option instead. It will be removed in Nx v20.
30
- */
31
- path?: string;
32
- /**
33
- * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v20.
34
- */
35
- project?: string;
36
23
  }
37
24
 
38
25
  export interface NormalizedSchema extends Schema {
@@ -27,15 +27,6 @@
27
27
  "type": "string",
28
28
  "enum": ["as-provided", "derived"]
29
29
  },
30
- "project": {
31
- "type": "string",
32
- "description": "The name of the project.",
33
- "$default": {
34
- "$source": "projectName"
35
- },
36
- "x-dropdown": "projects",
37
- "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 v20."
38
- },
39
30
  "prefix": {
40
31
  "type": "string",
41
32
  "description": "The prefix to apply to the generated component selector.",
@@ -94,12 +85,6 @@
94
85
  "description": "Do not create `spec.ts` test files for the new component.",
95
86
  "default": false
96
87
  },
97
- "flat": {
98
- "type": "boolean",
99
- "description": "Create the new files at the top level of the current project.",
100
- "default": false,
101
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20."
102
- },
103
88
  "skipImport": {
104
89
  "type": "boolean",
105
90
  "description": "Do not import this component into the owning NgModule.",
@@ -1,9 +1,8 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  import { CypressComponentConfigSchema } from './schema';
3
- export declare function cypressComponentConfiguration(tree: Tree, options: CypressComponentConfigSchema): Promise<import("@nx/devkit").GeneratorCallback>;
4
3
  /**
5
4
  * This is for cypress built in component testing, if you want to test with
6
5
  * storybook + cypress then use the componentCypressGenerator instead.
7
6
  */
8
- export declare function cypressComponentConfigurationInternal(tree: Tree, options: CypressComponentConfigSchema): Promise<import("@nx/devkit").GeneratorCallback>;
7
+ export declare function cypressComponentConfiguration(tree: Tree, options: CypressComponentConfigSchema): Promise<import("@nx/devkit").GeneratorCallback>;
9
8
  export default cypressComponentConfiguration;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cypressComponentConfiguration = cypressComponentConfiguration;
4
- exports.cypressComponentConfigurationInternal = cypressComponentConfigurationInternal;
5
4
  const devkit_1 = require("@nx/devkit");
6
5
  const path_1 = require("path");
7
6
  const versions_1 = require("../../utils/versions");
@@ -10,16 +9,11 @@ const component_info_1 = require("../utils/storybook-ast/component-info");
10
9
  const entry_point_1 = require("../utils/storybook-ast/entry-point");
11
10
  const module_info_1 = require("../utils/storybook-ast/module-info");
12
11
  const update_app_editor_tsconfig_excluded_files_1 = require("../utils/update-app-editor-tsconfig-excluded-files");
13
- function cypressComponentConfiguration(tree, options) {
14
- return cypressComponentConfigurationInternal(tree, {
15
- ...options,
16
- });
17
- }
18
12
  /**
19
13
  * This is for cypress built in component testing, if you want to test with
20
14
  * storybook + cypress then use the componentCypressGenerator instead.
21
15
  */
22
- async function cypressComponentConfigurationInternal(tree, options) {
16
+ async function cypressComponentConfiguration(tree, options) {
23
17
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
24
18
  const { componentConfigurationGenerator: baseCyCTConfig } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
25
19
  const installTask = await baseCyCTConfig(tree, {
@@ -6,13 +6,9 @@ const selector_1 = require("../../utils/selector");
6
6
  const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
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
- artifactType: 'directive',
10
- callingGenerator: '@nx/angular:directive',
11
9
  name: options.name,
12
- directory: options.directory ?? options.path,
13
- flat: options.flat,
10
+ directory: options.directory,
14
11
  nameAndDirectoryFormat: options.nameAndDirectoryFormat,
15
- project: options.project,
16
12
  suffix: 'directive',
17
13
  });
18
14
  const { className } = (0, devkit_1.names)(name);
@@ -12,18 +12,6 @@ export interface Schema {
12
12
  module?: string;
13
13
  export?: boolean;
14
14
  skipFormat?: boolean;
15
- /**
16
- * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20.
17
- */
18
- flat?: boolean;
19
- /**
20
- * @deprecated Provide the `directory` option instead. It will be removed in Nx v20.
21
- */
22
- path?: string;
23
- /**
24
- * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v20.
25
- */
26
- project?: string;
27
15
  }
28
16
 
29
17
  export interface NormalizedSchema extends Schema {
@@ -27,15 +27,6 @@
27
27
  "type": "string",
28
28
  "enum": ["as-provided", "derived"]
29
29
  },
30
- "project": {
31
- "type": "string",
32
- "description": "The name of the project.",
33
- "$default": {
34
- "$source": "projectName"
35
- },
36
- "x-dropdown": "projects",
37
- "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 v20."
38
- },
39
30
  "prefix": {
40
31
  "type": "string",
41
32
  "description": "A prefix to apply to generated selectors.",
@@ -70,12 +61,6 @@
70
61
  "type": "boolean",
71
62
  "default": true
72
63
  },
73
- "flat": {
74
- "type": "boolean",
75
- "description": "When true (the default), creates the new files at the top level of the current project.",
76
- "default": true,
77
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20."
78
- },
79
64
  "module": {
80
65
  "type": "string",
81
66
  "description": "The filename of the declaring NgModule.",
@@ -16,7 +16,7 @@ async function addRemote(tree, schema) {
16
16
  directory: schema.remoteDirectory,
17
17
  host: schema.host,
18
18
  standalone: schema.standalone,
19
- projectNameAndRootFormat: schema.projectNameAndRootFormat ?? 'derived',
19
+ projectNameAndRootFormat: schema.projectNameAndRootFormat,
20
20
  unitTestRunner: schema.unitTestRunner ?? test_runners_1.UnitTestRunner.Jest,
21
21
  e2eTestRunner: schema.e2eTestRunner ?? test_runners_1.E2eTestRunner.Cypress,
22
22
  skipFormat: true,
@@ -26,8 +26,7 @@ async function addRemote(tree, schema) {
26
26
  name: schema.remote,
27
27
  directory: schema.remoteDirectory,
28
28
  projectType: 'application',
29
- projectNameAndRootFormat: schema.projectNameAndRootFormat ?? 'derived',
30
- callingGenerator: '@nx/angular:federate-module',
29
+ projectNameAndRootFormat: schema.projectNameAndRootFormat,
31
30
  });
32
31
  projectRoot = remoteRoot;
33
32
  remoteName = projectName;
@@ -1,5 +1,4 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  import type { Schema } from './schema';
3
- export declare function host(tree: Tree, options: Schema): Promise<import("@nx/devkit").GeneratorCallback>;
4
- export declare function hostInternal(tree: Tree, schema: Schema): Promise<import("@nx/devkit").GeneratorCallback>;
3
+ export declare function host(tree: Tree, schema: Schema): Promise<import("@nx/devkit").GeneratorCallback>;
5
4
  export default host;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.host = host;
4
- exports.hostInternal = hostInternal;
5
4
  const tslib_1 = require("tslib");
6
5
  const devkit_1 = require("@nx/devkit");
7
6
  const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
@@ -12,13 +11,7 @@ const setup_mf_1 = require("../setup-mf/setup-mf");
12
11
  const lib_1 = require("./lib");
13
12
  const add_mf_env_to_inputs_1 = require("../utils/add-mf-env-to-inputs");
14
13
  const js_1 = require("@nx/js");
15
- async function host(tree, options) {
16
- return await hostInternal(tree, {
17
- projectNameAndRootFormat: 'derived',
18
- ...options,
19
- });
20
- }
21
- async function hostInternal(tree, schema) {
14
+ async function host(tree, schema) {
22
15
  const { typescriptConfiguration = true, ...options } = schema;
23
16
  options.standalone = options.standalone ?? true;
24
17
  const projects = (0, devkit_1.getProjects)(tree);
@@ -44,12 +37,11 @@ async function hostInternal(tree, schema) {
44
37
  }
45
38
  });
46
39
  }
47
- const { projectName: hostProjectName, projectNameAndRootFormat } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
40
+ const { projectName: hostProjectName, projectNameAndRootFormat, projectRoot: appRoot, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
48
41
  name: options.name,
49
42
  projectType: 'application',
50
43
  directory: options.directory,
51
44
  projectNameAndRootFormat: options.projectNameAndRootFormat,
52
- callingGenerator: '@nx/angular:host',
53
45
  });
54
46
  options.projectNameAndRootFormat = projectNameAndRootFormat;
55
47
  const appInstallTask = await (0, application_1.default)(tree, {
@@ -83,16 +75,11 @@ async function hostInternal(tree, schema) {
83
75
  installTasks.push(ssrInstallTask);
84
76
  }
85
77
  for (const remote of remotesToGenerate) {
86
- let remoteDirectory = options.directory;
87
- if (options.projectNameAndRootFormat === 'as-provided' &&
88
- options.directory) {
89
- /**
90
- * With the `as-provided` format, the provided directory would be the root
91
- * of the host application. Append the remote name to the host parent
92
- * directory to get the remote directory.
93
- */
94
- remoteDirectory = (0, devkit_1.joinPathFragments)(options.directory, '..', remote);
95
- }
78
+ const remoteDirectory = options.directory
79
+ ? (0, devkit_1.joinPathFragments)(options.directory, '..', remote)
80
+ : appRoot === '.'
81
+ ? remote
82
+ : (0, devkit_1.joinPathFragments)(appRoot, '..', remote);
96
83
  await (0, remote_1.default)(tree, {
97
84
  ...options,
98
85
  name: remote,
@@ -2,10 +2,22 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.angularInitGenerator = angularInitGenerator;
4
4
  const devkit_1 = require("@nx/devkit");
5
+ const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
5
6
  const version_utils_1 = require("../utils/version-utils");
7
+ const plugin_1 = require("../../plugins/plugin");
6
8
  async function angularInitGenerator(tree, options) {
7
9
  ignoreAngularCacheDirectory(tree);
8
10
  const installTask = installAngularDevkitCoreIfMissing(tree, options);
11
+ // For Angular inference plugin, we only want it during import since our
12
+ // generators do not use `angular.json`, and `nx init` should split
13
+ // `angular.json` into multiple `project.json` files -- as this is preferred
14
+ // by most folks we've talked to.
15
+ options.addPlugin ??= process.env.NX_RUNNING_NX_IMPORT === 'true';
16
+ if (options.addPlugin) {
17
+ await (0, add_plugin_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/angular/plugin', plugin_1.createNodesV2, {
18
+ targetNamePrefix: ['', 'angular:', 'angular-'],
19
+ }, options.updatePackageScripts);
20
+ }
9
21
  if (!options.skipFormat) {
10
22
  await (0, devkit_1.formatFiles)(tree);
11
23
  }
@@ -3,4 +3,7 @@ export interface Schema {
3
3
  skipInstall?: boolean;
4
4
  skipPackageJson?: boolean;
5
5
  keepExistingVersions?: boolean;
6
+ /* internal */
7
+ addPlugin?: boolean;
8
+ updatePackageScripts?: boolean;
6
9
  }
@@ -28,7 +28,6 @@ async function normalizeOptions(host, schema) {
28
28
  directory: options.directory,
29
29
  importPath: options.importPath,
30
30
  projectNameAndRootFormat: options.projectNameAndRootFormat,
31
- callingGenerator: '@nx/angular:library',
32
31
  });
33
32
  const fileName = options.simpleName
34
33
  ? projectNames.projectSimpleName
@@ -1,5 +1,4 @@
1
1
  import { GeneratorCallback, Tree } from '@nx/devkit';
2
2
  import { Schema } from './schema';
3
3
  export declare function libraryGenerator(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
4
- export declare function libraryGeneratorInternal(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
5
4
  export default libraryGenerator;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.libraryGenerator = libraryGenerator;
4
- exports.libraryGeneratorInternal = libraryGeneratorInternal;
5
4
  const tslib_1 = require("tslib");
6
5
  const devkit_1 = require("@nx/devkit");
7
6
  const eslint_1 = require("@nx/eslint");
@@ -24,14 +23,6 @@ const set_generator_defaults_1 = require("./lib/set-generator-defaults");
24
23
  const ensure_angular_dependencies_1 = require("../utils/ensure-angular-dependencies");
25
24
  const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
26
25
  async function libraryGenerator(tree, schema) {
27
- return await libraryGeneratorInternal(tree, {
28
- // provide a default projectNameAndRootFormat to avoid breaking changes
29
- // to external generators invoking this one
30
- projectNameAndRootFormat: 'derived',
31
- ...schema,
32
- });
33
- }
34
- async function libraryGeneratorInternal(tree, schema) {
35
26
  // Do some validation checks
36
27
  if (!schema.routing && schema.lazy) {
37
28
  throw new Error(`To use "--lazy" option, "--routing" must also be set.`);
@@ -1,4 +1,3 @@
1
1
  import type { Tree } from '@nx/devkit';
2
2
  import type { Schema } from './schema';
3
3
  export declare function angularMoveGenerator(tree: Tree, schema: Schema): Promise<void>;
4
- export declare function angularMoveGeneratorInternal(tree: Tree, schema: Schema): Promise<void>;
@@ -1,15 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.angularMoveGenerator = angularMoveGenerator;
4
- exports.angularMoveGeneratorInternal = angularMoveGeneratorInternal;
5
4
  const move_1 = require("@nx/workspace/src/generators/move/move");
6
5
  async function angularMoveGenerator(tree, schema) {
7
- await angularMoveGeneratorInternal(tree, {
8
- projectNameAndRootFormat: 'derived',
9
- ...schema,
10
- });
11
- }
12
- async function angularMoveGeneratorInternal(tree, schema) {
13
6
  process.env.NX_ANGULAR_MOVE_INVOKED = 'true';
14
- await (0, move_1.moveGeneratorInternal)(tree, schema);
7
+ await (0, move_1.moveGenerator)(tree, schema);
15
8
  }
@@ -5,13 +5,9 @@ const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/a
5
5
  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
- artifactType: 'pipe',
9
- callingGenerator: '@nx/angular:pipe',
10
8
  name: options.name,
11
- directory: options.directory ?? options.path,
12
- flat: options.flat,
9
+ directory: options.directory,
13
10
  nameAndDirectoryFormat: options.nameAndDirectoryFormat,
14
- project: options.project,
15
11
  suffix: 'pipe',
16
12
  });
17
13
  const { className } = (0, devkit_1.names)(name);