nx 17.3.0-beta.6 → 17.3.0-beta.8

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 (41) hide show
  1. package/package.json +12 -12
  2. package/plugins/package-json.js +1 -1
  3. package/src/command-line/add/add.d.ts +1 -1
  4. package/src/command-line/add/add.js +14 -6
  5. package/src/command-line/add/command-object.d.ts +1 -0
  6. package/src/command-line/add/command-object.js +4 -0
  7. package/src/command-line/affected/affected.js +0 -3
  8. package/src/command-line/init/init-v2.js +8 -5
  9. package/src/command-line/release/publish.js +0 -3
  10. package/src/command-line/release/version.d.ts +2 -0
  11. package/src/command-line/release/version.js +2 -1
  12. package/src/command-line/run/run-one.js +0 -3
  13. package/src/command-line/run-many/run-many.js +0 -3
  14. package/src/core/graph/3rdpartylicenses.txt +0 -126
  15. package/src/core/graph/main.js +1 -1
  16. package/src/core/graph/polyfills.js +1 -1
  17. package/src/core/graph/runtime.js +1 -1
  18. package/src/core/graph/styles.css +1 -1
  19. package/src/core/graph/styles.js +1 -1
  20. package/src/generators/utils/project-configuration.js +7 -3
  21. package/src/plugins/js/index.d.ts +1 -1
  22. package/src/plugins/js/index.js +1 -1
  23. package/{plugins/package-json-workspaces.d.ts → src/plugins/package-json-workspaces/create-nodes.d.ts} +4 -4
  24. package/{plugins/package-json-workspaces.js → src/plugins/package-json-workspaces/create-nodes.js} +9 -9
  25. package/src/plugins/package-json-workspaces/index.d.ts +1 -0
  26. package/src/plugins/package-json-workspaces/index.js +4 -0
  27. package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.d.ts +1 -1
  28. package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.js +5 -3
  29. package/src/plugins/project-json/build-nodes/project-json.d.ts +1 -1
  30. package/src/plugins/project-json/build-nodes/project-json.js +3 -3
  31. package/src/plugins/target-defaults/target-defaults-plugin.d.ts +8 -0
  32. package/src/plugins/target-defaults/target-defaults-plugin.js +91 -0
  33. package/src/project-graph/build-project-graph.js +1 -1
  34. package/src/project-graph/file-utils.js +1 -1
  35. package/src/project-graph/utils/normalize-project-nodes.d.ts +2 -3
  36. package/src/project-graph/utils/normalize-project-nodes.js +7 -12
  37. package/src/project-graph/utils/project-configuration-utils.d.ts +7 -2
  38. package/src/project-graph/utils/project-configuration-utils.js +21 -8
  39. package/src/project-graph/utils/retrieve-workspace-files.js +2 -2
  40. package/src/utils/nx-plugin.deprecated.js +4 -2
  41. package/src/utils/nx-plugin.js +5 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "17.3.0-beta.6",
3
+ "version": "17.3.0-beta.8",
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": "17.3.0-beta.6"
69
+ "@nrwl/tao": "17.3.0-beta.8"
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-beta.6",
85
- "@nx/nx-darwin-arm64": "17.3.0-beta.6",
86
- "@nx/nx-linux-x64-gnu": "17.3.0-beta.6",
87
- "@nx/nx-linux-x64-musl": "17.3.0-beta.6",
88
- "@nx/nx-win32-x64-msvc": "17.3.0-beta.6",
89
- "@nx/nx-linux-arm64-gnu": "17.3.0-beta.6",
90
- "@nx/nx-linux-arm64-musl": "17.3.0-beta.6",
91
- "@nx/nx-linux-arm-gnueabihf": "17.3.0-beta.6",
92
- "@nx/nx-win32-arm64-msvc": "17.3.0-beta.6",
93
- "@nx/nx-freebsd-x64": "17.3.0-beta.6"
84
+ "@nx/nx-darwin-x64": "17.3.0-beta.8",
85
+ "@nx/nx-darwin-arm64": "17.3.0-beta.8",
86
+ "@nx/nx-linux-x64-gnu": "17.3.0-beta.8",
87
+ "@nx/nx-linux-x64-musl": "17.3.0-beta.8",
88
+ "@nx/nx-win32-x64-msvc": "17.3.0-beta.8",
89
+ "@nx/nx-linux-arm64-gnu": "17.3.0-beta.8",
90
+ "@nx/nx-linux-arm64-musl": "17.3.0-beta.8",
91
+ "@nx/nx-linux-arm-gnueabihf": "17.3.0-beta.8",
92
+ "@nx/nx-win32-arm64-msvc": "17.3.0-beta.8",
93
+ "@nx/nx-freebsd-x64": "17.3.0-beta.8"
94
94
  },
