nx 17.3.0 → 17.3.2

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 (57) hide show
  1. package/bin/init-local.js +1 -34
  2. package/bin/run-executor.js +1 -1
  3. package/package.json +14 -14
  4. package/src/adapter/compat.d.ts +1 -1
  5. package/src/adapter/compat.js +1 -0
  6. package/src/command-line/affected/command-object.d.ts +4 -4
  7. package/src/command-line/affected/command-object.js +4 -4
  8. package/src/command-line/graph/graph.js +1 -1
  9. package/src/command-line/init/implementation/utils.js +1 -0
  10. package/src/command-line/init/init-v1.js +1 -1
  11. package/src/command-line/nx-commands.js +1 -0
  12. package/src/command-line/report/report.js +1 -1
  13. package/src/command-line/run/command-object.d.ts +4 -0
  14. package/src/command-line/run/command-object.js +10 -1
  15. package/src/command-line/run/run-one.js +2 -2
  16. package/src/command-line/yargs-utils/shared-options.js +4 -1
  17. package/src/config/project-graph.d.ts +2 -2
  18. package/src/config/workspaces.d.ts +1 -1
  19. package/src/config/workspaces.js +2 -2
  20. package/src/core/graph/main.js +1 -1
  21. package/src/core/graph/styles.css +1 -1
  22. package/src/daemon/client/client.js +1 -1
  23. package/src/devkit-exports.js +1 -1
  24. package/src/executors/run-script/run-script.impl.js +41 -19
  25. package/src/hasher/hash-task.js +1 -1
  26. package/src/hasher/task-hasher.d.ts +4 -4
  27. package/src/nx-cloud/generators/connect-to-nx-cloud/schema.json +1 -1
  28. package/src/plugins/js/project-graph/build-dependencies/strip-source-code.d.ts +1 -1
  29. package/src/plugins/js/project-graph/build-dependencies/strip-source-code.js +1 -1
  30. package/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.d.ts +1 -1
  31. package/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.js +1 -1
  32. package/src/plugins/js/utils/register.d.ts +1 -1
  33. package/src/plugins/js/utils/register.js +2 -0
  34. package/src/plugins/package-json-workspaces/create-nodes.js +23 -2
  35. package/src/plugins/target-defaults/target-defaults-plugin.js +28 -22
  36. package/src/project-graph/file-utils.d.ts +1 -1
  37. package/src/project-graph/file-utils.js +2 -2
  38. package/src/project-graph/nx-deps-cache.js +1 -1
  39. package/src/project-graph/project-graph-builder.d.ts +1 -1
  40. package/src/project-graph/project-graph-builder.js +1 -1
  41. package/src/tasks-runner/create-task-graph.js +1 -1
  42. package/src/tasks-runner/init-tasks-runner.js +1 -1
  43. package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +2 -4
  44. package/src/tasks-runner/life-cycles/empty-terminal-output-life-cycle.js +1 -2
  45. package/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.js +1 -2
  46. package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +1 -2
  47. package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +1 -2
  48. package/src/tasks-runner/run-command.js +4 -4
  49. package/src/tasks-runner/task-env.js +1 -2
  50. package/src/tasks-runner/utils.d.ts +1 -1
  51. package/src/utils/nx-plugin.deprecated.d.ts +6 -6
  52. package/src/utils/nx-plugin.deprecated.js +1 -1
  53. package/src/utils/output.d.ts +3 -0
  54. package/src/utils/output.js +35 -2
  55. package/src/utils/package-json.d.ts +1 -2
  56. package/src/utils/typescript.js +1 -1
  57. package/src/utils/workspace-configuration-check.js +1 -1
package/bin/init-local.js CHANGED
@@ -37,8 +37,7 @@ function initLocal(workspace) {
37
37
  }
38
38
  }
39
39
  else {
40
- const newArgs = rewritePositionalArguments(process.argv);
41
- nx_commands_1.commandsObject.parse(newArgs);
40
+ nx_commands_1.commandsObject.parse(process.argv.slice(2));
42
41
  }
43
42
  }
