nx 19.5.1 → 19.5.2

Sign up to get free protection for your applications and to get access to all the features.
package/bin/nx.js CHANGED
@@ -167,7 +167,7 @@ function warnIfUsingOutdatedGlobalInstall(globalNxVersion, localNxVersion) {
167
167
  : [];
168
168
  bodyLines.push('For more information, see https://nx.dev/more-concepts/global-nx');
169
169
  output_1.output.warn({
170
- title: `Its time to update Nx 🎉`,
170
+ title: `It's time to update Nx 🎉`,
171
171
  bodyLines,
172
172
  });
173
173
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "19.5.1",
3
+ "version": "19.5.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": {
@@ -71,7 +71,7 @@
71
71
  "yargs-parser": "21.1.1",
72
72
  "node-machine-id": "1.1.12",
73
73
  "ora": "5.3.0",
74
- "@nrwl/tao": "19.5.1"
74
+ "@nrwl/tao": "19.5.2"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "@swc-node/register": "^1.8.0",
@@ -86,16 +86,16 @@
86
86
  }
87
87
  },
88
88
  "optionalDependencies": {
89
- "@nx/nx-darwin-x64": "19.5.1",
90
- "@nx/nx-darwin-arm64": "19.5.1",
91
- "@nx/nx-linux-x64-gnu": "19.5.1",
92
- "@nx/nx-linux-x64-musl": "19.5.1",
93
- "@nx/nx-win32-x64-msvc": "19.5.1",
94
- "@nx/nx-linux-arm64-gnu": "19.5.1",
95
- "@nx/nx-linux-arm64-musl": "19.5.1",
96
- "@nx/nx-linux-arm-gnueabihf": "19.5.1",
97
- "@nx/nx-win32-arm64-msvc": "19.5.1",
98
- "@nx/nx-freebsd-x64": "19.5.1"
89
+ "@nx/nx-darwin-x64": "19.5.2",
90
+ "@nx/nx-darwin-arm64": "19.5.2",
91
+ "@nx/nx-linux-x64-gnu": "19.5.2",
92
+ "@nx/nx-linux-x64-musl": "19.5.2",
93
+ "@nx/nx-win32-x64-msvc": "19.5.2",
94
+ "@nx/nx-linux-arm64-gnu": "19.5.2",
95
+ "@nx/nx-linux-arm64-musl": "19.5.2",
96
+ "@nx/nx-linux-arm-gnueabihf": "19.5.2",
97
+ "@nx/nx-win32-arm64-msvc": "19.5.2",
98
+ "@nx/nx-freebsd-x64": "19.5.2"
99
99
  },
100
100
  "nx-migrations": {
101
101
  "migrations": "./migrations.json",
@@ -799,13 +799,16 @@ async function getWrappedWorkspaceNodeModulesArchitectHost(workspace, root, proj
799
799
  import: (0, schema_utils_1.resolveImplementation)(executorConfig.implementation, (0, path_1.dirname)(executorsFilePath)),
800
800
  };
801
801
  }