95
95
  "nx-migrations": {
96
96
  "migrations": "./migrations.json",
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const workspace_root_1 = require("../src/utils/workspace-root");
4
- const package_json_workspaces_1 = require("./package-json-workspaces");
4
+ const package_json_workspaces_1 = require("../src/plugins/package-json-workspaces");
5
5
  const plugin = {
6
6
  name: 'nx-all-package-jsons-plugin',
7
7
  createNodes: [
@@ -1,2 +1,2 @@
1
1
  import type { AddOptions } from './command-object';
2
- export declare function addHandler(args: AddOptions): Promise<void>;
2
+ export declare function addHandler(options: AddOptions): Promise<void>;
@@ -15,16 +15,16 @@ 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
- function addHandler(args) {
19
- if (args.verbose) {
18
+ function addHandler(options) {
19
+ if (options.verbose) {
20
20
  process.env.NX_VERBOSE_LOGGING = 'true';
21
21
  }
22
22
  const isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
23
23
  return (0, params_1.handleErrors)(isVerbose, async () => {
24
24
  output_1.output.addNewline();
25
- const [pkgName, version] = parsePackageSpecifier(args.packageSpecifier);
25
+ const [pkgName, version] = parsePackageSpecifier(options.packageSpecifier);
26
26
  await installPackage(pkgName, version);
27
- await initializePlugin(pkgName);
27
+ await initializePlugin(pkgName, options);
28
28
  output_1.output.success({
29
29
  title: `Package ${pkgName} added successfully.`,
30
30
  });
@@ -72,7 +72,7 @@ async function installPackage(pkgName, version) {
72
72
  }
73
73
  spinner.succeed();
74
74
  }
75
- async function initializePlugin(pkgName) {
75
+ async function initializePlugin(pkgName, options) {
76
76
  const capabilities = await (0, plugins_1.getPluginCapabilities)(workspace_root_1.workspaceRoot, pkgName, {});
77
77
  const generators = capabilities?.generators;
78
78
  if (!generators) {
@@ -91,7 +91,15 @@ async function initializePlugin(pkgName) {
91
91
  const spinner = ora(`Initializing ${pkgName}...`);
92
92
  spinner.start();
93
93
  try {
94
- await (0, child_process_2.runNxAsync)(`g ${pkgName}:${initGenerator}`);
94
+ let updatePackageScripts;
95
+ if (options.updatePackageScripts !== undefined) {
96
+ updatePackageScripts = options.updatePackageScripts;
97
+ }
98
+ else {
99
+ updatePackageScripts =
100
+ process.env.NX_PCV3 === 'true' && coreNxPlugins.includes(pkgName);
101
+ }
102
+ await (0, child_process_2.runNxAsync)(`g ${pkgName}:${initGenerator} --keepExistingVersions${updatePackageScripts ? ' --updatePackageScripts' : ''}`);
95
103
  }
96
104
  catch (e) {
97
105
  spinner.fail();
@@ -1,6 +1,7 @@
1
1
  import { CommandModule } from 'yargs';
2
2
  export interface AddOptions {
3
3
  packageSpecifier: string;
4
+ updatePackageScripts?: boolean;
4
5
  verbose?: boolean;
5
6
  }
6
7
  export declare const yargsAddCommand: CommandModule<Record<string, unknown>, AddOptions>;
@@ -8,6 +8,10 @@ exports.yargsAddCommand = {
8
8
  .positional('packageSpecifier', {
9
9
  type: 'string',
10
10
  description: 'The package name and optional version (e.g. `@nx/react` or `@nx/react@latest`) to install and initialize. If the version is not specified it will install the same version as the `nx` package for Nx core plugins or the latest version for other packages',
11
+ })
12
+ .option('updatePackageScripts', {
13
+ type: 'boolean',
14
+ description: 'Update `package.json` scripts with inferred targets. Defaults to `true` when `NX_PCV3=true` and the package is a core Nx plugin',
11
15
  })
12
16
  .option('verbose', {
13
17
  type: 'boolean',
@@ -63,9 +63,6 @@ async function affected(command, args, extraTargetDependencies = {}) {
63
63
  }
64
64
  else {
65
65
  const status = await (0, run_command_1.runCommand)(projectsWithTarget, projectGraph, { nxJson }, nxArgs, overrides, null, extraTargetDependencies, { excludeTaskDependencies: false, loadDotEnvFiles: true });
66
- // fix for https://github.com/nrwl/nx/issues/1666
67
- if (process.stdin['unref'])
68
- process.stdin.unref();
69
66
  process.exit(status);
70
67
  }
71
68
  break;
@@ -48,15 +48,13 @@ async function initHandler(options) {
48
48
  const detectPluginsResponse = await detectPlugins();
49
49
  const useNxCloud = options.nxCloud ??
50
50
  (options.interactive ? await (0, connect_to_nx_cloud_1.connectExistingRepoToNxCloudPrompt)() : false);
51
- if (detectPluginsResponse) {
52
- (0, utils_1.addDepsToPackageJson)(repoRoot, detectPluginsResponse.plugins);
53
- }
51
+ (0, utils_1.addDepsToPackageJson)(repoRoot, detectPluginsResponse?.plugins ?? []);
54
52
  output_1.output.log({ title: '📦 Installing Nx' });
55
53
  (0, utils_1.runInstall)(repoRoot, pmc);
56
54
  if (detectPluginsResponse) {
57
55
  output_1.output.log({ title: '🔨 Configuring plugins' });
58
56
  for (const plugin of detectPluginsResponse.plugins) {
59
- (0, child_process_2.execSync)(`${pmc.exec} nx g ${plugin}:init --skipPackageJson ${detectPluginsResponse.updatePackageScripts
57
+ (0, child_process_2.execSync)(`${pmc.exec} nx g ${plugin}:init --keepExistingVersions ${detectPluginsResponse.updatePackageScripts
60
58
  ? '--updatePackageScripts'
61
59
  : ''} --no-interactive`, {
62
60
  stdio: [0, 1, 2],
@@ -84,9 +82,14 @@ const npmPackageToPluginMap = {
84
82
  // Testing tools
85
83
  jest: '@nx/jest',
86
84
  cypress: '@nx/cypress',
87
- playwright: '@nx/playwright',
85
+ '@playwright/test': '@nx/playwright',
86
+ // Frameworks
87
+ detox: '@nx/detox',
88
+ expo: '@nx/expo',
88
89
  next: '@nx/next',
89
90
  nuxt: '@nx/nuxt',
91
+ 'react-native': '@nx/react-native',
92
+ '@remix-run/dev': '@nx/remix',
90
93
  };
91
94
  async function detectPlugins() {
92
95
  let files = ['package.json'].concat((0, workspace_context_1.globWithWorkspaceContext)(process.cwd(), ['**/*/package.json']));
@@ -109,9 +109,6 @@ async function runPublishOnProjects(args, projectGraph, nxJson, projectNames) {
109
109
  ...args,
110
110
  }, overrides, null, {}, { excludeTaskDependencies: false, loadDotEnvFiles: true });
111
111
  if (status !== 0) {
112
- // fix for https://github.com/nrwl/nx/issues/1666
113
- if (process.stdin['unref'])
114
- process.stdin.unref();
115
112
  process.exit(status);
116
113
  }
117
114
  }
@@ -4,6 +4,7 @@ import { ReleaseGroupWithName } from './config/filter-release-groups';
4
4
  import { VersionData } from './utils/shared';
5
5
  export { deriveNewSemverVersion } from './utils/semver';
6
6
  export type { VersionData } from './utils/shared';
7
+ export declare const validReleaseVersionPrefixes: string[];
7
8
  export interface ReleaseVersionGeneratorSchema {
8
9
  projects: ProjectGraphProjectNode[];
9
10
  releaseGroup: ReleaseGroupWithName;
@@ -16,6 +17,7 @@ export interface ReleaseVersionGeneratorSchema {
16
17
  currentVersionResolverMetadata?: Record<string, unknown>;
17
18
  fallbackCurrentVersionResolver?: 'disk';
18
19
  firstRelease?: boolean;
20
+ versionPrefix?: typeof validReleaseVersionPrefixes[number];
19
21
  }
20
22
  export interface NxReleaseVersionResult {
21
23
  /**
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.releaseVersion = exports.releaseVersionCLIHandler = exports.deriveNewSemverVersion = void 0;
3
+ exports.releaseVersion = exports.releaseVersionCLIHandler = exports.validReleaseVersionPrefixes = exports.deriveNewSemverVersion = void 0;
4
4
  const chalk = require("chalk");
5
5
  const node_fs_1 = require("node:fs");
6
6
  const node_path_1 = require("node:path");
@@ -19,6 +19,7 @@ const shared_1 = require("./utils/shared");
19
19
  // Reexport some utils for use in plugin release-version generator implementations
20
20
  var semver_1 = require("./utils/semver");
21
21
  Object.defineProperty(exports, "deriveNewSemverVersion", { enumerable: true, get: function () { return semver_1.deriveNewSemverVersion; } });
22
+ exports.validReleaseVersionPrefixes = ['auto', '', '~', '^'];
22
23
  const releaseVersionCLIHandler = (args) => (0, params_1.handleErrors)(args.verbose, () => releaseVersion(args));
23
24
  exports.releaseVersionCLIHandler = releaseVersionCLIHandler;
24
25
  /**
@@ -48,9 +48,6 @@ async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
48
48
  }
49
49
  else {
50
50
  const status = await (0, run_command_1.runCommand)(projects, projectGraph, { nxJson }, nxArgs, overrides, opts.project, extraTargetDependencies, extraOptions);
51
- // fix for https://github.com/nrwl/nx/issues/1666
52
- if (process.stdin['unref'])
53
- process.stdin.unref();
54
51
  process.exit(status);
55
52
  }
56
53
  }
@@ -40,9 +40,6 @@ async function runMany(args, extraTargetDependencies = {}, extraOptions = { excl
40
40
  }
41
41
  else {
42
42
  const status = await (0, run_command_1.runCommand)(projects, projectGraph, { nxJson }, nxArgs, overrides, null, extraTargetDependencies, extraOptions);
43
- // fix for https://github.com/nrwl/nx/issues/1666
44
- if (process.stdin['unref'])
45
- process.stdin.unref();
46
43
  process.exit(status);
47
44
  }
48
45
  }
@@ -24,56 +24,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
24
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
25
 
26
26
 
27
- @floating-ui/react
28
- MIT
29
- MIT License
30
-
31
- Copyright (c) 2021 Floating UI contributors
32
-
33
- Permission is hereby granted, free of charge, to any person obtaining a copy
34
- of this software and associated documentation files (the "Software"), to deal
35
- in the Software without restriction, including without limitation the rights
36
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
37
- copies of the Software, and to permit persons to whom the Software is
38
- furnished to do so, subject to the following conditions:
39
-
40
- The above copyright notice and this permission notice shall be included in all
41
- copies or substantial portions of the Software.
42
-
43
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
44
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
46
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
47
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
48
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
49
- SOFTWARE.
50
-
51
-
52
- @floating-ui/react-dom
53
- MIT
54
- MIT License
55
-
56
- Copyright (c) 2021 Floating UI contributors
57
-
58
- Permission is hereby granted, free of charge, to any person obtaining a copy
59
- of this software and associated documentation files (the "Software"), to deal
60
- in the Software without restriction, including without limitation the rights
61
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
62
- copies of the Software, and to permit persons to whom the Software is
63
- furnished to do so, subject to the following conditions:
64
-
65
- The above copyright notice and this permission notice shall be included in all
66
- copies or substantial portions of the Software.
67
-
68
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
69
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
70
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
71
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
72
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
73
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
74
- SOFTWARE.
75
-
76
-
77
27
  @headlessui/react
78
28
  MIT
79
29
 
@@ -212,31 +162,6 @@ SOFTWARE.
212
162
 
213
163
 
214
164
 
215
- aria-hidden
216
- MIT
217
- MIT License
218
-
219
- Copyright (c) 2017 Anton Korzunov
220
-
221
- Permission is hereby granted, free of charge, to any person obtaining a copy
222
- of this software and associated documentation files (the "Software"), to deal
223
- in the Software without restriction, including without limitation the rights
224
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
225
- copies of the Software, and to permit persons to whom the Software is
226
- furnished to do so, subject to the following conditions:
227
-
228
- The above copyright notice and this permission notice shall be included in all
229
- copies or substantial portions of the Software.
230
-
231
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
232
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
233
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
234
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
235
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
236
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
237
- SOFTWARE.
238
-
239
-
240
165
  classnames
241
166
  MIT
242
167
  The MIT License (MIT)
@@ -779,57 +704,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
779
704
  SOFTWARE.
780
705
 
781
706
 
782
- regenerator-runtime
783
- MIT
784
- MIT License
785
-
786
- Copyright (c) 2014-present, Facebook, Inc.
787
-
788
- Permission is hereby granted, free of charge, to any person obtaining a copy
789
- of this software and associated documentation files (the "Software"), to deal
790
- in the Software without restriction, including without limitation the rights
791
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
792
- copies of the Software, and to permit persons to whom the Software is
793
- furnished to do so, subject to the following conditions:
794
-
795
- The above copyright notice and this permission notice shall be included in all
796
- copies or substantial portions of the Software.
797
-
798
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
799
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
800
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
801
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
802
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
803
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
804
- SOFTWARE.
805
-
806
-
807
- tabbable
808
- MIT
809
- The MIT License (MIT)
810
-
811
- Copyright (c) 2015 David Clark
812
-
813
- Permission is hereby granted, free of charge, to any person obtaining a copy
814
- of this software and associated documentation files (the "Software"), to deal
815
- in the Software without restriction, including without limitation the rights
816
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
817
- copies of the Software, and to permit persons to whom the Software is
818
- furnished to do so, subject to the following conditions:
819
-
820
- The above copyright notice and this permission notice shall be included in all
821
- copies or substantial portions of the Software.
822
-
823
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
824
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
825
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
826
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
827
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
828
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
829
- SOFTWARE.
830
-
831
-
832
-
833
707
  toggle-selection
834
708
  MIT
835
709