44
43
  catch (e) {
@@ -78,38 +77,6 @@ function rewriteTargetsAndProjects(args) {
78
77
  return newArgs;
79
78
  }
80
79
  exports.rewriteTargetsAndProjects = rewriteTargetsAndProjects;
81
- function rewritePositionalArguments(args) {
82
- const relevantPositionalArgs = [];
83
- const rest = [];
84
- for (let i = 2; i < args.length; i++) {
85
- if (args[i] === '--') {
86
- rest.push(...args.slice(i + 1));
87
- break;
88
- }
89
- else if (!args[i].startsWith('-')) {
90
- relevantPositionalArgs.push(args[i]);
91
- if (relevantPositionalArgs.length === 2) {
92
- rest.push(...args.slice(i + 1));
93
- break;
94
- }
95
- }
96
- else {
97
- rest.push(args[i]);
98
- }
99
- }
100
- if (relevantPositionalArgs.length === 1) {
101
- return [
102
- 'run',
103
- `${wrapIntoQuotesIfNeeded(relevantPositionalArgs[0])}`,
104
- ...rest,
105
- ];
106
- }
107
- return [
108
- 'run',
109
- `${relevantPositionalArgs[1]}:${wrapIntoQuotesIfNeeded(relevantPositionalArgs[0])}`,
110
- ...rest,
111
- ];
112
- }
113
80
  function wrapIntoQuotesIfNeeded(arg) {
114
81
  return arg.indexOf(':') > -1 ? `"${arg}"` : arg;
115
82
  }
@@ -60,7 +60,7 @@ process.on('message', async (message) => {
60
60
  process.exit(statusCode);
61
61
  }
62
62
  catch (e) {
63
- console.error(`Could not find 'nx' module in this workspace.`, e);
63
+ console.error(e);
64
64
  process.exit(1);
65
65
  }
66
66
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "17.3.0",
3
+ "version": "17.3.2",
4
4
  "private": false,
5
5
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
6
6
  "repository": {
@@ -36,7 +36,7 @@
36
36
  "@yarnpkg/lockfile": "^1.1.0",
37
37
  "@yarnpkg/parsers": "3.0.0-rc.46",
38
38
  "@zkochan/js-yaml": "0.0.6",
39
- "axios": "^1.5.1",
39
+ "axios": "^1.6.0",
40
40
  "chalk": "^4.1.0",
41
41
  "cli-cursor": "3.1.0",
42
42
  "cli-spinners": "2.6.1",
@@ -55,7 +55,7 @@
55
55
  "minimatch": "9.0.3",
56
56
  "npm-run-path": "^4.0.1",
57
57
  "open": "^8.4.0",
58
- "semver": "7.5.3",
58
+ "semver": "^7.5.3",
59
59
  "string-width": "^4.2.3",
60
60
  "strong-log-transformer": "^2.1.0",
61
61
  "tar-stream": "~2.2.0",
@@ -66,7 +66,7 @@
66
66
  "yargs-parser": "21.1.1",
67
67
  "node-machine-id": "1.1.12",
68
68
  "ora": "5.3.0",
69
- "@nrwl/tao": "17.3.0"
69
+ "@nrwl/tao": "17.3.2"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@swc-node/register": "^1.6.7",
@@ -81,16 +81,16 @@
81
81
  }
82
82
  },
83
83
  "optionalDependencies": {
84
- "@nx/nx-darwin-x64": "17.3.0",
85
- "@nx/nx-darwin-arm64": "17.3.0",
86
- "@nx/nx-linux-x64-gnu": "17.3.0",
87
- "@nx/nx-linux-x64-musl": "17.3.0",
88
- "@nx/nx-win32-x64-msvc": "17.3.0",
89
- "@nx/nx-linux-arm64-gnu": "17.3.0",
90
- "@nx/nx-linux-arm64-musl": "17.3.0",
91
- "@nx/nx-linux-arm-gnueabihf": "17.3.0",
92
- "@nx/nx-win32-arm64-msvc": "17.3.0",
93
- "@nx/nx-freebsd-x64": "17.3.0"
84
+ "@nx/nx-darwin-x64": "17.3.2",
85
+ "@nx/nx-darwin-arm64": "17.3.2",
86
+ "@nx/nx-linux-x64-gnu": "17.3.2",
87
+ "@nx/nx-linux-x64-musl": "17.3.2",
88
+ "@nx/nx-win32-x64-msvc": "17.3.2",
89
+ "@nx/nx-linux-arm64-gnu": "17.3.2",
90
+ "@nx/nx-linux-arm64-musl": "17.3.2",
91
+ "@nx/nx-linux-arm-gnueabihf": "17.3.2",
92
+ "@nx/nx-win32-arm64-msvc": "17.3.2",
93
+ "@nx/nx-freebsd-x64": "17.3.2"
94
94
  },
95
95
  "nx-migrations": {
96
96
  "migrations": "./migrations.json",
@@ -1,2 +1,2 @@
1
- export declare const allowedProjectExtensions: readonly ["tags", "implicitDependencies", "configFilePath", "$schema", "generators", "namedInputs", "name", "files", "root", "sourceRoot", "projectType", "release"];
1
+ export declare const allowedProjectExtensions: readonly ["tags", "implicitDependencies", "configFilePath", "$schema", "generators", "namedInputs", "name", "files", "root", "sourceRoot", "projectType", "release", "includedScripts"];
2
2
  export declare const allowedWorkspaceExtensions: readonly ["implicitDependencies", "affected", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess"];
@@ -27,6 +27,7 @@ exports.allowedProjectExtensions = [
27
27
  'sourceRoot',
28
28
  'projectType',
29
29
  'release',
30
+ 'includedScripts',
30
31
  ];
31
32
  // If we pass props on the workspace that angular doesn't know about,
32
33
  // it throws a warning that users see. We want to pass them still,
@@ -4,13 +4,13 @@ export declare const yargsAffectedTestCommand: CommandModule;
4
4
  export declare const yargsAffectedBuildCommand: CommandModule;
5
5
  export declare const yargsAffectedLintCommand: CommandModule;
6
6
  export declare const yargsAffectedE2ECommand: CommandModule;
7
- export declare const affectedGraphDeprecationMessage = "Use `nx graph --affected`, or `nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 18.";
7
+ export declare const affectedGraphDeprecationMessage = "Use `nx graph --affected`, or `nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 19.";
8
8
  /**
9
- * @deprecated 'Use `nx graph --affected`, or` nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 18.'
9
+ * @deprecated 'Use `nx graph --affected`, or` nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 19.'
10
10
  */
11
11
  export declare const yargsAffectedGraphCommand: CommandModule;
12
- export declare const printAffectedDeprecationMessage = "Use `nx show projects --affected`, `nx affected --graph -t build` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command will be removed in Nx 18.";
12
+ export declare const printAffectedDeprecationMessage = "Use `nx show projects --affected`, `nx affected --graph -t build` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command will be removed in Nx 19.";
13
13
  /**
14
- * @deprecated 'Use `nx show --affected`, `nx affected --graph` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command will be removed in Nx 18.'
14
+ * @deprecated 'Use `nx show --affected`, `nx affected --graph` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command will be removed in Nx 19.'
15
15
  */
16
16
  export declare const yargsPrintAffectedCommand: CommandModule;
@@ -54,9 +54,9 @@ exports.yargsAffectedE2ECommand = {
54
54
  target: 'e2e',
55
55
  }),
56
56
  };
57
- exports.affectedGraphDeprecationMessage = 'Use `nx graph --affected`, or `nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 18.';
57
+ exports.affectedGraphDeprecationMessage = 'Use `nx graph --affected`, or `nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 19.';
58
58
  /**
59
- * @deprecated 'Use `nx graph --affected`, or` nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 18.'
59
+ * @deprecated 'Use `nx graph --affected`, or` nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 19.'
60
60
  */
61
61
  exports.yargsAffectedGraphCommand = {
62
62
  command: 'affected:graph',
@@ -68,9 +68,9 @@ exports.yargsAffectedGraphCommand = {
68
68
  }),
69
69
  deprecated: exports.affectedGraphDeprecationMessage,
70
70
  };
