nx 18.1.0-beta.2 → 18.1.0-beta.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.
Files changed (93) hide show
  1. package/migrations.json +6 -1
  2. package/package.json +13 -12
  3. package/schemas/nx-schema.json +10 -1
  4. package/src/adapter/angular-json.d.ts +2 -1
  5. package/src/adapter/angular-json.js +1 -0
  6. package/src/adapter/compat.d.ts +1 -1
  7. package/src/adapter/compat.js +2 -0
  8. package/src/adapter/ngcli-adapter.js +3 -3
  9. package/src/command-line/add/add.js +2 -1
  10. package/src/command-line/generate/generator-utils.js +2 -2
  11. package/src/command-line/graph/graph.js +1 -1
  12. package/src/command-line/init/command-object.js +3 -1
  13. package/src/command-line/init/implementation/utils.js +1 -2
  14. package/src/command-line/init/init-v2.js +18 -11
  15. package/src/command-line/migrate/migrate.js +3 -1
  16. package/src/command-line/release/changelog.js +41 -1
  17. package/src/command-line/release/utils/git.js +15 -1
  18. package/src/command-line/run/executor-utils.js +2 -2
  19. package/src/config/nx-json.d.ts +12 -0
  20. package/src/config/schema-utils.js +2 -2
  21. package/src/core/graph/main.js +1 -1
  22. package/src/core/graph/polyfills.js +1 -1
  23. package/src/core/graph/styles.js +1 -1
  24. package/src/daemon/server/project-graph-incremental-recomputation.js +4 -1
  25. package/src/devkit-exports.d.ts +3 -2
  26. package/src/devkit-exports.js +2 -1
  27. package/src/devkit-internals.d.ts +1 -0
  28. package/src/devkit-internals.js +3 -1
  29. package/src/generators/utils/project-configuration.js +17 -3
  30. package/src/migrations/update-15-1-0/set-project-names.js +4 -2
  31. package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +3 -3
  32. package/src/migrations/update-17-2-0/move-default-base.d.ts +5 -0
  33. package/src/migrations/update-17-2-0/move-default-base.js +19 -0
  34. package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +4 -24
  35. package/src/plugins/js/index.d.ts +1 -1
  36. package/src/plugins/js/lock-file/lock-file.d.ts +1 -1
  37. package/src/plugins/js/lock-file/npm-parser.d.ts +1 -1
  38. package/src/plugins/js/lock-file/pnpm-parser.d.ts +1 -1
  39. package/src/plugins/js/lock-file/yarn-parser.d.ts +1 -1
  40. package/src/plugins/js/project-graph/build-dependencies/build-dependencies.d.ts +1 -1
  41. package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.d.ts +1 -1
  42. package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.d.ts +1 -1
  43. package/src/plugins/js/utils/register.js +1 -0
  44. package/src/plugins/package-json-workspaces/create-nodes.d.ts +2 -2
  45. package/src/plugins/package-json-workspaces/create-nodes.js +24 -31
  46. package/src/plugins/package-json-workspaces/index.d.ts +1 -0
  47. package/src/plugins/package-json-workspaces/index.js +2 -0
  48. package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.d.ts +2 -1
  49. package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.js +1 -0
  50. package/src/plugins/project-json/build-nodes/project-json.d.ts +2 -1
  51. package/src/plugins/project-json/build-nodes/project-json.js +1 -0
  52. package/src/plugins/target-defaults/target-defaults-plugin.d.ts +17 -6
  53. package/src/plugins/target-defaults/target-defaults-plugin.js +40 -31
  54. package/src/project-graph/affected/locators/project-glob-changes.js +2 -3
  55. package/src/project-graph/build-project-graph.js +11 -11
  56. package/src/project-graph/file-utils.js +3 -3
  57. package/src/project-graph/plugins/index.d.ts +2 -0
  58. package/src/project-graph/plugins/index.js +8 -0
  59. package/src/project-graph/plugins/internal-api.d.ts +18 -0
  60. package/src/project-graph/plugins/internal-api.js +48 -0
  61. package/src/project-graph/plugins/messaging.d.ts +94 -0
  62. package/src/project-graph/plugins/messaging.js +23 -0
  63. package/src/project-graph/plugins/plugin-pool.d.ts +4 -0
  64. package/src/project-graph/plugins/plugin-pool.js +216 -0
  65. package/src/project-graph/plugins/plugin-worker.d.ts +1 -0
  66. package/src/project-graph/plugins/plugin-worker.js +115 -0
  67. package/src/{utils/nx-plugin.d.ts → project-graph/plugins/public-api.d.ts} +6 -40
  68. package/src/project-graph/plugins/public-api.js +4 -0
  69. package/src/project-graph/plugins/utils.d.ts +9 -0
  70. package/src/project-graph/plugins/utils.js +55 -0
  71. package/src/project-graph/plugins/worker-api.d.ts +26 -0
  72. package/src/project-graph/plugins/worker-api.js +177 -0
  73. package/src/project-graph/project-graph-builder.d.ts +1 -1
  74. package/src/project-graph/project-graph.js +2 -2
  75. package/src/project-graph/utils/normalize-project-nodes.d.ts +1 -1
  76. package/src/project-graph/utils/project-configuration-utils.d.ts +2 -2
  77. package/src/project-graph/utils/project-configuration-utils.js +35 -64
  78. package/src/project-graph/utils/retrieve-workspace-files.d.ts +8 -4
  79. package/src/project-graph/utils/retrieve-workspace-files.js +17 -15
  80. package/src/tasks-runner/task-orchestrator.js +23 -1
  81. package/src/utils/command-line-utils.js +2 -1
  82. package/src/utils/json.js +3 -1
  83. package/src/utils/logger.d.ts +1 -0
  84. package/src/utils/logger.js +5 -0
  85. package/src/utils/nx-plugin.deprecated.d.ts +4 -2
  86. package/src/utils/nx-plugin.deprecated.js +4 -4
  87. package/src/utils/package-json.js +2 -2
  88. package/src/utils/package-manager.d.ts +6 -0
  89. package/src/utils/package-manager.js +16 -1
  90. package/src/utils/plugins/core-plugins.js +4 -0
  91. package/src/utils/plugins/plugin-capabilities.d.ts +1 -1
  92. package/src/utils/plugins/plugin-capabilities.js +8 -7
  93. package/src/utils/nx-plugin.js +0 -293
