nx 19.0.0-rc.0 → 19.0.0-rc.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "19.0.0-rc.0",
3
+ "version": "19.0.0-rc.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": {
@@ -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": "19.0.0-rc.0"
69
+ "@nrwl/tao": "19.0.0-rc.2"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@swc-node/register": "^1.8.0",
@@ -81,16 +81,16 @@
81
81
  }
82
82
  },
83
83
  "optionalDependencies": {
84
- "@nx/nx-darwin-x64": "19.0.0-rc.0",
85
- "@nx/nx-darwin-arm64": "19.0.0-rc.0",
86
- "@nx/nx-linux-x64-gnu": "19.0.0-rc.0",
87
- "@nx/nx-linux-x64-musl": "19.0.0-rc.0",
88
- "@nx/nx-win32-x64-msvc": "19.0.0-rc.0",
89
- "@nx/nx-linux-arm64-gnu": "19.0.0-rc.0",
90
- "@nx/nx-linux-arm64-musl": "19.0.0-rc.0",
91
- "@nx/nx-linux-arm-gnueabihf": "19.0.0-rc.0",
92
- "@nx/nx-win32-arm64-msvc": "19.0.0-rc.0",
93
- "@nx/nx-freebsd-x64": "19.0.0-rc.0"
84
+ "@nx/nx-darwin-x64": "19.0.0-rc.2",
85
+ "@nx/nx-darwin-arm64": "19.0.0-rc.2",
86
+ "@nx/nx-linux-x64-gnu": "19.0.0-rc.2",
87
+ "@nx/nx-linux-x64-musl": "19.0.0-rc.2",
88
+ "@nx/nx-win32-x64-msvc": "19.0.0-rc.2",
89
+ "@nx/nx-linux-arm64-gnu": "19.0.0-rc.2",
90
+ "@nx/nx-linux-arm64-musl": "19.0.0-rc.2",
91
+ "@nx/nx-linux-arm-gnueabihf": "19.0.0-rc.2",
92
+ "@nx/nx-win32-arm64-msvc": "19.0.0-rc.2",
93
+ "@nx/nx-freebsd-x64": "19.0.0-rc.2"
94
94
  },
