nx 22.4.2 → 22.4.3

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": "22.4.2",
3
+ "version": "22.4.3",
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": {
@@ -83,16 +83,16 @@
83
83
  }
84
84
  },
85
85
  "optionalDependencies": {
86
- "@nx/nx-darwin-arm64": "22.4.2",
87
- "@nx/nx-darwin-x64": "22.4.2",
88
- "@nx/nx-freebsd-x64": "22.4.2",
89
- "@nx/nx-linux-arm-gnueabihf": "22.4.2",
90
- "@nx/nx-linux-arm64-gnu": "22.4.2",
91
- "@nx/nx-linux-arm64-musl": "22.4.2",
92
- "@nx/nx-linux-x64-gnu": "22.4.2",
93
- "@nx/nx-linux-x64-musl": "22.4.2",
94
- "@nx/nx-win32-arm64-msvc": "22.4.2",
95
- "@nx/nx-win32-x64-msvc": "22.4.2"
86
+ "@nx/nx-darwin-arm64": "22.4.3",
87
+ "@nx/nx-darwin-x64": "22.4.3",
88
+ "@nx/nx-freebsd-x64": "22.4.3",
89
+ "@nx/nx-linux-arm-gnueabihf": "22.4.3",
90
+ "@nx/nx-linux-arm64-gnu": "22.4.3",
91
+ "@nx/nx-linux-arm64-musl": "22.4.3",
92
+ "@nx/nx-linux-x64-gnu": "22.4.3",
93
+ "@nx/nx-linux-x64-musl": "22.4.3",
94
+ "@nx/nx-win32-arm64-msvc": "22.4.3",
95
+ "@nx/nx-win32-x64-msvc": "22.4.3"
96
96
  },
97
97
  "nx-migrations": {
98
98
  "migrations": "./migrations.json",
@@ -1 +1 @@
1
- {"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/import/import.ts"],"names":[],"mappings":"AAsCA,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,iBA4TzD"}
1
+ {"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/import/import.ts"],"names":[],"mappings":"AAwCA,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,iBAmUzD"}
@@ -12,6 +12,7 @@ const output_1 = require("../../utils/output");
12
12
  const createSpinner = require('ora');
13
13
  const init_v2_1 = require("../init/init-v2");
14
14
  const nx_json_1 = require("../../config/nx-json");
15
+ const fileutils_1 = require("../../utils/fileutils");
15
16
  const workspace_root_1 = require("../../utils/workspace-root");
16
17
  const package_manager_1 = require("../../utils/package-manager");
17
18
  const workspace_context_1 = require("../../utils/workspace-context");
@@ -154,7 +155,14 @@ async function importHandler(options) {
154
155
  const pmc = (0, package_manager_1.getPackageManagerCommand)();
155
156
  const nxJson = (0, nx_json_1.readNxJson)(workspace_root_1.workspaceRoot);
156
157
  (0, workspace_context_1.resetWorkspaceContext)();
157
- const { plugins, updatePackageScripts } = await (0, init_v2_1.detectPlugins)(nxJson, options.interactive, true);
158
+ let packageJson;
159
+ try {
160
+ packageJson = (0, fileutils_1.readJsonFile)('package.json');
161
+ }
162
+ catch {
163
+ packageJson = null;
164
+ }
165
+ const { plugins, updatePackageScripts } = await (0, init_v2_1.detectPlugins)(nxJson, packageJson, options.interactive, true);
158
166
  if (packageManager !== sourcePackageManager) {
159
167
  output_1.output.warn({
160
168
  title: `Mismatched package managers`,
@@ -1,4 +1,5 @@
1
1
  import { NxJsonConfiguration } from '../../config/nx-json';
2
+ import { PackageJson } from '../../utils/package-json';
2
3
  import { Agent } from '../../ai/utils';
3
4
  export interface InitArgs {
4
5
  interactive: boolean;
@@ -10,7 +11,7 @@ export interface InitArgs {
10
11
  aiAgents?: Agent[];
11
12
  }
12
13
  export declare function initHandler(options: InitArgs, inner?: boolean): Promise<void>;
13
- export declare function detectPlugins(nxJson: NxJsonConfiguration, interactive: boolean, includeAngularCli?: boolean): Promise<{
14
+ export declare function detectPlugins(nxJson: NxJsonConfiguration, packageJson: PackageJson | null, interactive: boolean, includeAngularCli?: boolean): Promise<{
14
15
  plugins: string[];
15
16
  updatePackageScripts: boolean;
16
17
  }>;
@@ -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;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"}
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;AAIvE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AASvD,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,WAAW,GAAG,IAAI,EAC/B,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,CAsKD"}
@@ -143,7 +143,7 @@ async function initHandlerImpl(options) {
143
143
  updatePackageScripts = true;
144
144
  }
145
145
  else {
146
- const { plugins: _plugins, updatePackageScripts: _updatePackageScripts } = await detectPlugins(nxJson, options.interactive);
146
+ const { plugins: _plugins, updatePackageScripts: _updatePackageScripts } = await detectPlugins(nxJson, packageJson, options.interactive);
147
147
  plugins = _plugins;
148
148
  updatePackageScripts = _updatePackageScripts;
149
149
  }
@@ -212,12 +212,22 @@ const npmPackageToPluginMap = {
212
212
  '@rsbuild/core': '@nx/rsbuild',
213
213
  '@react-router/dev': '@nx/react',
214
214
  };
215
- async function detectPlugins(nxJson, interactive, includeAngularCli) {
215
+ async function detectPlugins(nxJson, packageJson, interactive, includeAngularCli) {
216
216
  let files = ['package.json'].concat((0, workspace_context_1.globWithWorkspaceContextSync)(process.cwd(), ['**/*/package.json']));
217
217
  const currentPlugins = new Set((nxJson.plugins ?? []).map((p) => {
218
218
  const plugin = typeof p === 'string' ? p : p.plugin;
219
219
  return (0, get_package_name_from_import_path_1.getPackageNameFromImportPath)(plugin);
220
220
  }));
221
+ // Also treat already-installed @nx/* and @nrwl/* packages as current plugins
222
+ const rootDeps = {
223
+ ...packageJson?.dependencies,
224
+ ...packageJson?.devDependencies,
225
+ };
226
+ for (const dep of Object.keys(rootDeps)) {
227
+ if (dep.startsWith('@nx/') || dep.startsWith('@nrwl/')) {
228
+ currentPlugins.add((0, get_package_name_from_import_path_1.getPackageNameFromImportPath)(dep));
229
+ }
230
+ }
221
231
  const detectedPlugins = new Set();
222
232
  for (const file of files) {
223
233
  if (!(0, fs_1.existsSync)(file))