nx 18.0.2 → 18.0.4

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": "18.0.2",
3
+ "version": "18.0.4",
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,10 +66,10 @@
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.0.2"
69
+ "@nrwl/tao": "18.0.4"
70
70
  },
71
71
  "peerDependencies": {
72
- "@swc-node/register": "^1.6.7",
72
+ "@swc-node/register": "^1.8.0",
73
73
  "@swc/core": "^1.3.85"
74
74
  },
75
75
  "peerDependenciesMeta": {
@@ -81,16 +81,16 @@
81
81
  }
82
82
  },
83
83
  "optionalDependencies": {
84
- "@nx/nx-darwin-x64": "18.0.2",
85
- "@nx/nx-darwin-arm64": "18.0.2",
86
- "@nx/nx-linux-x64-gnu": "18.0.2",
87
- "@nx/nx-linux-x64-musl": "18.0.2",
88
- "@nx/nx-win32-x64-msvc": "18.0.2",
89
- "@nx/nx-linux-arm64-gnu": "18.0.2",
90
- "@nx/nx-linux-arm64-musl": "18.0.2",
91
- "@nx/nx-linux-arm-gnueabihf": "18.0.2",
92
- "@nx/nx-win32-arm64-msvc": "18.0.2",
93
- "@nx/nx-freebsd-x64": "18.0.2"
84
+ "@nx/nx-darwin-x64": "18.0.4",
85
+ "@nx/nx-darwin-arm64": "18.0.4",
86
+ "@nx/nx-linux-x64-gnu": "18.0.4",
87
+ "@nx/nx-linux-x64-musl": "18.0.4",
88
+ "@nx/nx-win32-x64-msvc": "18.0.4",
89
+ "@nx/nx-linux-arm64-gnu": "18.0.4",
90
+ "@nx/nx-linux-arm64-musl": "18.0.4",
91
+ "@nx/nx-linux-arm-gnueabihf": "18.0.4",
92
+ "@nx/nx-win32-arm64-msvc": "18.0.4",
93
+ "@nx/nx-freebsd-x64": "18.0.4"
94
94
  },
95
95
  "nx-migrations": {
96
96
  "migrations": "./migrations.json",
@@ -10,7 +10,6 @@ const tree_1 = require("../../generators/tree");
10
10
  const register_1 = require("../../plugins/js/utils/register");
11
11
  const project_graph_1 = require("../../project-graph/project-graph");
12
12
  const utils_1 = require("../../tasks-runner/utils");
13
- const logger_1 = require("../../utils/logger");
14
13
  const output_1 = require("../../utils/output");
15
14
  const params_1 = require("../../utils/params");
16
15
  const path_1 = require("../../utils/path");
@@ -272,9 +271,6 @@ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTa
272
271
  for (const postGitTask of postGitTasks) {
273
272
  await postGitTask(latestCommit);
274
273
  }
275
- if (args.dryRun) {
276
- logger_1.logger.warn(`\nNOTE: The "dryRun" flag means no changelogs were actually created.`);
277
- }
278
274
  return 0;
279
275
  }
280
276
  function resolveChangelogRenderer(changelogRendererPath) {
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.yargsReleaseCommand = void 0;
4
4
  const yargs_1 = require("yargs");
5
5
  const file_utils_1 = require("../../project-graph/file-utils");
6
+ const logger_1 = require("../../utils/logger");
6
7
  const shared_options_1 = require("../yargs-utils/shared-options");
7
8
  exports.yargsReleaseCommand = {
8
9
  command: 'release',
@@ -83,13 +84,17 @@ const releaseCommand = {
83
84
  }
84
85
  return true;
85
86
  }),
86
- handler: (args) => Promise.resolve().then(() => require('./release')).then((m) => m.releaseCLIHandler(args))
87
- .then((versionDataOrExitCode) => {
88
- if (typeof versionDataOrExitCode === 'number') {
89
- return process.exit(versionDataOrExitCode);
87
+ handler: async (args) => {
88
+ const release = await Promise.resolve().then(() => require('./release'));
89
+ const result = await release.releaseCLIHandler(args);
90
+ if (args.dryRun) {
91
+ logger_1.logger.warn(`\nNOTE: The "dryRun" flag means no changes were made.`);
92
+ }
93
+ if (typeof result === 'number') {
94
+ process.exit(result);
90
95
  }
91
96
  process.exit(0);
92
- }),
97
+ },
93
98
  };
94
99
  const versionCommand = {
95
100
  command: 'version [specifier]',
@@ -109,13 +114,17 @@ const versionCommand = {
109
114
  type: 'boolean',
110
115
  describe: 'Whether or not to stage the changes made by this command. Useful when combining this command with changelog generation.',
111
116
  })),
