nx 22.1.0-canary.20251111-647d751 → 22.1.0-canary.20251114-b3e6b03

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 (58) hide show
  1. package/bin/init-local.d.ts.map +1 -1
  2. package/bin/init-local.js +40 -2
  3. package/executors.json +16 -16
  4. package/generators.json +13 -13
  5. package/migrations.json +143 -143
  6. package/package.json +14 -11
  7. package/presets/npm.json +4 -4
  8. package/schemas/nx-schema.json +1285 -1285
  9. package/schemas/project-schema.json +359 -359
  10. package/schemas/workspace-schema.json +165 -165
  11. package/src/ai/set-up-ai-agents/schema.json +31 -31
  12. package/src/command-line/add/add.d.ts.map +1 -1
  13. package/src/command-line/add/add.js +5 -2
  14. package/src/command-line/configure-ai-agents/configure-ai-agents.d.ts.map +1 -1
  15. package/src/command-line/configure-ai-agents/configure-ai-agents.js +3 -1
  16. package/src/command-line/init/command-object.d.ts.map +1 -1
  17. package/src/command-line/init/command-object.js +10 -0
  18. package/src/command-line/init/init-v2.d.ts +1 -1
  19. package/src/command-line/init/init-v2.d.ts.map +1 -1
  20. package/src/command-line/init/init-v2.js +29 -1
  21. package/src/command-line/migrate/migrate.d.ts.map +1 -1
  22. package/src/command-line/migrate/migrate.js +2 -1
  23. package/src/core/graph/main.js +1 -1
  24. package/src/core/graph/styles.css +2 -2
  25. package/src/daemon/client/client.d.ts +3 -0
  26. package/src/daemon/client/client.d.ts.map +1 -1
  27. package/src/daemon/client/client.js +14 -0
  28. package/src/daemon/message-types/nx-console.d.ts +18 -0
  29. package/src/daemon/message-types/nx-console.d.ts.map +1 -0
  30. package/src/daemon/message-types/nx-console.js +19 -0
  31. package/src/daemon/server/handle-nx-console.d.ts +4 -0
  32. package/src/daemon/server/handle-nx-console.d.ts.map +1 -0
  33. package/src/daemon/server/handle-nx-console.js +54 -0
  34. package/src/daemon/server/nx-console-operations.d.ts +31 -0
  35. package/src/daemon/server/nx-console-operations.d.ts.map +1 -0
  36. package/src/daemon/server/nx-console-operations.js +135 -0
  37. package/src/daemon/server/server.d.ts.map +1 -1
  38. package/src/daemon/server/server.js +12 -0
  39. package/src/daemon/server/shutdown-utils.d.ts.map +1 -1
  40. package/src/daemon/server/shutdown-utils.js +3 -0
  41. package/src/devkit-internals.d.ts +1 -1
  42. package/src/devkit-internals.d.ts.map +1 -1
  43. package/src/devkit-internals.js +2 -1
  44. package/src/executors/noop/schema.json +8 -8
  45. package/src/executors/run-commands/schema.json +187 -187
  46. package/src/executors/run-script/schema.json +25 -25
  47. package/src/native/index.d.ts +37 -34
  48. package/src/native/native-bindings.js +1 -0
  49. package/src/native/nx.wasi-browser.js +53 -45
  50. package/src/native/nx.wasm32-wasi.wasm +0 -0
  51. package/src/nx-cloud/generators/connect-to-nx-cloud/schema.json +38 -38
  52. package/src/tasks-runner/process-metrics-service.d.ts +2 -2
  53. package/src/tasks-runner/process-metrics-service.d.ts.map +1 -1
  54. package/src/tasks-runner/tasks-schedule.d.ts.map +1 -1
  55. package/src/tasks-runner/tasks-schedule.js +10 -3
  56. package/src/utils/package-json.d.ts +4 -0
  57. package/src/utils/package-json.d.ts.map +1 -1
  58. package/src/utils/package-json.js +45 -11