95
95
  "nx-migrations": {
96
96
  "migrations": "./migrations.json",
@@ -1,2 +1,3 @@
1
1
  import type { AddOptions } from './command-object';
2
2
  export declare function addHandler(options: AddOptions): Promise<void>;
3
+ export declare const coreNxPluginVersions: Map<string, string>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addHandler = void 0;
3
+ exports.coreNxPluginVersions = exports.addHandler = void 0;
4
4
  const child_process_1 = require("child_process");
5
5
  const fs_1 = require("fs");
6
6
  const ora = require("ora");
@@ -15,6 +15,7 @@ const params_1 = require("../../utils/params");
15
15
  const plugins_1 = require("../../utils/plugins");
16
16
  const versions_1 = require("../../utils/versions");
17
17
  const workspace_root_1 = require("../../utils/workspace-root");
18
+ const add_nx_scripts_1 = require("../init/implementation/dot-nx/add-nx-scripts");
18
19
  function addHandler(options) {
19
20
  if (options.verbose) {
20
21
  process.env.NX_VERBOSE_LOGGING = 'true';
@@ -52,7 +53,7 @@ async function installPackage(pkgName, version, nxJson) {
52
53
  }
53
54
  else {
54
55
  nxJson.installation.plugins ??= {};
55
- nxJson.installation.plugins[pkgName] = version;
56
+ nxJson.installation.plugins[pkgName] = (0, add_nx_scripts_1.normalizeVersionForNxJson)(pkgName, version);
56
57
  (0, fileutils_1.writeJsonFile)('nx.json', nxJson);
57
58
  try {
58
59
  await (0, child_process_2.runNxAsync)('--help', { silent: true });
@@ -92,7 +93,7 @@ async function initializePlugin(pkgName, options, nxJson) {
92
93
  spinner.start();
93
94
  try {
94
95
  const args = [];
95
- if (coreNxPlugins.includes(pkgName)) {
96
+ if (exports.coreNxPluginVersions.has(pkgName)) {
96
97
  args.push(`--keepExistingVersions`);
97
98
  if (options.updatePackageScripts ||
98
99
  (options.updatePackageScripts === undefined &&
@@ -133,8 +134,8 @@ function findInitGenerator(generators) {
133
134
  function parsePackageSpecifier(packageSpecifier) {
134
135
  const i = packageSpecifier.lastIndexOf('@');
135
136
  if (i <= 0) {
136
- if (coreNxPlugins.includes(packageSpecifier)) {
137
- return [packageSpecifier, versions_1.nxVersion];
137
+ if (exports.coreNxPluginVersions.has(packageSpecifier)) {
138
+ return [packageSpecifier, exports.coreNxPluginVersions.get(packageSpecifier)];
138
139
  }
139
140
  return [packageSpecifier, 'latest'];
140
141
  }
@@ -142,31 +143,10 @@ function parsePackageSpecifier(packageSpecifier) {
142
143
  const version = packageSpecifier.substring(i + 1);
143
144
  return [pkgName, version];
144
145
  }
145
- const coreNxPlugins = [
146
- '@nx/angular',
147
- '@nx/cypress',
148
- '@nx/detox',
149
- '@nx/devkit',
150
- '@nx/esbuild',
151
- '@nx/eslint',
152
- '@nx/eslint-plugin',
153
- '@nx/expo',
154
- '@nx/express',
155
- '@nx/jest',
156
- '@nx/nest',
157
- '@nx/next',
158
- '@nx/node',
159
- '@nx/nuxt',
160
- '@nx/playwright',
161
- '@nx/plugin',
162
- '@nx/react',
163
- '@nx/react-native',
164
- '@nx/remix',
165
- '@nx/rollup',
166
- '@nx/storybook',
167
- '@nx/vite',
168
- '@nx/vue',
169
- '@nx/web',
170
- '@nx/webpack',
171
- '@nx/workspace',
172
- ];
146
+ exports.coreNxPluginVersions = require('../../../package.json')['nx-migrations'].packageGroup.reduce((map, entry) => {
147
+ const packageName = typeof entry === 'string' ? entry : entry.package;
148
+ const version = typeof entry === 'string' ? versions_1.nxVersion : entry.version;
149
+ return map.set(packageName, version);
150
+ },
151
+ // Package Name -> Desired Version
152
+ new Map());
@@ -3,10 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.connectExistingRepoToNxCloudPrompt = exports.connectToNxCloudWithPrompt = exports.connectToNxCloudCommand = exports.connectToNxCloudIfExplicitlyAsked = exports.onlyDefaultRunnerIsUsed = void 0;
4
4
  const output_1 = require("../../utils/output");
5
5
  const configuration_1 = require("../../config/configuration");
6
+ const tree_1 = require("../../generators/tree");
7
+ const connect_to_nx_cloud_1 = require("../../nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud");
6
8
  const nx_cloud_utils_1 = require("../../utils/nx-cloud-utils");
7
9
  const child_process_1 = require("../../utils/child-process");
8
10
  const ab_testing_1 = require("../../utils/ab-testing");
9
11
  const versions_1 = require("../../utils/versions");
12
+ const workspace_root_1 = require("../../utils/workspace-root");
10
13
  const chalk = require("chalk");
11
14
  function onlyDefaultRunnerIsUsed(nxJson) {
12
15
  const defaultRunner = nxJson.tasksRunnerOptions?.default?.runner;
@@ -49,9 +52,11 @@ async function connectToNxCloudCommand() {
49
52
  });
50
53
  return false;
51
54
  }
52
- (0, child_process_1.runNxSync)(`g nx:connect-to-nx-cloud --quiet --no-interactive`, {
53
- stdio: [0, 1, 2],
54
- });
55
+ const tree = new tree_1.FsTree(workspace_root_1.workspaceRoot, false, 'connect-to-nx-cloud');
56
+ const callback = await (0, connect_to_nx_cloud_1.connectToNxCloud)(tree, {});
57
+ tree.lock();
58
+ (0, tree_1.flushChanges)(workspace_root_1.workspaceRoot, tree.listChanges());
59
+ callback();
55
60
  return true;
56
61
  }
57
62
  exports.connectToNxCloudCommand = connectToNxCloudCommand;
@@ -1,6 +1,7 @@
1
1
  import { Tree } from '../../../../generators/tree';
2
2
  export declare const nxWrapperPath: (p?: typeof import('path')) => string;
3
3
  export declare function generateDotNxSetup(version?: string): void;
4
+ export declare function normalizeVersionForNxJson(pkg: string, version: string): string;
4
5
  export declare function writeMinimalNxJson(host: Tree, version: string): void;
5
6
  export declare function updateGitIgnore(host: Tree): void;
6
7
  export declare function getNxWrapperContents(): string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sanitizeWrapperScript = exports.getNxWrapperContents = exports.updateGitIgnore = exports.writeMinimalNxJson = exports.generateDotNxSetup = exports.nxWrapperPath = void 0;
3
+ exports.sanitizeWrapperScript = exports.getNxWrapperContents = exports.updateGitIgnore = exports.writeMinimalNxJson = exports.normalizeVersionForNxJson = exports.generateDotNxSetup = exports.nxWrapperPath = void 0;
4
4
  const child_process_1 = require("child_process");
5
5
  const fs_1 = require("fs");
6
6
  const path = require("path");
@@ -36,29 +36,18 @@ function generateDotNxSetup(version) {
36
36
  (0, tree_1.flushChanges)(host.root, changes);
37
37
  }
38
38
  exports.generateDotNxSetup = generateDotNxSetup;
39
+ function normalizeVersionForNxJson(pkg, version) {
40
+ if (!(0, semver_1.valid)(version)) {
41
+ version = (0, child_process_1.execSync)(`npm view ${pkg}@${version} version`).toString();
42
+ }
43
+ return version.trimEnd();
44
+ }
45
+ exports.normalizeVersionForNxJson = normalizeVersionForNxJson;
39
46
  function writeMinimalNxJson(host, version) {
40
47
  if (!host.exists('nx.json')) {
41
- if (!(0, semver_1.valid)(version)) {
42
- version = (0, child_process_1.execSync)(`npm view nx@${version} version`).toString();
43
- }
44
48
  (0, json_1.writeJson)(host, 'nx.json', {
45
- targetDefaults: {
46
- build: {
47
- cache: true,
48
- dependsOn: ['^build'],
49
- },
50
- lint: {
51
- cache: true,
52
- },
53
- test: {
54
- cache: true,
55
- },
56
- e2e: {
57
- cache: true,
58
- },
59
- },
60
49
  installation: {
61
- version: version.trimEnd(),
50
+ version: normalizeVersionForNxJson('nx', version),
62
51
  },
63
52
  });
64
53
  }