71
- exports.printAffectedDeprecationMessage = 'Use `nx show projects --affected`, `nx affected --graph -t build` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command will be removed in Nx 18.';
71
+ exports.printAffectedDeprecationMessage = 'Use `nx show projects --affected`, `nx affected --graph -t build` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command will be removed in Nx 19.';
72
72
  /**
73
- * @deprecated 'Use `nx show --affected`, `nx affected --graph` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command will be removed in Nx 18.'
73
+ * @deprecated 'Use `nx show --affected`, `nx affected --graph` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command will be removed in Nx 19.'
74
74
  */
75
75
  exports.yargsPrintAffectedCommand = {
76
76
  command: 'print-affected',
@@ -244,7 +244,7 @@ async function generateGraph(args, affectedProjects) {
244
244
  '- affectedProjects',
245
245
  '- criticalPath',
246
246
  '',
247
- 'These fields will be removed in Nx 18. If you need to see which projects were affected, use `nx show projects --affected`.',
247
+ 'These fields will be removed in Nx 19. If you need to see which projects were affected, use `nx show projects --affected`.',
248
248
  ],
249
249
  });
250
250
  output_1.output.success({
@@ -18,6 +18,7 @@ function createNxJsonFile(repoRoot, topologicalTargets, cacheableOperations, scr
18
18
  // eslint-disable-next-line no-empty
19
19
  }
20
20
  catch { }
21
+ nxJson.$schema = './node_modules/nx/schemas/nx-schema.json';
21
22
  nxJson.targetDefaults ??= {};
22
23
  if (topologicalTargets.length > 0) {
23
24
  for (const scriptName of topologicalTargets) {
@@ -114,5 +114,5 @@ function setupDotNxInstallation(version) {
114
114
  }
115
115
  (0, add_nx_scripts_1.generateDotNxSetup)(version);
116
116
  // invokes the wrapper, thus invoking the initial installation process
117
- (0, child_process_2.runNxSync)('');
117
+ (0, child_process_2.runNxSync)('--version');
118
118
  }
@@ -68,6 +68,7 @@ exports.commandsObject = yargs
68
68
  .command(command_object_16.yargsShowCommand)
69
69
  .command(command_object_2.yargsViewLogsCommand)
70
70
  .command(command_object_17.yargsWatchCommand)
71
+ .command(command_object_14.yargsNxInfixCommand)
71
72
  .scriptName('nx')
72
73
  .help()
73
74
  // NOTE: we handle --version in nx.ts, this just tells yargs that the option exists
@@ -180,7 +180,7 @@ function findInstalledCommunityPlugins() {
180
180
  exports.findInstalledCommunityPlugins = findInstalledCommunityPlugins;
181
181
  function findInstalledPackagesWeCareAbout() {
182
182
  const packagesWeMayCareAbout = {};
183
- // TODO (v18): Remove workaround for hiding @nrwl packages when matching @nx package is found.
183
+ // TODO (v19): Remove workaround for hiding @nrwl packages when matching @nx package is found.
184
184
  const packageChangeMap = {
185
185
  '@nrwl/nx-plugin': '@nx/plugin',
186
186
  '@nx/plugin': '@nrwl/nx-plugin',
@@ -1,2 +1,6 @@
1
1
  import { CommandModule } from 'yargs';
2
2
  export declare const yargsRunCommand: CommandModule;
3
+ /**
4
+ * Handles the infix notation for running a target.
5
+ */
6
+ export declare const yargsNxInfixCommand: CommandModule;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.yargsRunCommand = void 0;
3
+ exports.yargsNxInfixCommand = exports.yargsRunCommand = void 0;
4
4
  const shared_options_1 = require("../yargs-utils/shared-options");
5
5
  exports.yargsRunCommand = {
6
6
  command: 'run [project][:target][:configuration] [_..]',
@@ -14,3 +14,12 @@ exports.yargsRunCommand = {
14
14
  builder: (yargs) => (0, shared_options_1.withRunOneOptions)((0, shared_options_1.withBatch)(yargs)),
15
15
  handler: async (args) => (await Promise.resolve().then(() => require('./run-one'))).runOne(process.cwd(), (0, shared_options_1.withOverrides)(args)),
16
16
  };
17
+ /**
18
+ * Handles the infix notation for running a target.
19
+ */
20
+ exports.yargsNxInfixCommand = {
21
+ ...exports.yargsRunCommand,
22
+ command: '$0 <target> [project] [_..]',
23
+ describe: 'Run a target for a project',
24
+ handler: async (args) => (await Promise.resolve().then(() => require('./run-one'))).runOne(process.cwd(), (0, shared_options_1.withOverrides)(args, 0)),
25
+ };
@@ -77,7 +77,7 @@ function parseRunOneOptions(cwd, parsedArgs, projectGraph, nxJson) {
77
77
  let project;
78
78
  let target;
79
79
  let configuration;
80
- if (parsedArgs['project:target:configuration'].indexOf(':') > -1) {
80
+ if (parsedArgs['project:target:configuration']?.indexOf(':') > -1) {
81
81
  // run case
82
82
  [project, target, configuration] = (0, split_target_1.splitTarget)(parsedArgs['project:target:configuration'], projectGraph);
83
83
  // this is to account for "nx npmsript:dev"
@@ -87,7 +87,7 @@ function parseRunOneOptions(cwd, parsedArgs, projectGraph, nxJson) {
87
87
  }
88
88
  }
89
89
  else {
90
- target = parsedArgs['project:target:configuration'];
90
+ target = parsedArgs.target ?? parsedArgs['project:target:configuration'];
91
91
  }
92
92
  if (parsedArgs.project) {
93
93
  project = parsedArgs.project;
@@ -273,7 +273,10 @@ function parseCSV(args) {
273
273
  return [];
274
274
  }
275
275
  if (Array.isArray(args)) {
276
- return args;
276
+ // If parseCSV is used on `type: 'array'`, the first option may be something like ['a,b,c'].
277
+ return args.length === 1 && args[0].includes(',')
278
+ ? parseCSV(args[0])
279
+ : args;
277
280
  }
278
281
  const items = args.split(',');
279
282
  return items.map((i) => i.startsWith('"') && i.endsWith('"') ? i.slice(1, -1) : i);
@@ -111,7 +111,7 @@ export interface ProjectGraphDependency {
111
111
  }
112
112
  /**
113
113
  * Additional information to be used to process a project graph
114
- * @deprecated The {@link ProjectGraphProcessor} is deprecated. This will be removed in Nx 18.
114
+ * @deprecated The {@link ProjectGraphProcessor} is deprecated. This will be removed in Nx 19.
115
115
  */
116
116
  export interface ProjectGraphProcessorContext {
117
117
  /**
@@ -132,6 +132,6 @@ export interface ProjectGraphProcessorContext {
132
132
  }
133
133
  /**
134
134
  * A function that produces an updated ProjectGraph
135
- * @deprecated Use {@link CreateNodes} and {@link CreateDependencies} instead. This will be removed in Nx 18.
135
+ * @deprecated Use {@link CreateNodes} and {@link CreateDependencies} instead. This will be removed in Nx 19.
136
136
  */
137
137
  export type ProjectGraphProcessor = (currentGraph: ProjectGraph, context: ProjectGraphProcessorContext) => ProjectGraph | Promise<ProjectGraph>;
@@ -1,7 +1,7 @@
1
1
  import type { NxJsonConfiguration } from './nx-json';
2
2
  import { ProjectsConfigurations } from './workspace-json-project-json';
3
3
  /**
4
- * @deprecated This will be removed in v18. Use {@link readProjectsConfigurationFromProjectGraph} instead.
4
+ * @deprecated This will be removed in v19. Use {@link readProjectsConfigurationFromProjectGraph} instead.
5
5
  */
6
6
  export declare class Workspaces {
7
7
  private root;
@@ -4,9 +4,9 @@ exports.toProjectName = exports.Workspaces = void 0;
4
4
  const path_1 = require("path");
5
5
  const project_graph_1 = require("../project-graph/project-graph");
6
6
  const nx_json_1 = require("./nx-json");
7
- // TODO(v18): remove this class
7
+ // TODO(v19): remove this class
8
8
  /**
9
- * @deprecated This will be removed in v18. Use {@link readProjectsConfigurationFromProjectGraph} instead.
9
+ * @deprecated This will be removed in v19. Use {@link readProjectsConfigurationFromProjectGraph} instead.
10
10
  */
11
11
  class Workspaces {
12
12
  constructor(root) {