package/migrations.json CHANGED
@@ -86,9 +86,14 @@
86
86
  "18.0.0-disable-adding-plugins-for-existing-workspaces": {
87
87
  "cli": "nx",
88
88
  "version": "18.0.0-beta.2",
89
- "description": "Updates .env to disabled adding plugins when generating projects in an existing Nx workspace",
89
+ "description": "Updates nx.json to disabled adding plugins when generating projects in an existing Nx workspace",
90
90
  "implementation": "./src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces",
91
91
  "x-repair-skip": true
92
+ },
93
+ "move-default-base-to-nx-json-root": {
94
+ "version": "18.1.0-beta.3",
95
+ "description": "Moves affected.defaultBase to defaultBase in `nx.json`",
96
+ "implementation": "./src/migrations/update-17-2-0/move-default-base"
92
97
  }
93
98
  }
94
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "18.1.0-beta.2",
3
+ "version": "18.1.0-beta.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": {
@@ -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": "18.1.0-beta.2"
69
+ "@nrwl/tao": "18.1.0-beta.3"
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": "18.1.0-beta.2",
85
- "@nx/nx-darwin-arm64": "18.1.0-beta.2",
86
- "@nx/nx-linux-x64-gnu": "18.1.0-beta.2",
87
- "@nx/nx-linux-x64-musl": "18.1.0-beta.2",
88
- "@nx/nx-win32-x64-msvc": "18.1.0-beta.2",
89
- "@nx/nx-linux-arm64-gnu": "18.1.0-beta.2",
90
- "@nx/nx-linux-arm64-musl": "18.1.0-beta.2",
91
- "@nx/nx-linux-arm-gnueabihf": "18.1.0-beta.2",
92
- "@nx/nx-win32-arm64-msvc": "18.1.0-beta.2",
93
- "@nx/nx-freebsd-x64": "18.1.0-beta.2"
84
+ "@nx/nx-darwin-x64": "18.1.0-beta.3",
85
+ "@nx/nx-darwin-arm64": "18.1.0-beta.3",
86
+ "@nx/nx-linux-x64-gnu": "18.1.0-beta.3",
87
+ "@nx/nx-linux-x64-musl": "18.1.0-beta.3",
88
+ "@nx/nx-win32-x64-msvc": "18.1.0-beta.3",
89
+ "@nx/nx-linux-arm64-gnu": "18.1.0-beta.3",
90
+ "@nx/nx-linux-arm64-musl": "18.1.0-beta.3",
91
+ "@nx/nx-linux-arm-gnueabihf": "18.1.0-beta.3",
92
+ "@nx/nx-win32-arm64-msvc": "18.1.0-beta.3",
93
+ "@nx/nx-freebsd-x64": "18.1.0-beta.3"
94
94
  },
