@nx/angular 19.1.0-canary.20240508-fd78152 → 19.1.0-canary.20240510-1a85787

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "19.1.0-canary.20240508-fd78152",
3
+ "version": "19.1.0-canary.20240510-1a85787",
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": {
@@ -78,14 +78,14 @@
78
78
  "tslib": "^2.3.0",
79
79
  "webpack": "^5.80.0",
80
80
  "webpack-merge": "^5.8.0",
81
- "@nx/devkit": "19.1.0-canary.20240508-fd78152",
82
- "@nx/js": "19.1.0-canary.20240508-fd78152",
83
- "@nx/eslint": "19.1.0-canary.20240508-fd78152",
84
- "@nx/webpack": "19.1.0-canary.20240508-fd78152",
85
- "@nx/web": "19.1.0-canary.20240508-fd78152",
86
- "@nx/workspace": "19.1.0-canary.20240508-fd78152",
81
+ "@nx/devkit": "19.1.0-canary.20240510-1a85787",
82
+ "@nx/js": "19.1.0-canary.20240510-1a85787",
83
+ "@nx/eslint": "19.1.0-canary.20240510-1a85787",
84
+ "@nx/webpack": "19.1.0-canary.20240510-1a85787",
85
+ "@nx/web": "19.1.0-canary.20240510-1a85787",
86
+ "@nx/workspace": "19.1.0-canary.20240510-1a85787",
87
87
  "piscina": "^4.4.0",
88
- "@nrwl/angular": "19.1.0-canary.20240508-fd78152"
88
+ "@nrwl/angular": "19.1.0-canary.20240510-1a85787"
89
89
  },
90
90
  "peerDependencies": {
91
91
  "@angular-devkit/build-angular": ">= 15.0.0 < 18.0.0",
@@ -17,7 +17,7 @@
17
17
  "type": "string",
18
18
  "description": "A browser builder target to serve in the format of `project:target[:configuration]`. Ignored if `buildTarget` is set.",
19
19
  "pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$",
20
- "x-deprecated": "Use 'buildTarget' instead. It will be removed in Nx v19."
20
+ "x-deprecated": "Use 'buildTarget' instead. It will be removed in Nx v20."
21
21
  },