@@ -1,185 +1,185 @@
1
1
  {
2
- "$schema": "http://json-schema.org/draft-07/schema",
3
- "$id": "https://nx.dev",
4
- "title": "JSON schema for Nx workspaces",
5
- "type": "object",
6
- "properties": {
7
- "version": {
8
- "type": "number",
9
- "enum": [1, 2]
10
- }
11
- },
12
- "allOf": [
13
- {
14
- "if": {
15
- "properties": { "version": { "const": 2 } },
16
- "required": ["version"]
17
- },
18
- "then": {
19
- "properties": {
20
- "projects": {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "https://nx.dev",
4
+ "title": "JSON schema for Nx workspaces",
5
+ "type": "object",
6
+ "properties": {
7
+ "version": {
8
+ "type": "number",
9
+ "enum": [1, 2]
10
+ }
11
+ },
12
+ "allOf": [
13
+ {
14
+ "if": {
15
+ "properties": { "version": { "const": 2 } },
16
+ "required": ["version"]
17
+ },
18
+ "then": {
19
+ "properties": {
20
+ "projects": {
21
+ "type": "object",
22
+ "additionalProperties": {
23
+ "oneOf": [
24
+ {
25
+ "type": "string"
26
+ },
27
+ {
28
+ "type": "object",
29
+ "properties": {
30
+ "targets": {
31
+ "type": "object",
32
+ "description": "Configures all the targets which define what tasks you can run against the project",
33
+ "additionalProperties": {
21
34
  "type": "object",
22
- "additionalProperties": {
23
- "oneOf": [
35
+ "properties": {
36
+ "executor": {
37
+ "description": "The function that Nx will invoke when you run this target",
38
+ "type": "string"
39
+ },
40
+ "options": {
41
+ "type": "object"
42
+ },
43
+ "outputs": {
44
+ "type": "array",
45
+ "items": {
46
+ "type": "string"
47
+ }
48
+ },
49
+ "configurations": {
50
+ "type": "object",
51
+ "description": "provides extra sets of values that will be merged into the options map",
52
+ "additionalProperties": {
53
+ "type": "object"
54
+ }
55
+ },
56
+ "dependsOn": {
57
+ "type": "array",
58
+ "description": "Target dependency.",
59
+ "items": {
60
+ "oneOf": [
24
61
  {
25
- "type": "string"
62
+ "type": "string"
26
63
  },
27
64
  {
28
- "type": "object",
29
- "properties": {
30
- "targets": {
31
- "type": "object",
32
- "description": "Configures all the targets which define what tasks you can run against the project",
33
- "additionalProperties": {
34
- "type": "object",
35
- "properties": {
36
- "executor": {
37
- "description": "The function that Nx will invoke when you run this target",
38
- "type": "string"
39
- },
40
- "options": {
41
- "type": "object"
42
- },
43
- "outputs": {
44
- "type": "array",
45
- "items": {
46
- "type": "string"
47
- }
48
- },
49
- "configurations": {
50
- "type": "object",
51
- "description": "provides extra sets of values that will be merged into the options map",
52
- "additionalProperties": {
53
- "type": "object"
54
- }
55
- },
56
- "dependsOn": {
57
- "type": "array",
58
- "description": "Target dependency.",
59
- "items": {
60
- "oneOf": [
61
- {
62
- "type": "string"
63
- },
64
- {
65
- "type": "object",
66
- "properties": {
67
- "projects": {
68
- "oneOf": [
69
- {
70
- "type": "string",
71
- "description": "A project name"
72
- },
73
- {
74
- "type": "array",
75
- "description": "An array of project names",
76
- "items": {
77
- "type": "string"
78
- }
79
- }
80
- ]
81
- },
82
- "dependencies": {
83
- "type": "boolean"
84
- },
85
- "target": {
86
- "type": "string",
87
- "description": "The name of the target."
88
- },
89
- "params": {
90
- "type": "string",
91
- "description": "Configuration for params handling.",
92
- "enum": ["ignore", "forward"],
93
- "default": "ignore"
94
- }
95
- },
96
- "oneOf": [
97
- {
98
- "required": ["projects", "target"]
99
- },
100
- {
101
- "required": ["dependencies", "target"]
102
- },
103
- {
104
- "required": ["target"],
105
- "not": {
106
- "anyOf": [
107
- { "required": ["projects"] },
108
- { "required": ["dependencies"] }
109
- ]
110
- }
111
- }
112
- ],
113
- "additionalProperties": false
114
- }
115
- ]
116
- }
117
- },
118
- "command": {
119
- "type": "string",
120
- "description": "A shorthand for using the nx:run-commands executor"
121
- },
122
- "cache": {
123
- "type": "boolean",
124
- "description": "Specifies if the given target should be cacheable"
125
- }
126
- }
127
- }
128
- },
129
- "tags": {
130
- "type": "array",
131
- "items": {
132
- "type": "string"
133
- }
65
+ "type": "object",
66
+ "properties": {
67
+ "projects": {
68
+ "oneOf": [
69
+ {
70
+ "type": "string",
71
+ "description": "A project name"
134
72
  },
135
- "implicitDependencies": {
136
- "type": "array",
137
- "items": {
138
- "type": "string"
139
- }
73
+ {
74
+ "type": "array",
75
+ "description": "An array of project names",
76
+ "items": {
77
+ "type": "string"
78
+ }
140
79
  }
80
+ ]
81
+ },
82
+ "dependencies": {
83
+ "type": "boolean"
84
+ },
85
+ "target": {
86
+ "type": "string",
87
+ "description": "The name of the target."
88
+ },
89
+ "params": {
90
+ "type": "string",
91
+ "description": "Configuration for params handling.",
92
+ "enum": ["ignore", "forward"],
93
+ "default": "ignore"
141
94
  }
95
+ },
96
+ "oneOf": [
97
+ {
98
+ "required": ["projects", "target"]
99
+ },
100
+ {
101
+ "required": ["dependencies", "target"]
102
+ },
103
+ {
104
+ "required": ["target"],
105
+ "not": {
106
+ "anyOf": [
107
+ { "required": ["projects"] },
108
+ { "required": ["dependencies"] }
109
+ ]
110
+ }
111
+ }
112
+ ],
113
+ "additionalProperties": false
142
114
  }
143
- ]
115
+ ]
116
+ }
117
+ },
118
+ "command": {
119
+ "type": "string",
120
+ "description": "A shorthand for using the nx:run-commands executor"
121
+ },
122
+ "cache": {
123
+ "type": "boolean",
124
+ "description": "Specifies if the given target should be cacheable"
125
+ }
144
126
  }
127
+ }
128
+ },
129
+ "tags": {
130
+ "type": "array",
131
+ "items": {
132
+ "type": "string"
133
+ }
134
+ },
135
+ "implicitDependencies": {
136
+ "type": "array",
137
+ "items": {
138
+ "type": "string"
139
+ }
145
140
  }
141
+ }
146
142
  }
147
- },
148
- "else": {
149
- "properties": {
150
- "projects": {
143
+ ]
144
+ }
145
+ }
146
+ }
147
+ },
148
+ "else": {
149
+ "properties": {
150
+ "projects": {
151
+ "type": "object",
152
+ "additionalProperties": {
153
+ "type": "object",
154
+ "properties": {
155
+ "architect": {
156
+ "type": "object",
157
+ "description": "Configures all the targets which define what tasks you can run against the project",
158
+ "additionalProperties": {
159
+ "type": "object",
160
+ "properties": {
161
+ "builder": {
162
+ "description": "The function that Nx will invoke when you run this architect",
163
+ "type": "string"
164
+ },
165
+ "options": {
166
+ "type": "object"
167
+ },
168
+ "configurations": {
151
169
  "type": "object",
170
+ "description": "provides extra sets of values that will be merged into the options map",
152
171
  "additionalProperties": {
153
- "type": "object",
154
- "properties": {
155
- "architect": {
156
- "type": "object",
157
- "description": "Configures all the targets which define what tasks you can run against the project",
158
- "additionalProperties": {
159
- "type": "object",
160
- "properties": {
161
- "builder": {
162
- "description": "The function that Nx will invoke when you run this architect",
163
- "type": "string"
164
- },
165
- "options": {
166
- "type": "object"
167
- },
168
- "configurations": {
169
- "type": "object",
170
- "description": "provides extra sets of values that will be merged into the options map",
171
- "additionalProperties": {
172
- "type": "object"
173
- }
174
- }
175
- }
176
- }
177
- }
178
- }
172
+ "type": "object"
179
173
  }
174
+ }
180
175
  }
176
+ }
181
177
  }
178
+ }
182
179
  }
180
+ }
183
181
  }
184
- ]
182
+ }
183
+ }
184
+ ]
185
185
  }
@@ -1,34 +1,34 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
3
- "$id": "SetupAiAgents",
4
- "title": "Set Up AI Agents",
5
- "description": "Sets up the Nx MCP & rule files for common AI Agents.",
6
- "type": "object",
7
- "properties": {
8
- "directory": {
9
- "type": "string",
10
- "description": "Directory where the AI agent configuration files will be generated",
11
- "default": "."
12
- },
13
- "writeNxCloudRules": {
14
- "type": "boolean",
15
- "description": "Whether to write Nx Cloud rules",
16
- "default": false
17
- },
18
- "packageVersion": {
19
- "type": "string",
20
- "description": "The version of the package to use",
21
- "default": "latest"
22
- },
23
- "agents": {
24
- "type": "array",
25
- "description": "The agents to setup Nx configuration for.",
26
- "items": {
27
- "type": "string",
28
- "enum": ["claude", "gemini", "codex", "cursor", "copilot"]
29
- },
30
- "default": ["claude", "gemini", "codex", "cursor", "copilot"]
31
- }
2
+ "$schema": "https://json-schema.org/schema",
3
+ "$id": "SetupAiAgents",
4
+ "title": "Set Up AI Agents",
5
+ "description": "Sets up the Nx MCP & rule files for common AI Agents.",
6
+ "type": "object",
7
+ "properties": {
8
+ "directory": {
9
+ "type": "string",
10
+ "description": "Directory where the AI agent configuration files will be generated",
11
+ "default": "."
32
12
  },
33
- "required": ["directory"]
13
+ "writeNxCloudRules": {
14
+ "type": "boolean",
15
+ "description": "Whether to write Nx Cloud rules",
16
+ "default": false
17
+ },
18
+ "packageVersion": {
19
+ "type": "string",
20
+ "description": "The version of the package to use",
21
+ "default": "latest"
22
+ },
23
+ "agents": {
24
+ "type": "array",
25
+ "description": "The agents to setup Nx configuration for.",
26
+ "items": {
27
+ "type": "string",
28
+ "enum": ["claude", "gemini", "codex", "cursor", "copilot"]
29
+ },
30
+ "default": ["claude", "gemini", "codex", "cursor", "copilot"]
31
+ }
32
+ },
33
+ "required": ["directory"]
34
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/add/add.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AASnD,wBAAgB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAc/D;AA6HD,eAAO,MAAM,oBAAoB,qBAUhC,CAAC"}
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/add/add.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AASnD,wBAAgB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAc/D;AAgID,eAAO,MAAM,oBAAoB,qBAUhC,CAAC"}
@@ -41,11 +41,14 @@ async function installPackage(pkgName, version, nxJson) {
41
41
  : `${pmc.addDev} ${pkgName}@${version}`;
42
42
  await new Promise((resolve) => (0, child_process_1.exec)(command, {
43
43
  windowsHide: false,
44
- }, (error, stdout) => {
44
+ }, (error, stdout, stderr) => {
45
45
  if (error) {
46
46
  spinner.fail();
47
47
  output_1.output.addNewline();
48
- logger_1.logger.error(stdout);
48
+ const errorOutput = [stdout.trim(), stderr.trim()]
49
+ .filter(Boolean)
50
+ .join('\n');
51
+ logger_1.logger.error(errorOutput);
49
52
  output_1.output.error({
50
53
  title: `Failed to install ${pkgName}. Please check the error above for more details.`,
51
54
  });
@@ -1 +1 @@
1
- {"version":3,"file":"configure-ai-agents.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/configure-ai-agents/configure-ai-agents.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAI5D,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,wBAAwB,EAC9B,KAAK,UAAQ,GACZ,OAAO,CAAC,IAAI,CAAC,CA+Bf;AAED,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,IAAI,CAAC,CAyOf"}
1
+ {"version":3,"file":"configure-ai-agents.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/configure-ai-agents/configure-ai-agents.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAI5D,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,wBAAwB,EAC9B,KAAK,UAAQ,GACZ,OAAO,CAAC,IAAI,CAAC,CAmCf;AAED,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,IAAI,CAAC,CAyOf"}
@@ -13,7 +13,9 @@ const ora = require("ora");
13
13
  const path_1 = require("path");
14
14
  async function configureAiAgentsHandler(args, inner = false) {
15
15
  // Use environment variable to force local execution
16
- if (process.env.NX_AI_FILES_USE_LOCAL === 'true' || inner) {
16
+ if (process.env.NX_USE_LOCAL === 'true' ||
17
+ process.env.NX_AI_FILES_USE_LOCAL === 'true' ||
18
+ inner) {
17
19
  return await configureAiAgentsHandlerImpl(args);
18
20
  }
19
21
  let cleanup;
@@ -1 +1 @@
1
- {"version":3,"file":"command-object.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/init/command-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,aAAa,EAAE,MAAM,OAAO,CAAC;AAG5C,eAAO,MAAM,gBAAgB,EAAE,aAoB9B,CAAC"}
1
+ {"version":3,"file":"command-object.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/init/command-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,aAAa,EAAE,MAAM,OAAO,CAAC;AAG5C,eAAO,MAAM,gBAAgB,EAAE,aAiC9B,CAAC"}
@@ -7,6 +7,16 @@ exports.yargsInitCommand = {
7
7
  describe: 'Adds Nx to any type of workspace. It installs nx, creates an nx.json configuration file and optionally sets up remote caching. For more info, check https://nx.dev/recipes/adopting-nx.',
8
8
  builder: (yargs) => withInitOptions(yargs),
9
9
  handler: async (args) => {
10
+ // Node 24 has stricter readline behavior, and enquirer is not checking for closed state
11
+ // when invoking operations, thus you get an ERR_USE_AFTER_CLOSE error.
12
+ process.on('uncaughtException', (error) => {
13
+ if (error &&
14
+ typeof error === 'object' &&
15
+ 'code' in error &&
16
+ error['code'] === 'ERR_USE_AFTER_CLOSE')
17
+ return;
18
+ throw error;
19
+ });
10
20
  try {
11
21
  const useV2 = await isInitV2();
12
22
  if (useV2) {
@@ -9,7 +9,7 @@ export interface InitArgs {
9
9
  force?: boolean;
10
10
  aiAgents?: Agent[];
11
11
  }
12
- export declare function initHandler(options: InitArgs): Promise<void>;
12
+ export declare function initHandler(options: InitArgs, inner?: boolean): Promise<void>;
13
13
  export declare function detectPlugins(nxJson: NxJsonConfiguration, interactive: boolean, includeAngularCli?: boolean): Promise<{
14
14
  plugins: string[];
15
15
  updatePackageScripts: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"init-v2.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/init/init-v2.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAc,MAAM,sBAAsB,CAAC;AAavE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAgBvC,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC;CACpB;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAyKlE;AA2BD,wBAAsB,aAAa,CACjC,MAAM,EAAE,mBAAmB,EAC3B,WAAW,EAAE,OAAO,EACpB,iBAAiB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC;IACT,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,oBAAoB,EAAE,OAAO,CAAC;CAC/B,CAAC,CA2JD"}
1
+ {"version":3,"file":"init-v2.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/init/init-v2.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAc,MAAM,sBAAsB,CAAC;AAavE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAkBvC,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC;CACpB;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,QAAQ,EACjB,KAAK,UAAQ,GACZ,OAAO,CAAC,IAAI,CAAC,CA2Bf;AAsMD,wBAAsB,aAAa,CACjC,MAAM,EAAE,mBAAmB,EAC3B,WAAW,EAAE,OAAO,EACpB,iBAAiB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC;IACT,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,oBAAoB,EAAE,OAAO,CAAC;CAC/B,CAAC,CA2JD"}
@@ -24,7 +24,35 @@ const angular_1 = require("./implementation/angular");
24
24
  const add_nx_scripts_1 = require("./implementation/dot-nx/add-nx-scripts");
25
25
  const utils_1 = require("./implementation/utils");
26
26
  const react_1 = require("./implementation/react");
27
- async function initHandler(options) {
27
+ const provenance_1 = require("../../utils/provenance");
28
+ const devkit_internals_1 = require("../../devkit-internals");
29
+ async function initHandler(options, inner = false) {
30
+ // Use environment variable to force local execution
31
+ if (process.env.NX_USE_LOCAL === 'true' || inner) {
32
+ return await initHandlerImpl(options);
33
+ }
34
+ let cleanup;
35
+ try {
36
+ await (0, provenance_1.ensurePackageHasProvenance)('nx', 'latest');
37
+ const packageInstallResults = (0, devkit_internals_1.installPackageToTmp)('nx', 'latest');
38
+ cleanup = packageInstallResults.cleanup;
39
+ let modulePath = require.resolve('nx/src/command-line/init/init-v2.js', {
40
+ paths: [packageInstallResults.tempDir],
41
+ });
42
+ const module = await Promise.resolve(`${modulePath}`).then(s => require(s));
43
+ const result = await module.initHandler(options, true);
44
+ cleanup();
45
+ return result;
46
+ }
47
+ catch (error) {
48
+ if (cleanup) {
49
+ cleanup();
50
+ }
51
+ // Fall back to local implementation
52
+ return initHandlerImpl(options);
53
+ }
54
+ }
55
+ async function initHandlerImpl(options) {
28
56
  process.env.NX_RUNNING_NX_INIT = 'true';
29
57
  const version = process.env.NX_VERSION ?? ((0, semver_1.prerelease)(versions_1.nxVersion) ? versions_1.nxVersion : 'latest');
30
58
  if (process.env.NX_VERSION) {
@@ -1 +1 @@
1
- {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/migrate/migrate.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,cAAc,EAEd,2BAA2B,IAAI,aAAa,EAE7C,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EACL,UAAU,EAIX,MAAM,uBAAuB,CAAC;AAW/B,OAAO,EACL,iBAAiB,EAGjB,WAAW,EAGZ,MAAM,0BAA0B,CAAC;AAwClC,MAAM,WAAW,8BAA+B,SAAQ,cAAc;IACpE,YAAY,CAAC,EAAE,iBAAiB,CAAC;CAClC;AAID,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,UAgC/C;AAUD,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,WAAW,CAAC;IA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AAE,EAC1B,OAAO,EAAE,MAAM,EAAE,mBAmBlB;AAED,wBAAsB,YAAY,kBAgCjC;AAED,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;;;EAWxE;AAED,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,cAAc,EAC1B,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,MAAM,GACX;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAyBpC;AAED,wBAAsB,SAAS,CAAC,eAAe,CAAC,EAAE,MAAM,mBAoEvD"}
@@ -1183,7 +1183,8 @@ async function runMigration() {
1183
1183
  stdio: ['inherit', 'inherit', 'inherit'],
1184
1184
  });
1185
1185
  };
1186
- if (process.env.NX_MIGRATE_USE_LOCAL === undefined) {
1186
+ if (process.env.NX_USE_LOCAL !== 'true' &&
1187
+ process.env.NX_MIGRATE_USE_LOCAL === undefined) {
1187
1188
  const p = await nxCliPath();
1188
1189
  if (p === null) {
1189
1190
  runLocalMigrate();