95
95
  "nx-migrations": {
96
96
  "migrations": "./migrations.json",
@@ -126,6 +126,7 @@
126
126
  "@nrwl/next",
127
127
  "@nx/node",
128
128
  "@nrwl/node",
129
+ "@nx/nuxt",
129
130
  "@nx/playwright",
130
131
  "@nx/plugin",
131
132
  "@nrwl/nx-plugin",
@@ -18,7 +18,12 @@
18
18
  "description": "Default based branch used by affected commands."
19
19
  }
20
20
  },
21
- "additionalProperties": false
21
+ "additionalProperties": false,
22
+ "deprecated": "Use `defaultBase` instead. Support for setting `defaultBase` in `affected` will be removed in Nx 19."
23
+ },
24
+ "defaultBase": {
25
+ "type": "string",
26
+ "description": "Default --base used by affected logic."
22
27
  },
23
28
  "tasksRunnerOptions": {
24
29
  "type": "object",
@@ -96,6 +101,10 @@
96
101
  "type": "boolean",
97
102
  "description": "Specifies whether the daemon should be used for the default tasks runner."
98
103
  },
104
+ "useInferencePlugins": {
105
+ "type": "boolean",
106
+ "description": "Specifies whether to add inference plugins when generating new projects."
107
+ },
99
108
  "release": {
100
109
  "type": "object",
101
110
  "description": "Configuration for the nx release commands.",
@@ -1,7 +1,8 @@
1
1
  import { ProjectsConfigurations } from '../config/workspace-json-project-json';
2
- import { NxPluginV2 } from '../utils/nx-plugin';
2
+ import { NxPluginV2 } from '../project-graph/plugins';
3
3
  export declare const NX_ANGULAR_JSON_PLUGIN_NAME = "nx-angular-json-plugin";
4
4
  export declare const NxAngularJsonPlugin: NxPluginV2;
5
+ export default NxAngularJsonPlugin;
5
6
  export declare function shouldMergeAngularProjects(root: string, includeProjectsFromAngularJson: boolean): boolean;
6
7
  export declare function isAngularPluginInstalled(): boolean;
7
8
  export declare function toNewFormat(w: any): ProjectsConfigurations;
@@ -14,6 +14,7 @@ exports.NxAngularJsonPlugin = {
14
14
  }),
15
15
  ],
16
16
  };