802
- readExecutorsJson(nodeModule, builder) {
803
- const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(nodeModule, this.projects, this.root ? [this.root, __dirname] : [__dirname]);
802
+ readExecutorsJson(nodeModule, builder, extraRequirePaths = []) {
803
+ const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(nodeModule, this.projects, this.root
804
+ ? [this.root, __dirname, ...extraRequirePaths]
805
+ : [__dirname, ...extraRequirePaths]);
804
806
  const executorsFile = packageJson.executors ?? packageJson.builders;
805
807
  if (!executorsFile) {
806
808
  throw new Error(`The "${nodeModule}" package does not support Nx executors or Angular Devkit Builders.`);
807
809
  }
808
- const executorsFilePath = require.resolve((0, path_1.join)((0, path_1.dirname)(packageJsonPath), executorsFile));
810
+ const basePath = (0, path_1.dirname)(packageJsonPath);
811
+ const executorsFilePath = require.resolve((0, path_1.join)(basePath, executorsFile));
809
812
  const executorsJson = (0, fileutils_1.readJsonFile)(executorsFilePath);
810
813
  const executorConfig = executorsJson.builders?.[builder] ?? executorsJson.executors?.[builder];
811
814
  if (!executorConfig) {
@@ -814,7 +817,7 @@ async function getWrappedWorkspaceNodeModulesArchitectHost(workspace, root, proj
814
817
  if (typeof executorConfig === 'string') {
815
818
  // Angular CLI can have a builder pointing to another package:builder
816
819
  const [packageName, executorName] = executorConfig.split(':');
817
- return this.readExecutorsJson(packageName, executorName);
820
+ return this.readExecutorsJson(packageName, executorName, [basePath]);
818
821
  }
819
822
  return { executorsFilePath, executorConfig, isNgCompat: true };
820
823
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.yargsViewLogsCommand = exports.yargsConnectCommand = void 0;
4
4
  const documentation_1 = require("../yargs-utils/documentation");
5
+ const versions_1 = require("../../utils/versions");
5
6
  exports.yargsConnectCommand = {
6
7
  command: 'connect',
7
8
  aliases: ['connect-to-nx-cloud'],
@@ -9,6 +10,11 @@ exports.yargsConnectCommand = {
9
10
  builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)(yargs, 'connect-to-nx-cloud'),
10
11
  handler: async () => {
11
12
  await (await Promise.resolve().then(() => require('./connect-to-nx-cloud'))).connectToNxCloudCommand();
13
+ await (await Promise.resolve().then(() => require('../../utils/ab-testing'))).recordStat({
14
+ command: 'connect',
15
+ nxVersion: versions_1.nxVersion,
16
+ useCloud: true,
17
+ });
12
18
  process.exit(0);
13
19
  },
14
20
  };
@@ -4,5 +4,5 @@ import { MessageKey } from '../../utils/ab-testing';
4
4
  export declare function onlyDefaultRunnerIsUsed(nxJson: NxJsonConfiguration): boolean;
5
5
  export declare function connectToNxCloudIfExplicitlyAsked(opts: NxArgs): Promise<void>;
6
6
  export declare function connectToNxCloudCommand(command?: string): Promise<boolean>;
7
+ export declare function connectExistingRepoToNxCloudPrompt(command?: string, key?: MessageKey): Promise<boolean>;
7
8
  export declare function connectToNxCloudWithPrompt(command: string): Promise<void>;
8
- export declare function connectExistingRepoToNxCloudPrompt(key?: MessageKey): Promise<boolean>;
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.onlyDefaultRunnerIsUsed = onlyDefaultRunnerIsUsed;
4
4
  exports.connectToNxCloudIfExplicitlyAsked = connectToNxCloudIfExplicitlyAsked;
5
5
  exports.connectToNxCloudCommand = connectToNxCloudCommand;
6
- exports.connectToNxCloudWithPrompt = connectToNxCloudWithPrompt;
7
6
  exports.connectExistingRepoToNxCloudPrompt = connectExistingRepoToNxCloudPrompt;
7
+ exports.connectToNxCloudWithPrompt = connectToNxCloudWithPrompt;
8
8
  const output_1 = require("../../utils/output");
9
9
  const configuration_1 = require("../../config/configuration");
10
10
  const tree_1 = require("../../generators/tree");
@@ -71,6 +71,16 @@ async function connectToNxCloudCommand(command) {
71
71
  await callback();
72
72
  return true;
73
73
  }
74
+ async function connectExistingRepoToNxCloudPrompt(command = 'init', key = 'setupNxCloud') {
75
+ const res = await nxCloudPrompt(key).then((value) => value === 'yes');
76
+ await (0, ab_testing_1.recordStat)({
77
+ command,
78
+ nxVersion: versions_1.nxVersion,
79
+ useCloud: res,
80
+ meta: ab_testing_1.messages.codeOfSelectedPromptMessage(key),
81
+ });
82
+ return res;
83
+ }
74
84
  async function connectToNxCloudWithPrompt(command) {
75
85
  const setNxCloud = await nxCloudPrompt('setupNxCloud');
76
86
  const useCloud = setNxCloud === 'yes' ? await connectToNxCloudCommand(command) : false;
@@ -81,9 +91,6 @@ async function connectToNxCloudWithPrompt(command) {
81
91
  meta: ab_testing_1.messages.codeOfSelectedPromptMessage('setupNxCloud'),
82
92
  });
83
93
  }
84
- async function connectExistingRepoToNxCloudPrompt(key = 'setupNxCloud') {
85
- return nxCloudPrompt(key).then((value) => value === 'yes');
86
- }
87
94
  async function nxCloudPrompt(key) {
88
95
  const { message, choices, initial, footer, hint } = ab_testing_1.messages.getPrompt(key);
89
96
  const promptConfig = {
@@ -19,7 +19,7 @@ async function viewLogs() {
19
19
  });
20
20
  return 1;
21
21
  }
22
- const setupNxCloud = await (0, connect_to_nx_cloud_1.connectExistingRepoToNxCloudPrompt)('setupViewLogs');
22
+ const setupNxCloud = await (0, connect_to_nx_cloud_1.connectExistingRepoToNxCloudPrompt)('view-logs', 'setupViewLogs');
23
23
  if (!setupNxCloud) {
24
24
  return;
25
25
  }
@@ -120,6 +120,7 @@ function nxCliPath() {
120
120
  },
121
121
  license: 'MIT',
122
122
  });
123
+ (0, package_manager_1.copyPackageManagerConfigurationFiles)(workspace_root_1.workspaceRoot, tmpDir);
123
124
  if (pmc.preInstall) {
124
125
  // ensure package.json and repo in tmp folder is set to a proper package manager state
125
126
  (0, child_process_2.execSync)(pmc.preInstall, {
@@ -53,15 +53,22 @@ function getExecutorInformation(nodeModule, executor, root, projects) {
53
53
  throw new Error(`Unable to resolve ${nodeModule}:${executor}.\n${e.message}`);
54
54
  }
55
55
  }
56
- function readExecutorJson(nodeModule, executor, root, projects) {
56
+ function readExecutorJson(nodeModule, executor, root, projects, extraRequirePaths = []) {
57
57
  const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(nodeModule, projects, root
58
- ? [root, __dirname, process.cwd(), ...(0, installation_directory_1.getNxRequirePaths)()]
59
- : [__dirname, process.cwd(), ...(0, installation_directory_1.getNxRequirePaths)()]);
58
+ ? [
59
+ root,
60
+ __dirname,
61
+ process.cwd(),
62
+ ...(0, installation_directory_1.getNxRequirePaths)(),
63
+ ...extraRequirePaths,
64
+ ]
65
+ : [__dirname, process.cwd(), ...(0, installation_directory_1.getNxRequirePaths)(), ...extraRequirePaths]);
60
66
  const executorsFile = packageJson.executors ?? packageJson.builders;
61
67
  if (!executorsFile) {
62
68
  throw new Error(`The "${nodeModule}" package does not support Nx executors.`);
63
69
  }
64
- const executorsFilePath = require.resolve((0, path_1.join)((0, path_1.dirname)(packageJsonPath), executorsFile));
70
+ const basePath = (0, path_1.dirname)(packageJsonPath);
71
+ const executorsFilePath = require.resolve((0, path_1.join)(basePath, executorsFile));
65
72
  const executorsJson = (0, fileutils_1.readJsonFile)(executorsFilePath);
66
73
  const executorConfig = executorsJson.executors?.[executor] || executorsJson.builders?.[executor];
67
74
  if (!executorConfig) {
@@ -70,7 +77,9 @@ function readExecutorJson(nodeModule, executor, root, projects) {
70
77
  if (typeof executorConfig === 'string') {
71
78
  // Angular CLI can have a builder pointing to another package:builder
72
79
  const [packageName, executorName] = executorConfig.split(':');
73
- return readExecutorJson(packageName, executorName, root, projects);
80
+ return readExecutorJson(packageName, executorName, root, projects, [
81
+ basePath,
82
+ ]);
74
83
  }
75
84
  const isNgCompat = !executorsJson.executors?.[executor];
76
85
  return { executorsFilePath, executorConfig, isNgCompat };