112
- handler: (args) => Promise.resolve().then(() => require('./version')).then((m) => m.releaseVersionCLIHandler(args))
113
- .then((versionDataOrExitCode) => {
114
- if (typeof versionDataOrExitCode === 'number') {
115
- return process.exit(versionDataOrExitCode);
117
+ handler: async (args) => {
118
+ const release = await Promise.resolve().then(() => require('./version'));
119
+ const result = await release.releaseVersionCLIHandler(args);
120
+ if (args.dryRun) {
121
+ logger_1.logger.warn(`\nNOTE: The "dryRun" flag means no changes were made.`);
122
+ }
123
+ if (typeof result === 'number') {
124
+ process.exit(result);
116
125
  }
117
126
  process.exit(0);
118
- }),
127
+ },
119
128
  };
120
129
  const changelogCommand = {
121
130
  command: 'changelog [version]',
@@ -155,8 +164,15 @@ const changelogCommand = {
155
164
  return true;
156
165
  })),
157
166
  handler: async (args) => {
158
- const status = await (await Promise.resolve().then(() => require('./changelog'))).releaseChangelogCLIHandler(args);
159
- process.exit(status);
167
+ const release = await Promise.resolve().then(() => require('./changelog'));
168
+ const result = await release.releaseChangelogCLIHandler(args);
169
+ if (args.dryRun) {
170
+ logger_1.logger.warn(`\nNOTE: The "dryRun" flag means no changes were made.`);
171
+ }
172
+ if (typeof result === 'number') {
173
+ process.exit(result);
174
+ }
175
+ process.exit(0);
160
176
  },
161
177
  };
162
178
  const publishCommand = {
@@ -178,6 +194,9 @@ const publishCommand = {
178
194
  }),
179
195
  handler: async (args) => {
180
196
  const status = await (await Promise.resolve().then(() => require('./publish'))).releasePublishCLIHandler(coerceParallelOption((0, shared_options_1.withOverrides)(args, 2)));
197
+ if (args.dryRun) {
198
+ logger_1.logger.warn(`\nNOTE: The "dryRun" flag means no changes were made.`);
199
+ }
181
200
  process.exit(status);
182
201
  },
183
202
  };
@@ -6,7 +6,6 @@ const devkit_exports_1 = require("../../devkit-exports");
6
6
  const project_graph_1 = require("../../project-graph/project-graph");
7
7
  const run_command_1 = require("../../tasks-runner/run-command");
8
8
  const command_line_utils_1 = require("../../utils/command-line-utils");
9
- const logger_1 = require("../../utils/logger");
10
9
  const params_1 = require("../../utils/params");
11
10
  const project_graph_utils_1 = require("../../utils/project-graph-utils");
12
11
  const graph_1 = require("../graph/graph");
@@ -70,9 +69,6 @@ async function releasePublish(args, isCLI = false) {
70
69
  overallExitStatus = status || 1;
71
70
  }
72
71
  }
73
- if (_args.dryRun) {
74
- logger_1.logger.warn(`\nNOTE: The "dryRun" flag means no projects were actually published.`);
75
- }
76
72
  return overallExitStatus;
77
73
  }
78
74
  exports.releasePublish = releasePublish;
@@ -102,22 +98,23 @@ async function runPublishOnProjects(args, projectGraph, nxJson, projectNames, sh
102
98
  if (args.firstRelease) {
103
99
  overrides.firstRelease = args.firstRelease;
104
100
  }
105
- const targets = ['nx-release-publish'];
101
+ const requiredTargetName = 'nx-release-publish';
106
102
  if (args.graph) {
107
103
  const file = (0, command_line_utils_1.readGraphFileFromGraphArg)(args);
108
- const projectNames = projectsToRun.map((t) => t.name);
104
+ const projectNamesWithTarget = projectsToRun
105
+ .map((t) => t.name)
106
+ .filter((projectName) => (0, project_graph_utils_1.projectHasTarget)(projectGraph.nodes[projectName], requiredTargetName));
109
107
  await (0, graph_1.generateGraph)({
110
108
  watch: false,
111
109
  all: false,
112
110
  open: true,
113
111
  view: 'tasks',
114
- targets,
115
- projects: projectNames,
112
+ targets: [requiredTargetName],
113
+ projects: projectNamesWithTarget,
116
114
  file,
117
- }, projectNames);
115
+ }, projectNamesWithTarget);
118
116
  return 0;
119
117
  }
120
- const requiredTargetName = 'nx-release-publish';
121
118
  const projectsWithTarget = projectsToRun.filter((project) => (0, project_graph_utils_1.projectHasTarget)(project, requiredTargetName));