17
+ exports.default = exports.NxAngularJsonPlugin;
17
18
  function shouldMergeAngularProjects(root, includeProjectsFromAngularJson) {
18
19
  if ((0, fs_1.existsSync)(path.join(root, 'angular.json')) &&
19
20
  // Include projects from angular.json if explicitly required.
@@ -1,2 +1,2 @@
1
1
  export declare const allowedProjectExtensions: readonly ["tags", "implicitDependencies", "configFilePath", "$schema", "generators", "namedInputs", "name", "files", "root", "sourceRoot", "projectType", "release", "includedScripts"];
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"];
2
+ export declare const allowedWorkspaceExtensions: readonly ["implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins"];
@@ -38,6 +38,7 @@ exports.allowedProjectExtensions = [
38
38
  exports.allowedWorkspaceExtensions = [
39
39
  'implicitDependencies',
40
40
  'affected',
41
+ 'defaultBase',
41
42
  'tasksRunnerOptions',
42
43
  'workspaceLayout',
43
44
  'plugins',
@@ -57,6 +58,7 @@ exports.allowedWorkspaceExtensions = [
57
58
  'parallel',
58
59
  'cacheDirectory',
59
60
  'useDaemonProcess',
61
+ 'useInferencePlugins',
60
62
  ];
61
63
  if (!patched) {
62
64
  Module.prototype.require = function () {
@@ -19,7 +19,7 @@ const package_json_1 = require("../utils/package-json");
19
19
  const package_manager_1 = require("../utils/package-manager");
20
20
  const angular_json_1 = require("./angular-json");
21
21
  const executor_utils_1 = require("../command-line/run/executor-utils");
22
- const nx_plugin_1 = require("../utils/nx-plugin");
22
+ const plugins_1 = require("../project-graph/plugins");
23
23
  const schema_utils_1 = require("../config/schema-utils");
24
24
  async function createBuilderContext(builderInfo, context) {
25
25
  require('./compat');
@@ -146,7 +146,7 @@ function createNodeModulesEngineHost(resolvePaths, projects) {
146
146
  collectionFilePath = require.resolve(name, { paths });
147
147
  }
148
148
  else {
149
- const { json: { generators, schematics }, path: packageJsonPath, } = (0, nx_plugin_1.readPluginPackageJson)(name, projects, paths);
149
+ const { json: { generators, schematics }, path: packageJsonPath, } = (0, plugins_1.readPluginPackageJson)(name, projects, paths);
150
150
  if (!schematics && !generators) {
151
151
  throw new Error(`The "${name}" package does not support Nx generators or Angular Devkit schematics.`);
152
152
  }
@@ -802,7 +802,7 @@ async function getWrappedWorkspaceNodeModulesArchitectHost(workspace, root, proj
802
802
  };
803
803
  }
804
804
  readExecutorsJson(nodeModule, builder) {
805
- const { json: packageJson, path: packageJsonPath } = (0, nx_plugin_1.readPluginPackageJson)(nodeModule, this.projects, this.root ? [this.root, __dirname] : [__dirname]);
805
+ const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(nodeModule, this.projects, this.root ? [this.root, __dirname] : [__dirname]);
806
806
  const executorsFile = packageJson.executors ?? packageJson.builders;
807
807
  if (!executorsFile) {
808
808
  throw new Error(`The "${nodeModule}" package does not support Nx executors or Angular Devkit Builders.`);
@@ -97,7 +97,8 @@ async function initializePlugin(pkgName, options) {
97
97
  }
98
98
  else {
99
99
  updatePackageScripts =
100
- process.env.NX_ADD_PLUGINS !== 'false' &&
100
+ (0, nx_json_1.readNxJson)().useInferencePlugins !== false &&
101
+ process.env.NX_ADD_PLUGINS !== 'false' &&
101
102
  coreNxPlugins.includes(pkgName);
102
103
  }
103
104
  await (0, child_process_2.runNxAsync)(`g ${pkgName}:${initGenerator} --keepExistingVersions${updatePackageScripts ? ' --updatePackageScripts' : ''}`, {
@@ -4,7 +4,7 @@ exports.readGeneratorsJson = exports.getGeneratorInformation = void 0;
4
4
  const path_1 = require("path");
5
5
  const schema_utils_1 = require("../../config/schema-utils");
6
6
  const fileutils_1 = require("../../utils/fileutils");
7
- const nx_plugin_1 = require("../../utils/nx-plugin");
7
+ const plugins_1 = require("../../project-graph/plugins");
8
8
  function getGeneratorInformation(collectionName, generatorName, root, projects) {
9
9
  try {
10
10
  const { generatorsFilePath, generatorsJson, resolvedCollectionName, normalizedGeneratorName, } = readGeneratorsJson(collectionName, generatorName, root, projects);
@@ -48,7 +48,7 @@ function readGeneratorsJson(collectionName, generator, root, projects) {
48
48
  });
49
49
  }
50
50
  else {
51
- const { json: packageJson, path: packageJsonPath } = (0, nx_plugin_1.readPluginPackageJson)(collectionName, projects, root ? [root, __dirname] : [__dirname]);
51
+ const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(collectionName, projects, root ? [root, __dirname] : [__dirname]);
52
52
  const generatorsFile = packageJson.generators ?? packageJson.schematics;
53
53
  if (!generatorsFile) {
54
54
  throw new Error(`The "${collectionName}" package does not support Nx generators.`);
@@ -266,7 +266,7 @@ async function generateGraph(args, affectedProjects) {
266
266
  const { app, url } = await startServer(html, environmentJs, args.host || '127.0.0.1', args.port || 4211, args.watch, affectedProjects, args.focus, args.groupByFolder, args.exclude);
267
267
  url.pathname = args.view;
268
268
  if (args.focus) {
269
- url.pathname += '/' + args.focus;
269
+ url.pathname += '/' + encodeURIComponent(args.focus);
270
270
  }
271
271
  if (target) {
272
272
  url.pathname += '/' + target;
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.yargsInitCommand = void 0;
4
4
  const shared_options_1 = require("../yargs-utils/shared-options");
5
- const useV2 = process.env['NX_ADD_PLUGINS'] !== 'false';
5
+ const nx_json_1 = require("../../config/nx-json");
6
+ const useV2 = process.env['NX_ADD_PLUGINS'] !== 'false' &&
7
+ (0, nx_json_1.readNxJson)().useInferencePlugins !== false;
6
8
  exports.yargsInitCommand = {
7
9
  command: 'init',
8
10
  describe: 'Adds Nx to any type of workspace. It installs nx, creates an nx.json configuration file and optionally sets up remote caching. For more info, check https://nx.dev/recipes/adopting-nx.',
@@ -41,8 +41,7 @@ function createNxJsonFile(repoRoot, topologicalTargets, cacheableOperations, scr
41
41
  if (Object.keys(nxJson.targetDefaults).length === 0) {
42
42
  delete nxJson.targetDefaults;
43
43
  }
44
- nxJson.affected ??= {};
45
- nxJson.affected.defaultBase ??= deduceDefaultBase();
44
+ nxJson.defaultBase ??= deduceDefaultBase();
46
45
  (0, fileutils_1.writeJsonFile)(nxJsonPath, nxJson);
47
46
  }
48
47
  exports.createNxJsonFile = createNxJsonFile;
@@ -17,6 +17,7 @@ const workspace_context_1 = require("../../utils/workspace-context");
17
17
  const connect_to_nx_cloud_1 = require("../connect/connect-to-nx-cloud");
18
18
  const add_nx_to_npm_repo_1 = require("./implementation/add-nx-to-npm-repo");
19
19
  const add_nx_to_monorepo_1 = require("./implementation/add-nx-to-monorepo");
20
+ const path_1 = require("path");
20
21
  async function initHandler(options) {
21
22
  const version = process.env.NX_VERSION ?? ((0, semver_1.prerelease)(versions_1.nxVersion) ? 'next' : 'latest');
22
23
  if (process.env.NX_VERSION) {
@@ -42,6 +43,7 @@ async function initHandler(options) {
42
43
  });
43
44
  return;
44
45
  }
46
+ output_1.output.log({ title: '🧐 Checking dependencies' });
45
47
  const detectPluginsResponse = await detectPlugins();
46
48
  if (!detectPluginsResponse?.plugins.length) {
47
49
  // If no plugins are detected/chosen, guide users to setup
@@ -63,19 +65,23 @@ async function initHandler(options) {
63
65
  const pmc = (0, package_manager_1.getPackageManagerCommand)();
64
66
  (0, utils_1.createNxJsonFile)(repoRoot, [], [], {});
65
67
  (0, utils_1.updateGitIgnore)(repoRoot);
66
- (0, utils_1.addDepsToPackageJson)(repoRoot, detectPluginsResponse?.plugins ?? []);
68
+ (0, utils_1.addDepsToPackageJson)(repoRoot, detectPluginsResponse.plugins);
67
69
  output_1.output.log({ title: '📦 Installing Nx' });
68
70
  (0, utils_1.runInstall)(repoRoot, pmc);
69
- if (detectPluginsResponse) {
70
- output_1.output.log({ title: '🔨 Configuring plugins' });
71
- for (const plugin of detectPluginsResponse.plugins) {
72
- (0, child_process_2.execSync)(`${pmc.exec} nx g ${plugin}:init --keepExistingVersions ${detectPluginsResponse.updatePackageScripts
73
- ? '--updatePackageScripts'
74
- : ''} --no-interactive`, {
75
- stdio: [0, 1, 2],
76
- cwd: repoRoot,
77
- });
78
- }
71
+ output_1.output.log({ title: '🔨 Configuring plugins' });
72
+ for (const plugin of detectPluginsResponse.plugins) {
73
+ (0, child_process_2.execSync)(`${pmc.exec} nx g ${plugin}:init --keepExistingVersions ${detectPluginsResponse.updatePackageScripts
74
+ ? '--updatePackageScripts'
75
+ : ''} --no-interactive`, {
76
+ stdio: [0, 1, 2],
77
+ cwd: repoRoot,
78
+ });
79
+ }
80
+ if (!detectPluginsResponse.updatePackageScripts) {
81
+ const rootPackageJsonPath = (0, path_1.join)(repoRoot, 'package.json');
82
+ const json = (0, fileutils_1.readJsonFile)(rootPackageJsonPath);
83
+ json.nx = {};
84
+ (0, fileutils_1.writeJsonFile)(rootPackageJsonPath, json);
79
85
  }
80
86
  if (useNxCloud) {
81
87
  output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
@@ -102,6 +108,7 @@ const npmPackageToPluginMap = {
102
108
  vite: '@nx/vite',
103
109
  vitest: '@nx/vite',
104
110
  webpack: '@nx/webpack',
111
+ rollup: '@nx/rollup',
105
112
  // Testing tools
106
113
  jest: '@nx/jest',
107
114
  cypress: '@nx/cypress',
@@ -872,7 +872,9 @@ async function executeMigrations(root, migrations, isVerbose, shouldCreateCommit
872
872
  if (b.name === '15-7-0-split-configuration-into-project-json-files') {
873
873
  return 1;
874
874
  }
875
- return (0, semver_1.lt)(a.version, b.version) ? -1 : 1;
875
+ return (0, semver_1.lt)(normalizeVersion(a.version), normalizeVersion(b.version))
876
+ ? -1
877
+ : 1;
876
878
  });
877
879
  for (const m of sortedMigrations) {
878
880
  try {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.shouldCreateGitHubRelease = exports.releaseChangelog = exports.releaseChangelogCLIHandler = void 0;
4
4
  const chalk = require("chalk");
5
+ const enquirer_1 = require("enquirer");
5
6
  const node_fs_1 = require("node:fs");
6
7
  const semver_1 = require("semver");
7
8
  const tmp_1 = require("tmp");
@@ -10,6 +11,7 @@ const tree_1 = require("../../generators/tree");
10
11
  const register_1 = require("../../plugins/js/utils/register");
11
12
  const project_graph_1 = require("../../project-graph/project-graph");
12
13
  const utils_1 = require("../../tasks-runner/utils");
14
+ const is_ci_1 = require("../../utils/is-ci");
13
15
  const output_1 = require("../../utils/output");
14
16
  const params_1 = require("../../utils/params");
15
17
  const path_1 = require("../../utils/path");
@@ -302,6 +304,25 @@ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTa
302
304
  `No changes were detected for any changelog files, so no changelog entries will be generated.`,
303
305
  ],
304
306
  });
307
+ if (!postGitTasks.length) {
308
+ // no GitHub releases to create so we can just exit
309
+ return;
310
+ }
311
+ if ((0, is_ci_1.isCI)()) {
312
+ output_1.output.warn({
313
+ title: `Skipped GitHub release creation because no changes were detected for any changelog files.`,
314
+ });
315
+ return;
316
+ }
317
+ // prompt the user to see if they want to create a GitHub release anyway
318
+ // we know that the user has configured GitHub releases because we have postGitTasks
319
+ const shouldCreateGitHubReleaseAnyway = await promptForGitHubRelease();
320
+ if (!shouldCreateGitHubReleaseAnyway) {
321
+ return;
322
+ }
323
+ for (const postGitTask of postGitTasks) {
324
+ await postGitTask(latestCommit);
325
+ }
305
326
  return;
306
327
  }
307
328
  // Generate a new commit for the changes, if configured to do so
@@ -339,6 +360,9 @@ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTa
339
360
  return;
340
361
  }
341
362
  function resolveChangelogRenderer(changelogRendererPath) {
363
+ const interpolatedChangelogRendererPath = (0, utils_1.interpolate)(changelogRendererPath, {
364
+ workspaceRoot: workspace_root_1.workspaceRoot,
365
+ });
342
366
  // Try and load the provided (or default) changelog renderer
343
367
  let changelogRenderer;
344
368
  let cleanupTranspiler = () => { };
@@ -347,7 +371,7 @@ function resolveChangelogRenderer(changelogRendererPath) {
347
371
  if (rootTsconfigPath) {
348
372
  cleanupTranspiler = (0, register_1.registerTsProject)(rootTsconfigPath);
349
373
  }
350
- const r = require(changelogRendererPath);
374
+ const r = require(interpolatedChangelogRendererPath);
351
375
  changelogRenderer = r.default || r;
352
376
  }
353
377
  catch {
@@ -600,3 +624,19 @@ function shouldCreateGitHubRelease(changelogConfig, createReleaseArg = undefined
600
624
  return (changelogConfig || {}).createRelease === 'github';
601
625
  }
602
626
  exports.shouldCreateGitHubRelease = shouldCreateGitHubRelease;
627
+ async function promptForGitHubRelease() {
628
+ try {
629
+ const result = await (0, enquirer_1.prompt)([
630
+ {
631
+ name: 'confirmation',
632
+ message: 'Do you want to create a GitHub release anyway?',
633
+ type: 'confirm',
634
+ },
635
+ ]);
636
+ return result.confirmation;
637
+ }
638
+ catch (e) {
639
+ // Handle the case where the user exits the prompt with ctrl+c
640
+ return false;
641
+ }
642
+ }
@@ -14,11 +14,25 @@ function escapeRegExp(string) {
14
14
  const SEMVER_REGEX = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/g;
15
15
  async function getLatestGitTagForPattern(releaseTagPattern, additionalInterpolationData = {}) {
16
16
  try {
17
- const tags = await (0, exec_command_1.execCommand)('git', ['tag', '--sort', '-v:refname']).then((r) => r
17
+ let tags;
18
+ tags = await (0, exec_command_1.execCommand)('git', [
19
+ 'tag',
20
+ '--sort',
21
+ '-v:refname',
22
+ '--merged',
23
+ ]).then((r) => r
18
24
  .trim()
19
25
  .split('\n')
20
26
  .map((t) => t.trim())
21
27
  .filter(Boolean));
28
+ if (!tags.length) {
29
+ // try again, but include all tags on the repo instead of just --merged ones
30
+ tags = await (0, exec_command_1.execCommand)('git', ['tag', '--sort', '-v:refname']).then((r) => r
31
+ .trim()
32
+ .split('\n')
33
+ .map((t) => t.trim())
34
+ .filter(Boolean));
35
+ }
22
36
  if (!tags.length) {
23
37
  return null;
24
38
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getExecutorInformation = exports.normalizeExecutorSchema = void 0;
4
4
  const path_1 = require("path");
5
- const nx_plugin_1 = require("../../utils/nx-plugin");
5
+ const plugins_1 = require("../../project-graph/plugins");
6
6
  const fileutils_1 = require("../../utils/fileutils");
7
7
  const schema_utils_1 = require("../../config/schema-utils");
8
8
  const installation_directory_1 = require("../../utils/installation-directory");
@@ -55,7 +55,7 @@ function getExecutorInformation(nodeModule, executor, root, projects) {
55
55
  }
56
56
  exports.getExecutorInformation = getExecutorInformation;
57
57
  function readExecutorJson(nodeModule, executor, root, projects) {
58
- const { json: packageJson, path: packageJsonPath } = (0, nx_plugin_1.readPluginPackageJson)(nodeModule, projects, root
58
+ const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(nodeModule, projects, root
59
59
  ? [root, __dirname, process.cwd(), ...(0, installation_directory_1.getNxRequirePaths)()]
60
60
  : [__dirname, process.cwd(), ...(0, installation_directory_1.getNxRequirePaths)()]);
61
61
  const executorsFile = packageJson.executors ?? packageJson.builders;
@@ -7,6 +7,9 @@ export type ImplicitDependencyEntry<T = '*' | string[]> = {
7
7
  export interface ImplicitJsonSubsetDependency<T = '*' | string[]> {
8
8
  [key: string]: T | ImplicitJsonSubsetDependency<T>;
9
9
  }
10
+ /**
11
+ * @deprecated Use {@link NxJsonConfiguration#defaultBase } instead
12
+ */
10
13
  export interface NxAffectedConfig {
11
14
  /**
12
15
  * Default based branch used by affected commands.
@@ -248,8 +251,13 @@ export interface NxJsonConfiguration<T = '*' | string[]> {
248
251
  targetDefaults?: TargetDefaults;
249
252
  /**
250
253
  * Default options for `nx affected`
254
+ * @deprecated use {@link defaultBase} instead. For more information see https://nx.dev/deprecated/affected-config#affected-config
251
255
  */
252
256
  affected?: NxAffectedConfig;
257
+ /**
258
+ * Default value for --base used by `nx affected` and `nx format`.
259
+ */
260
+ defaultBase?: string;
253
261
  /**
254
262
  * Where new apps + libs should be placed
255
263
  */
@@ -350,6 +358,10 @@ export interface NxJsonConfiguration<T = '*' | string[]> {
350
358
  * Set this to false to disable the daemon.
351
359
  */
352
360
  useDaemonProcess?: boolean;
361
+ /**
362
+ * Set this to false to disable adding inference plugins when generating new projects
363
+ */
364
+ useInferencePlugins?: boolean;
353
365
  }
354
366
  export type PluginConfiguration = string | {
355
367
  plugin: string;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveSchema = exports.resolveImplementation = exports.getImplementationFactory = void 0;
4
4
  const fs_1 = require("fs");
5
5
  const path_1 = require("path");
6
- const nx_plugin_1 = require("../utils/nx-plugin");
6
+ const plugins_1 = require("../project-graph/plugins");
7
7
  /**
8
8
  * This function is used to get the implementation factory of an executor or generator.
9
9
  * @param implementation path to the implementation
@@ -15,7 +15,7 @@ function getImplementationFactory(implementation, directory) {
15
15
  return () => {
16
16
  const modulePath = resolveImplementation(implementationModulePath, directory);
17
17
  if ((0, path_1.extname)(modulePath) === '.ts') {
18
- (0, nx_plugin_1.registerPluginTSTranspiler)();
18
+ (0, plugins_1.registerPluginTSTranspiler)();
19
19
  }
20
20
  const module = require(modulePath);
21
21
  return implementationExportName