22
22
  "buildTarget": {
23
23
  "type": "string",
@@ -2,5 +2,8 @@ import { ProjectConfiguration } from '@nx/devkit';
2
2
  export declare function getDynamicRemotes(project: ProjectConfiguration, context: import('@angular-devkit/architect').BuilderContext, workspaceProjects: Record<string, ProjectConfiguration>, remotesToSkip: Set<string>, pathToManifestFile?: string): string[];
3
3
  export declare function getStaticRemotes(project: ProjectConfiguration, context: import('@angular-devkit/architect').BuilderContext, workspaceProjects: Record<string, ProjectConfiguration>, remotesToSkip: Set<string>): string[];
4
4
  export declare function validateDevRemotes(options: {
5
- devRemotes?: string[];
5
+ devRemotes?: (string | {
6
+ remoteName: string;
7
+ configuration: string;
8
+ })[];
6
9
  }, workspaceProjects: Record<string, ProjectConfiguration>): void;
@@ -85,7 +85,9 @@ function getStaticRemotes(project, context, workspaceProjects, remotesToSkip) {
85
85
  }
86
86
  exports.getStaticRemotes = getStaticRemotes;
87
87
  function validateDevRemotes(options, workspaceProjects) {
88
- const invalidDevRemotes = options.devRemotes?.filter((remote) => !workspaceProjects[remote]) ?? [];
88
+ const invalidDevRemotes = options.devRemotes?.filter((remote) => !(typeof remote === 'string'
89
+ ? workspaceProjects[remote]
90
+ : workspaceProjects[remote.remoteName])) ?? [];
89
91
  if (invalidDevRemotes.length) {
90
92
  throw new Error(invalidDevRemotes.length === 1
91
93
  ? `Invalid dev remote provided: ${invalidDevRemotes[0]}.`
@@ -7,7 +7,7 @@ export type BrowserBuilderSchema = Schema & {
7
7
  indexHtmlTransformer?: string;
8
8
  buildLibsFromSource?: boolean;
9
9
  /**
10
- * @deprecated Use `indexHtmlTransformer` instead. It will be removed in Nx 19.
10
+ * @deprecated Use `indexHtmlTransformer` instead. It will be removed in Nx 20.
11
11
  */
12
12
  indexFileTransformer?: string;
13
13
  };
@@ -13,10 +13,11 @@ async function startRemotes(remotes, workspaceProjects, options, context, target
13
13
  }
14
14
  const [collection, executor] = workspaceProjects[app].targets[target].executor.split(':');
15
15
  const isUsingModuleFederationDevServerExecutor = executor.includes('module-federation-dev-server');
16
+ const configurationOverride = options.devRemotes.find((r) => typeof r !== 'string' && r.remoteName === app)?.configuration;
16
17
  remoteIters.push(await (0, devkit_1.runExecutor)({
17
18
  project: app,
18
19
  target,
19
- configuration: context.configurationName,
20
+ configuration: configurationOverride ?? context.configurationName,
20
21
  }, {
21
22
  ...(target === 'serve' ? { verbose: options.verbose ?? false } : {}),
22
23
  ...(isUsingModuleFederationDevServerExecutor
@@ -52,14 +52,17 @@ async function* moduleFederationDevServerExecutor(schema, context) {
52
52
  }
53
53
  (0, module_federation_2.validateDevRemotes)(options, workspaceProjects);
54
54
  const moduleFederationConfig = (0, module_federation_1.getModuleFederationConfig)(project.targets.build.options.tsConfig, context.root, project.root, 'angular');
55
- const remotes = (0, module_federation_1.getRemotes)(options.devRemotes, options.skipRemotes, moduleFederationConfig, {
55
+ const remoteNames = options.devRemotes?.map((r) => typeof r === 'string' ? r : r.remoteName);
56
+ const remotes = (0, module_federation_1.getRemotes)(remoteNames, options.skipRemotes, moduleFederationConfig, {
56
57
  projectName: project.name,
57
58
  projectGraph: context.projectGraph,
58
59
  root: context.root,
59
60
  }, pathToManifestFile);
60
61
  if (remotes.devRemotes.length > 0 && !schema.staticRemotesPort) {
61
62
  options.staticRemotesPort = options.devRemotes.reduce((portToUse, r) => {
62
- const remotePort = context.projectGraph.nodes[r].data.targets['serve'].options.port;
63
+ const remoteName = typeof r === 'string' ? r : r.remoteName;
64
+ const remotePort = context.projectGraph.nodes[remoteName].data.targets['serve'].options
65
+ .port;
63
66
  if (remotePort >= portToUse) {
64
67
  return remotePort + 1;
65
68
  }
@@ -16,7 +16,13 @@ interface BaseSchema {
16
16
  hmr?: boolean;
17
17
  watch?: boolean;
18
18
  poll?: number;
19
- devRemotes?: string[];
19
+ devRemotes?: (
20
+ | string
21
+ | {
22
+ remoteName: string;
23
+ configuration: string;
24
+ }
25
+ )[];
20
26
  skipRemotes?: string[];
21
27
  pathToManifestFile?: string;
22
28
  static?: boolean;
@@ -15,7 +15,7 @@
15
15
  "type": "string",
16
16
  "description": "A browser builder target to serve in the format of `project:target[:configuration]`.",
17
17
  "pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$",
18
- "x-deprecated": "Use 'buildTarget' instead. It will be removed in Nx v19."
18
+ "x-deprecated": "Use 'buildTarget' instead. It will be removed in Nx v20."
19
19
  },
20
20
  "buildTarget": {
21
21
  "type": "string",
@@ -112,7 +112,24 @@
112
112
  "devRemotes": {
113
113
  "type": "array",
114
114
  "items": {
115
- "type": "string"
115
+ "oneOf": [
116
+ {
117
+ "type": "string"
118
+ },
119
+ {
120
+ "type": "object",
121
+ "properties": {
122
+ "remoteName": {
123
+ "type": "string"
124
+ },
125
+ "configuration": {
126
+ "type": "string"
127
+ }
128
+ },
129
+ "required": ["remoteName"],
130
+ "additionalProperties": false
131
+ }
132
+ ]
116
133
  },
117
134
  "description": "List of remote applications to run in development mode (i.e. using serve target).",
118
135
  "x-priority": "important"
@@ -22,15 +22,15 @@ export interface Schema {
22
22
  skipFormat?: boolean;
23
23
 
24
24
  /**
25
- * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19.
25
+ * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20.
26
26
  */
27
27
  flat?: boolean;
28
28
  /**
29
- * @deprecated Provide the `directory` option instead. It will be removed in Nx v19.
29
+ * @deprecated Provide the `directory` option instead. It will be removed in Nx v20.
30
30
  */
31
31
  path?: string;
32
32
  /**
33
- * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v19.
33
+ * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v20.
34
34
  */
35
35
  project?: string;
36
36
  }
@@ -34,7 +34,7 @@
34
34
  "$source": "projectName"
35
35
  },
36
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 v19."
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
38
  },
39
39
  "prefix": {
40
40
  "type": "string",
@@ -98,7 +98,7 @@
98
98
  "type": "boolean",
99
99
  "description": "Create the new files at the top level of the current project.",
100
100
  "default": false,
101
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19."
101
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20."
102
102
  },
103
103
  "skipImport": {
104
104
  "type": "boolean",
@@ -13,15 +13,15 @@ export interface Schema {
13
13
  export?: boolean;
14
14
  skipFormat?: boolean;
15
15
  /**
16
- * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19.
16
+ * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20.
17
17
  */
18
18
  flat?: boolean;
19
19
  /**
20
- * @deprecated Provide the `directory` option instead. It will be removed in Nx v19.
20
+ * @deprecated Provide the `directory` option instead. It will be removed in Nx v20.
21
21
  */
22
22
  path?: string;
23
23
  /**
24
- * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v19.
24
+ * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v20.
25
25
  */
26
26
  project?: string;
27
27
  }
@@ -34,7 +34,7 @@
34
34
  "$source": "projectName"
35
35
  },
36
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 v19."
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
38
  },
39
39
  "prefix": {
40
40
  "type": "string",
@@ -74,7 +74,7 @@
74
74
  "type": "boolean",
75
75
  "description": "When true (the default), creates the new files at the top level of the current project.",
76
76
  "default": true,
77
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19."
77
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20."
78
78
  },
79
79
  "module": {
80
80
  "type": "string",
@@ -9,6 +9,7 @@ const remote_1 = require("../remote/remote");
9
9
  const setup_mf_1 = require("../setup-mf/setup-mf");
10
10
  const lib_1 = require("./lib");
11
11
  const add_mf_env_to_inputs_1 = require("../utils/add-mf-env-to-inputs");
12
+ const js_1 = require("@nx/js");
12
13
  async function host(tree, options) {
13
14
  return await hostInternal(tree, {
14
15
  projectNameAndRootFormat: 'derived',
@@ -22,6 +23,16 @@ async function hostInternal(tree, schema) {
22
23
  const projects = (0, devkit_1.getProjects)(tree);
23
24
  const remotesToGenerate = [];
24
25
  const remotesToIntegrate = [];
26
+ // Check to see if remotes are provided and also check if --dynamic is provided
27
+ // if both are check that the remotes are valid names else throw an error.
28
+ if (options.dynamic && options.remotes?.length > 0) {
29
+ options.remotes.forEach((remote) => {
30
+ const isValidRemote = (0, js_1.isValidVariable)(remote);
31
+ if (!isValidRemote.isValid) {
32
+ throw new Error(`Invalid remote name provided: ${remote}. ${isValidRemote.message}`);
33
+ }
34
+ });
35
+ }
25
36
  if (options.remotes && options.remotes.length > 0) {
26
37
  options.remotes.forEach((remote) => {
27
38
  if (!projects.has(remote)) {
@@ -11,15 +11,15 @@ export interface Schema {
11
11
  export?: boolean;
12
12
  skipFormat?: boolean;
13
13
  /**
14
- * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19.
14
+ * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20.
15
15
  */
16
16
  flat?: boolean;
17
17
  /**
18
- * @deprecated Provide the `directory` option instead. It will be removed in Nx v19.
18
+ * @deprecated Provide the `directory` option instead. It will be removed in Nx v20.
19
19
  */
20
20
  path?: string;
21
21
  /**
22
- * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v19.
22
+ * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v20.
23
23
  */
24
24
  project?: string;
25
25
  }
@@ -34,13 +34,13 @@
34
34
  "$source": "projectName"
35
35
  },
36
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 v19."
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
38
  },
39
39
  "flat": {
40
40
  "type": "boolean",
41
41
  "default": true,
42
42
  "description": "When true (the default) creates files at the top level of the project.",
43
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19."
43
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20."
44
44
  },
45
45
  "skipTests": {
46
46
  "type": "boolean",
@@ -19,15 +19,15 @@ export interface Schema {
19
19
  export?: boolean;
20
20
  skipFormat?: boolean;
21
21
  /**
22
- * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19.
22
+ * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20.
23
23
  */
24
24
  flat?: boolean;
25
25
  /**
26
- * @deprecated Provide the `directory` option instead. It will be removed in Nx v19.
26
+ * @deprecated Provide the `directory` option instead. It will be removed in Nx v20.
27
27
  */
28
28
  path?: string;
29
29
  /**
30
- * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v19.
30
+ * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v20.
31
31
  */
32
32
  project?: string;
33
33
  }
@@ -40,7 +40,7 @@
40
40
  "$source": "projectName"
41
41
  },
42
42
  "x-dropdown": "projects",
43
- "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 v19."
43
+ "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."
44
44
  },
45
45
  "displayBlock": {
46
46
  "description": "Specifies if the style will contain `:host { display: block; }`.",
@@ -94,7 +94,7 @@
94
94
  "type": "boolean",
95
95
  "description": "Create the new files at the top level of the current project.",
96
96
  "default": false,
97
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19."
97
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20."
98
98
  },
99
99
  "selector": {
100
100
  "type": "string",
@@ -11,15 +11,15 @@ export interface Schema {
11
11
  export?: boolean;
12
12
  skipFormat?: boolean;
13
13
  /**
14
- * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19.
14
+ * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20.
15
15
  */
16
16
  flat?: boolean;
17
17
  /**
18
- * @deprecated Provide the `directory` option instead. It will be removed in Nx v19.
18
+ * @deprecated Provide the `directory` option instead. It will be removed in Nx v20.
19
19
  */
20
20
  path?: string;
21
21
  /**
22
- * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v19.
22
+ * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v20.
23
23
  */
24
24
  project?: string;
25
25
  }
@@ -41,7 +41,7 @@
41
41
  "$source": "projectName"
42
42
  },
43
43
  "x-dropdown": "projects",
44
- "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 v19."
44
+ "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."
45
45
  },
46
46
  "skipTests": {
47
47
  "type": "boolean",
@@ -58,7 +58,7 @@
58
58
  "type": "boolean",
59
59
  "description": "Create the new files at the top level of the current project.",
60
60
  "default": true,
61
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19."
61
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20."
62
62
  },
63
63
  "selector": {
64
64
  "type": "string",
@@ -9,15 +9,15 @@ export interface Schema {
9
9
  export?: boolean;
10
10
  skipFormat?: boolean;
11
11
  /**
12
- * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19.
12
+ * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20.
13
13
  */
14
14
  flat?: boolean;
15
15
  /**
16
- * @deprecated Provide the `directory` option instead. It will be removed in Nx v19.
16
+ * @deprecated Provide the `directory` option instead. It will be removed in Nx v20.
17
17
  */
18
18
  path?: string;
19
19
  /**
20
- * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v19.
20
+ * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v20.
21
21
  */
22
22
  project?: string;
23
23
  }
@@ -41,7 +41,7 @@
41
41
  "$source": "projectName"
42
42
  },
43
43
  "x-dropdown": "projects",
44
- "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 v19."
44
+ "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."
45
45
  },
46
46
  "skipTests": {
47
47
  "type": "boolean",
@@ -58,7 +58,7 @@
58
58
  "type": "boolean",
59
59
  "description": "Create the new files at the top level of the current project.",
60
60
  "default": true,
61
- "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v19."
61
+ "x-deprecated": "Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v20."
62
62
  },
63
63
  "export": {
64
64
  "type": "boolean",
@@ -29,7 +29,7 @@
29
29
  "configureCypress": {
30
30
  "type": "boolean",
31
31
  "description": "Specifies whether to configure Cypress or not.",
32
- "x-deprecated": "Use interactionTests instead. This option will be removed in v19."
32
+ "x-deprecated": "Use interactionTests instead. This option will be removed in v20."
33
33
  },
34
34
  "generateStories": {
35
35
  "type": "boolean",
@@ -41,7 +41,7 @@
41
41
  "generateCypressSpecs": {
42
42
  "type": "boolean",
43
43
  "description": "Specifies whether to automatically generate test files in the generated Cypress e2e app.",
44
- "x-deprecated": "Use interactionTests instead. This option will be removed in v19."
44
+ "x-deprecated": "Use interactionTests instead. This option will be removed in v20."
45
45
  },
46
46
  "configureStaticServe": {
47
47
  "type": "boolean",
@@ -53,7 +53,7 @@
53
53
  "cypressDirectory": {
54
54
  "type": "string",
55
55
  "description": "A directory where the Cypress project will be placed. Placed at the root by default.",
56
- "x-deprecated": "Use interactionTests instead. This option will be removed in v19."
56
+ "x-deprecated": "Use interactionTests instead. This option will be removed in v20."
57
57
  },
58
58
  "linter": {
59
59
  "description": "The tool to use for running lint checks.",