122
119
  if (projectsWithTarget.length === 0) {
123
120
  throw new Error(`Based on your config, the following projects were matched for publishing but do not have the "${requiredTargetName}" target specified:\n${[
@@ -130,7 +127,7 @@ async function runPublishOnProjects(args, projectGraph, nxJson, projectNames, sh
130
127
  * Run the relevant nx-release-publish executor on each of the selected projects.
131
128
  */
132
129
  const status = await (0, run_command_1.runCommand)(projectsWithTarget, projectGraph, { nxJson }, {
133
- targets,
130
+ targets: [requiredTargetName],
134
131
  outputStyle: 'static',
135
132
  ...args,
136
133
  }, overrides, null, {}, {
@@ -99,13 +99,12 @@ async function release(args) {
99
99
  await (0, publish_1.releasePublish)(args);
100
100
  }
101
101
  else {
102
- console.log('Skipped publishing packages.');
102
+ devkit_exports_1.output.logSingleLine('Skipped publishing packages.');
103
103
  }
104
104
  return versionResult;
105
105
  }
106
106
  exports.release = release;
107
107
  async function promptForPublish() {
108
- console.log('\n');
109
108
  try {
110
109
  const reply = await (0, enquirer_1.prompt)([
111
110
  {
@@ -117,7 +116,6 @@ async function promptForPublish() {
117
116
  return reply.confirmation;
118
117
  }
119
118
  catch (e) {
120
- console.log('\n');
121
119
  // Handle the case where the user exits the prompt with ctrl+c
122
120
  return false;
123
121
  }
@@ -60,39 +60,22 @@ async function createOrUpdateGithubRelease(githubRequestConfig, release, existin
60
60
  console.error(`An unknown error occurred while trying to create a release on GitHub, please report this on https://github.com/nrwl/nx (NOTE: make sure to redact your GitHub token from the error message!)`);
61
61
  }
62
62
  }
63
- const reply = await (0, enquirer_1.prompt)([
64
- {
65
- name: 'open',
66
- message: 'Do you want to finish creating the release manually in your browser?',
67
- type: 'autocomplete',
68
- choices: [
69
- {
70
- name: 'Yes',
71
- hint: 'It will pre-populate the form for you',
72
- },
73
- {
74
- name: 'No',
75
- },
76
- ],
77
- initial: 0,
78
- },
79
- ]).catch(() => {
80
- return { open: 'No' };
81
- });
82
- if (reply.open === 'Yes') {
83
- const open = require('open');
84
- await open(result.url)
85
- .then(() => {
86
- console.info(`\nFollow up in the browser to manually create the release:\n\n` +
87
- chalk.underline(chalk.cyan(result.url)) +
88
- `\n`);
89
- })
90
- .catch(() => {
91
- console.info(`Open this link to manually create a release: \n` +
92
- chalk.underline(chalk.cyan(result.url)) +
93
- '\n');
94
- });
63
+ const shouldContinueInGitHub = await promptForContinueInGitHub();
64
+ if (!shouldContinueInGitHub) {
65
+ return;
95
66
  }
67
+ const open = require('open');
68
+ await open(result.url)
69
+ .then(() => {
70
+ console.info(`\nFollow up in the browser to manually create the release:\n\n` +
71
+ chalk.underline(chalk.cyan(result.url)) +
72
+ `\n`);
73
+ })
74
+ .catch(() => {
75
+ console.info(`Open this link to manually create a release: \n` +
76
+ chalk.underline(chalk.cyan(result.url)) +
77
+ '\n');
78
+ });
96
79
  }
97
80
  /**
98
81
  * If something went wrong POSTing to Github we can still pre-populate the web form on github.com
@@ -116,6 +99,32 @@ async function createOrUpdateGithubRelease(githubRequestConfig, release, existin
116
99
  }
117
100
  }
118
101
  exports.createOrUpdateGithubRelease = createOrUpdateGithubRelease;
102
+ async function promptForContinueInGitHub() {
103
+ try {
104
+ const reply = await (0, enquirer_1.prompt)([
105
+ {
106
+ name: 'open',
107
+ message: 'Do you want to finish creating the release manually in your browser?',
108
+ type: 'autocomplete',
109
+ choices: [
110
+ {
111
+ name: 'Yes',
112
+ hint: 'It will pre-populate the form for you',
113
+ },
114
+ {
115
+ name: 'No',
116
+ },
117
+ ],
118
+ initial: 0,
119
+ },
120
+ ]);
121
+ return reply.open === 'Yes';
122
+ }
123
+ catch (e) {
124
+ // Handle the case where the user exits the prompt with ctrl+c
125
+ process.exit(1);
126
+ }
127
+ }
119
128
  async function syncGithubRelease(githubRequestConfig, release, existingGithubReleaseForVersion) {
120
129
  const ghRelease = {
121
130
  tag_name: release.version,
@@ -144,9 +144,6 @@ async function releaseVersion(args) {
144
144
  });
145
145
  }
146
146
  }
147
- if (args.dryRun) {
148
- devkit_exports_1.logger.warn(`\nNOTE: The "dryRun" flag means no changes were made.`);
149
- }
150
147
  return {
151
148
  // An overall workspace version cannot be relevant when filtering to independent projects
152
149
  workspaceVersion: undefined,
@@ -234,9 +231,6 @@ async function releaseVersion(args) {
234
231
  });
235
232
  }
236
233
  }
237
- if (args.dryRun) {
238
- devkit_exports_1.logger.warn(`\nNOTE: The "dryRun" flag means no changes were made.`);
239
- }
240
234
  return {
241
235
  workspaceVersion,
242
236
  projectsVersionData: versionData,