nx 21.2.0-beta.1 → 21.2.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.
- package/README.md +1 -1
- package/bin/init-local.d.ts +1 -1
- package/bin/init-local.js +7 -1
- package/bin/nx.js +9 -6
- package/package.json +11 -11
- package/src/command-line/affected/command-object.js +1 -1
- package/src/command-line/graph/graph.d.ts +1 -0
- package/src/command-line/graph/graph.js +56 -11
- package/src/command-line/init/implementation/angular/legacy-angular-versions.js +23 -4
- package/src/command-line/migrate/migrate.js +10 -4
- package/src/command-line/release/changelog.js +15 -5
- package/src/command-line/release/version/release-group-processor.js +1 -1
- package/src/command-line/release/version/topological-sort.js +1 -1
- package/src/command-line/report/report.js +1 -1
- package/src/command-line/run/run-one.d.ts +10 -0
- package/src/command-line/run/run-one.js +16 -5
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/styles.js +1 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +2 -1
- package/src/executors/run-commands/run-commands.impl.js +5 -0
- package/src/native/index.d.ts +12 -2
- package/src/native/native-bindings.js +4 -1
- package/src/native/nx.wasi-browser.js +47 -40
- package/src/native/nx.wasi.cjs +47 -40
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/utilities/url-shorten.d.ts +1 -1
- package/src/nx-cloud/utilities/url-shorten.js +27 -26
- package/src/plugins/js/lock-file/pnpm-parser.js +11 -3
- package/src/plugins/js/lock-file/project-graph-pruning.d.ts +2 -1
- package/src/plugins/js/lock-file/project-graph-pruning.js +4 -0
- package/src/plugins/js/project-graph/affected/lock-file-changes.js +6 -3
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +22 -12
- package/src/plugins/js/utils/register.d.ts +3 -2
- package/src/plugins/js/utils/register.js +36 -22
- package/src/plugins/js/utils/typescript.d.ts +2 -1
- package/src/plugins/js/utils/typescript.js +12 -7
- package/src/project-graph/plugins/transpiler.js +5 -5
- package/src/tasks-runner/run-command.js +12 -1
- package/src/tasks-runner/running-tasks/noop-child-process.d.ts +2 -1
- package/src/tasks-runner/running-tasks/noop-child-process.js +4 -1
- package/src/utils/nx-console-prompt.d.ts +1 -0
- package/src/utils/nx-console-prompt.js +50 -0
package/README.md
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
# Nx: Smart Repos · Fast Builds
|
24
24
|
|
25
|
-
|
25
|
+
An AI-first build platform that connects everything from your editor to CI. Helping you deliver fast, without breaking things.
|
26
26
|
|
27
27
|
## Getting Started
|
28
28
|
|
package/bin/init-local.d.ts
CHANGED
@@ -4,5 +4,5 @@ import { WorkspaceTypeAndRoot } from '../src/utils/find-workspace-root';
|
|
4
4
|
*
|
5
5
|
* @param workspace Relevant local workspace properties
|
6
6
|
*/
|
7
|
-
export declare function initLocal(workspace: WorkspaceTypeAndRoot): void
|
7
|
+
export declare function initLocal(workspace: WorkspaceTypeAndRoot): Promise<void>;
|
8
8
|
export declare function rewriteTargetsAndProjects(args: string[]): string[];
|
package/bin/init-local.js
CHANGED
@@ -5,12 +5,13 @@ exports.rewriteTargetsAndProjects = rewriteTargetsAndProjects;
|
|
5
5
|
const perf_hooks_1 = require("perf_hooks");
|
6
6
|
const nx_commands_1 = require("../src/command-line/nx-commands");
|
7
7
|
const strip_indents_1 = require("../src/utils/strip-indents");
|
8
|
+
const nx_console_prompt_1 = require("../src/utils/nx-console-prompt");
|
8
9
|
/**
|
9
10
|
* Nx is being run inside a workspace.
|
10
11
|
*
|
11
12
|
* @param workspace Relevant local workspace properties
|
12
13
|
*/
|
13
|
-
function initLocal(workspace) {
|
14
|
+
async function initLocal(workspace) {
|
14
15
|
process.env.NX_CLI_SET = 'true';
|
15
16
|
try {
|
16
17
|
perf_hooks_1.performance.mark('init-local');
|
@@ -20,6 +21,11 @@ function initLocal(workspace) {
|
|
20
21
|
handleAngularCLIFallbacks(workspace);
|
21
22
|
return;
|
22
23
|
}
|
24
|
+
// Ensure NxConsole is installed if the user has it configured.
|
25
|
+
try {
|
26
|
+
await (0, nx_console_prompt_1.ensureNxConsoleInstalled)();
|
27
|
+
}
|
28
|
+
catch { }
|
23
29
|
const command = process.argv[2];
|
24
30
|
if (command === 'run' || command === 'g' || command === 'generate') {
|
25
31
|
nx_commands_1.commandsObject.parse(process.argv.slice(2));
|
package/bin/nx.js
CHANGED
@@ -23,7 +23,7 @@ process.on('exit', (...args) => {
|
|
23
23
|
globalThis.tuiOnProcessExit(...args);
|
24
24
|
}
|
25
25
|
});
|
26
|
-
function main() {
|
26
|
+
async function main() {
|
27
27
|
if (process.argv[2] !== 'report' &&
|
28
28
|
process.argv[2] !== '--version' &&
|
29
29
|
process.argv[2] !== '--help' &&
|
@@ -32,12 +32,12 @@ function main() {
|
|
32
32
|
}
|
33
33
|
require('nx/src/utils/perf-logging');
|
34
34
|
const workspace = (0, find_workspace_root_1.findWorkspaceRoot)(process.cwd());
|
35
|
-
perf_hooks_1.performance.mark('loading dotenv files:start');
|
36
35
|
if (workspace) {
|
36
|
+
perf_hooks_1.performance.mark('loading dotenv files:start');
|
37
37
|
(0, dotenv_1.loadRootEnvFiles)(workspace.dir);
|
38
|
+
perf_hooks_1.performance.mark('loading dotenv files:end');
|
39
|
+
perf_hooks_1.performance.measure('loading dotenv files', 'loading dotenv files:start', 'loading dotenv files:end');
|
38
40
|
}
|
39
|
-
perf_hooks_1.performance.mark('loading dotenv files:end');
|
40
|
-
perf_hooks_1.performance.measure('loading dotenv files', 'loading dotenv files:start', 'loading dotenv files:end');
|
41
41
|
// new is a special case because there is no local workspace to load
|
42
42
|
if (process.argv[2] === 'new' ||
|
43
43
|
process.argv[2] === '_migrate' ||
|
@@ -75,7 +75,7 @@ function main() {
|
|
75
75
|
}
|
76
76
|
// this file is already in the local workspace
|
77
77
|
if (isLocalInstall) {
|
78
|
-
(0, init_local_1.initLocal)(workspace);
|
78
|
+
await (0, init_local_1.initLocal)(workspace);
|
79
79
|
}
|
80
80
|
else {
|
81
81
|
// Nx is being run from globally installed CLI - hand off to the local
|
@@ -223,4 +223,7 @@ const getLatestVersionOfNx = ((fn) => {
|
|
223
223
|
process.on('exit', () => {
|
224
224
|
(0, db_connection_1.removeDbConnections)();
|
225
225
|
});
|
226
|
-
main()
|
226
|
+
main().catch((error) => {
|
227
|
+
console.error(error);
|
228
|
+
process.exit(1);
|
229
|
+
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "21.2.0-beta.
|
3
|
+
"version": "21.2.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": {
|
@@ -83,16 +83,16 @@
|
|
83
83
|
}
|
84
84
|
},
|
85
85
|
"optionalDependencies": {
|
86
|
-
"@nx/nx-darwin-arm64": "21.2.0-beta.
|
87
|
-
"@nx/nx-darwin-x64": "21.2.0-beta.
|
88
|
-
"@nx/nx-freebsd-x64": "21.2.0-beta.
|
89
|
-
"@nx/nx-linux-arm-gnueabihf": "21.2.0-beta.
|
90
|
-
"@nx/nx-linux-arm64-gnu": "21.2.0-beta.
|
91
|
-
"@nx/nx-linux-arm64-musl": "21.2.0-beta.
|
92
|
-
"@nx/nx-linux-x64-gnu": "21.2.0-beta.
|
93
|
-
"@nx/nx-linux-x64-musl": "21.2.0-beta.
|
94
|
-
"@nx/nx-win32-arm64-msvc": "21.2.0-beta.
|
95
|
-
"@nx/nx-win32-x64-msvc": "21.2.0-beta.
|
86
|
+
"@nx/nx-darwin-arm64": "21.2.0-beta.3",
|
87
|
+
"@nx/nx-darwin-x64": "21.2.0-beta.3",
|
88
|
+
"@nx/nx-freebsd-x64": "21.2.0-beta.3",
|
89
|
+
"@nx/nx-linux-arm-gnueabihf": "21.2.0-beta.3",
|
90
|
+
"@nx/nx-linux-arm64-gnu": "21.2.0-beta.3",
|
91
|
+
"@nx/nx-linux-arm64-musl": "21.2.0-beta.3",
|
92
|
+
"@nx/nx-linux-x64-gnu": "21.2.0-beta.3",
|
93
|
+
"@nx/nx-linux-x64-musl": "21.2.0-beta.3",
|
94
|
+
"@nx/nx-win32-arm64-msvc": "21.2.0-beta.3",
|
95
|
+
"@nx/nx-win32-x64-msvc": "21.2.0-beta.3"
|
96
96
|
},
|
97
97
|
"nx-migrations": {
|
98
98
|
"migrations": "./migrations.json",
|
@@ -6,7 +6,7 @@ const documentation_1 = require("../yargs-utils/documentation");
|
|
6
6
|
const shared_options_1 = require("../yargs-utils/shared-options");
|
7
7
|
exports.yargsAffectedCommand = {
|
8
8
|
command: 'affected',
|
9
|
-
describe: 'Run target for affected projects. See https://nx.dev/ci/features/affected for more details.',
|
9
|
+
describe: 'Run target for affected projects. Affected projects are projects that have been changed and projects that depend on the changed projects. See https://nx.dev/ci/features/affected for more details.',
|
10
10
|
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withAffectedOptions)((0, shared_options_1.withTuiOptions)((0, shared_options_1.withRunOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withTargetAndConfigurationOption)((0, shared_options_1.withBatch)(yargs))))))
|
11
11
|
.option('all', {
|
12
12
|
type: 'boolean',
|
@@ -9,6 +9,7 @@ const minimatch_1 = require("minimatch");
|
|
9
9
|
const node_url_1 = require("node:url");
|
10
10
|
const open = require("open");
|
11
11
|
const path_1 = require("path");
|
12
|
+
const net = require("net");
|
12
13
|
const perf_hooks_1 = require("perf_hooks");
|
13
14
|
const configuration_1 = require("../../config/configuration");
|
14
15
|
const fileutils_1 = require("../../utils/fileutils");
|
@@ -207,7 +208,7 @@ async function generateGraph(args, affectedProjects) {
|
|
207
208
|
}
|
208
209
|
}
|
209
210
|
if (args.affected) {
|
210
|
-
affectedProjects = (await (0, affected_1.getAffectedGraphNodes)((0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', { printWarnings: args.file !== 'stdout' }, (0, configuration_1.readNxJson)()).nxArgs, rawGraph)).map((n) => n.name);
|
211
|
+
affectedProjects = (await (0, affected_1.getAffectedGraphNodes)((0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', { printWarnings: !args.print && args.file !== 'stdout' }, (0, configuration_1.readNxJson)()).nxArgs, rawGraph)).map((n) => n.name);
|
211
212
|
}
|
212
213
|
if (args.exclude) {
|
213
214
|
const invalidExcludes = [];
|
@@ -226,13 +227,12 @@ async function generateGraph(args, affectedProjects) {
|
|
226
227
|
}
|
227
228
|
let html = (0, node_fs_1.readFileSync)((0, path_1.join)(__dirname, '../../core/graph/index.html'), 'utf-8');
|
228
229
|
prunedGraph = filterGraph(prunedGraph, args.focus || null, args.exclude || []);
|
230
|
+
if (args.print || args.file === 'stdout') {
|
231
|
+
console.log(JSON.stringify(await createJsonOutput(prunedGraph, rawGraph, args.projects, args.targets), null, 2));
|
232
|
+
await output_1.output.drain();
|
233
|
+
process.exit(0);
|
234
|
+
}
|
229
235
|
if (args.file) {
|
230
|
-
// stdout is a magical constant that doesn't actually write a file
|
231
|
-
if (args.file === 'stdout') {
|
232
|
-
console.log(JSON.stringify(await createJsonOutput(prunedGraph, rawGraph, args.projects, args.targets), null, 2));
|
233
|
-
await output_1.output.drain();
|
234
|
-
process.exit(0);
|
235
|
-
}
|
236
236
|
const workspaceFolder = workspace_root_1.workspaceRoot;
|
237
237
|
const ext = (0, path_1.extname)(args.file);
|
238
238
|
const fullFilePath = (0, path_1.isAbsolute)(args.file)
|
@@ -287,7 +287,20 @@ async function generateGraph(args, affectedProjects) {
|
|
287
287
|
}
|
288
288
|
else {
|
289
289
|
const environmentJs = buildEnvironmentJs(args.exclude || [], args.watch, !!args.file && args.file.endsWith('html') ? 'build' : 'serve');
|
290
|
-
|
290
|
+
let app;
|
291
|
+
let url;
|
292
|
+
try {
|
293
|
+
const result = await startServer(html, environmentJs, args.host || '127.0.0.1', args.port || 4211, args.watch, affectedProjects, args.focus, args.groupByFolder, args.exclude);
|
294
|
+
app = result.app;
|
295
|
+
url = result.url;
|
296
|
+
}
|
297
|
+
catch (err) {
|
298
|
+
output_1.output.error({
|
299
|
+
title: 'Failed to start graph server',
|
300
|
+
bodyLines: [err.message],
|
301
|
+
});
|
302
|
+
process.exit(1);
|
303
|
+
}
|
291
304
|
url.pathname = args.view;
|
292
305
|
if (args.focus) {
|
293
306
|
url.pathname += '/' + encodeURIComponent(args.focus);
|
@@ -318,6 +331,28 @@ async function generateGraph(args, affectedProjects) {
|
|
318
331
|
});
|
319
332
|
}
|
320
333
|
}
|
334
|
+
function findAvailablePort(startPort, host = '127.0.0.1') {
|
335
|
+
return new Promise((resolve, reject) => {
|
336
|
+
const server = net.createServer();
|
337
|
+
server.listen(startPort, host, () => {
|
338
|
+
const port = server.address().port;
|
339
|
+
server.close(() => {
|
340
|
+
resolve(port);
|
341
|
+
});
|
342
|
+
});
|
343
|
+
server.on('error', (err) => {
|
344
|
+
if (err.code === 'EADDRINUSE') {
|
345
|
+
// Port is in use, try the next one
|
346
|
+
findAvailablePort(startPort + 1, host)
|
347
|
+
.then(resolve)
|
348
|
+
.catch(reject);
|
349
|
+
}
|
350
|
+
else {
|
351
|
+
reject(err);
|
352
|
+
}
|
353
|
+
});
|
354
|
+
});
|
355
|
+
}
|
321
356
|
async function startServer(html, environmentJs, host, port = 4211, watchForChanges = true, affected = [], focus = null, groupByFolder = false, exclude = []) {
|
322
357
|
let unregisterFileWatcher;
|
323
358
|
if (watchForChanges && !client_1.daemonClient.enabled()) {
|
@@ -418,9 +453,19 @@ async function startServer(html, environmentJs, host, port = 4211, watchForChang
|
|
418
453
|
};
|
419
454
|
process.on('SIGINT', () => handleTermination(128 + 2));
|
420
455
|
process.on('SIGTERM', () => handleTermination(128 + 15));
|
421
|
-
|
422
|
-
|
423
|
-
|
456
|
+
// Find an available port starting from the requested port
|
457
|
+
const availablePort = await findAvailablePort(port, host);
|
458
|
+
return new Promise((res, rej) => {
|
459
|
+
app.on('error', (err) => {
|
460
|
+
rej(err);
|
461
|
+
});
|
462
|
+
app.listen(availablePort, host, () => {
|
463
|
+
if (availablePort !== port) {
|
464
|
+
output_1.output.note({
|
465
|
+
title: `Port ${port} was already in use, using port ${availablePort} instead`,
|
466
|
+
});
|
467
|
+
}
|
468
|
+
res({ app, url: new node_url_1.URL(`http://${host}:${availablePort}`) });
|
424
469
|
});
|
425
470
|
});
|
426
471
|
}
|
@@ -5,28 +5,47 @@ const child_process_1 = require("child_process");
|
|
5
5
|
const path_1 = require("path");
|
6
6
|
const semver_1 = require("semver");
|
7
7
|
const fileutils_1 = require("../../../../utils/fileutils");
|
8
|
+
const installation_directory_1 = require("../../../../utils/installation-directory");
|
8
9
|
const object_sort_1 = require("../../../../utils/object-sort");
|
9
10
|
const output_1 = require("../../../../utils/output");
|
10
11
|
const package_json_1 = require("../../../../utils/package-json");
|
11
12
|
const package_manager_1 = require("../../../../utils/package-manager");
|
12
|
-
const utils_1 = require("../utils");
|
13
13
|
const connect_to_nx_cloud_1 = require("../../../connect/connect-to-nx-cloud");
|
14
|
+
const utils_1 = require("../utils");
|
14
15
|
// map of Angular major versions to Nx versions to use for legacy `nx init` migrations,
|
15
16
|
// key is major Angular version and value is Nx version to use
|
16
17
|
const nxAngularLegacyVersionMap = {
|
17
18
|
14: '~17.0.0',
|
18
19
|
15: '~19.0.0',
|
19
20
|
16: '~20.1.0',
|
21
|
+
17: '~21.1.0',
|
20
22
|
};
|
21
23
|
// min major angular version supported in latest Nx
|
22
|
-
const minMajorAngularVersionSupported =
|
24
|
+
const minMajorAngularVersionSupported = Math.max(...Object.keys(nxAngularLegacyVersionMap).map(Number)) + 1;
|
23
25
|
// version when the Nx CLI changed from @nrwl/tao & @nrwl/cli to nx
|
24
26
|
const versionWithConsolidatedPackages = '13.9.0';
|
25
27
|
// version when packages were rescoped from @nrwl/* to @nx/*
|
26
28
|
const versionWithRescopeToNx = '16.0.0-beta.2';
|
27
29
|
async function getLegacyMigrationFunctionIfApplicable(repoRoot, options) {
|
28
|
-
|
29
|
-
|
30
|
+
let majorAngularVersion;
|
31
|
+
try {
|
32
|
+
const angularVersion = (0, package_json_1.readModulePackageJson)('@angular/core', [
|
33
|
+
repoRoot,
|
34
|
+
...(0, installation_directory_1.getNxRequirePaths)(),
|
35
|
+
]).packageJson.version;
|
36
|
+
majorAngularVersion = (0, semver_1.major)(angularVersion);
|
37
|
+
}
|
38
|
+
catch {
|
39
|
+
output_1.output.error({
|
40
|
+
title: 'Could not determine the existing Angular version',
|
41
|
+
bodyLines: [
|
42
|
+
'Please ensure "@angular/core" is installed in the workspace and you are running this command from the root of the workspace.',
|
43
|
+
],
|
44
|
+
});
|
45
|
+
// errors are caught in the initHandler and not logged to the user, so we
|
46
|
+
// log it first and then throw to ensure it is logged to the user
|
47
|
+
throw new Error('Could not determine the existing Angular version');
|
48
|
+
}
|
30
49
|
if (majorAngularVersion >= minMajorAngularVersionSupported) {
|
31
50
|
// non-legacy
|
32
51
|
return null;
|
@@ -1175,6 +1175,7 @@ function getImplementationPath(collection, collectionPath, name) {
|
|
1175
1175
|
}
|
1176
1176
|
function nxCliPath(nxWorkspaceRoot) {
|
1177
1177
|
const version = process.env.NX_MIGRATE_CLI_VERSION || 'latest';
|
1178
|
+
const isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
1178
1179
|
try {
|
1179
1180
|
const packageManager = (0, package_manager_1.detectPackageManager)();
|
1180
1181
|
const pmc = (0, package_manager_1.getPackageManagerCommand)(packageManager);
|
@@ -1187,25 +1188,30 @@ function nxCliPath(nxWorkspaceRoot) {
|
|
1187
1188
|
license: 'MIT',
|
1188
1189
|
});
|
1189
1190
|
(0, package_manager_1.copyPackageManagerConfigurationFiles)(nxWorkspaceRoot ?? workspace_root_1.workspaceRoot, tmpDir);
|
1191
|
+
// Let's print the output of the install process to the console when verbose
|
1192
|
+
// is enabled, so it's easier to debug issues with the installation process
|
1193
|
+
const stdio = isVerbose
|
1194
|
+
? ['ignore', 'inherit', 'inherit']
|
1195
|
+
: 'ignore';
|
1190
1196
|
if (pmc.preInstall) {
|
1191
1197
|
// ensure package.json and repo in tmp folder is set to a proper package manager state
|
1192
1198
|
(0, child_process_1.execSync)(pmc.preInstall, {
|
1193
1199
|
cwd: tmpDir,
|
1194
|
-
stdio
|
1200
|
+
stdio,
|
1195
1201
|
windowsHide: false,
|
1196
1202
|
});
|
1197
1203
|
// if it's berry ensure we set the node_linker to node-modules
|
1198
1204
|
if (packageManager === 'yarn' && pmc.ciInstall.includes('immutable')) {
|
1199
1205
|
(0, child_process_1.execSync)('yarn config set nodeLinker node-modules', {
|
1200
1206
|
cwd: tmpDir,
|
1201
|
-
stdio
|
1207
|
+
stdio,
|
1202
1208
|
windowsHide: false,
|
1203
1209
|
});
|
1204
1210
|
}
|
1205
1211
|
}
|
1206
1212
|
(0, child_process_1.execSync)(pmc.install, {
|
1207
1213
|
cwd: tmpDir,
|
1208
|
-
stdio
|
1214
|
+
stdio,
|
1209
1215
|
windowsHide: false,
|
1210
1216
|
});
|
1211
1217
|
// Set NODE_PATH so that these modules can be used for module resolution
|
@@ -1215,7 +1221,7 @@ function nxCliPath(nxWorkspaceRoot) {
|
|
1215
1221
|
}
|
1216
1222
|
catch (e) {
|
1217
1223
|
console.error(`Failed to install the ${version} version of the migration script. Using the current version.`);
|
1218
|
-
if (
|
1224
|
+
if (isVerbose) {
|
1219
1225
|
console.error(e);
|
1220
1226
|
}
|
1221
1227
|
return null;
|
@@ -330,19 +330,25 @@ function createAPI(overrideReleaseConfig) {
|
|
330
330
|
}, releaseGroup.releaseTagPatternCheckAllBranchesWhen))?.tag;
|
331
331
|
if (!fromRef && useAutomaticFromRef) {
|
332
332
|
const firstCommit = await (0, git_1.getFirstGitCommit)();
|
333
|
-
|
334
|
-
|
335
|
-
|
333
|
+
commits = await filterProjectCommits({
|
334
|
+
fromSHA: firstCommit,
|
335
|
+
toSHA,
|
336
|
+
projectPath: project.data.root,
|
337
|
+
});
|
338
|
+
fromRef = commits[0]?.shortHash;
|
336
339
|
if (args.verbose) {
|
337
340
|
console.log(`Determined --from ref for ${project.name} from the first commit in which it exists: ${fromRef}`);
|
338
341
|
}
|
339
|
-
commits = commitsForProject;
|
340
342
|
}
|
341
343
|
if (!fromRef && !commits) {
|
342
344
|
throw new Error(`Unable to determine the previous git tag. If this is the first release of your workspace, use the --first-release option or set the "release.changelog.automaticFromRef" config property in nx.json to generate a changelog from the first commit. Otherwise, be sure to configure the "release.releaseTagPattern" property in nx.json to match the structure of your repository's git tags.`);
|
343
345
|
}
|
344
346
|
if (!commits) {
|
345
|
-
commits = await
|
347
|
+
commits = await filterProjectCommits({
|
348
|
+
fromSHA: fromRef,
|
349
|
+
toSHA,
|
350
|
+
projectPath: project.data.root,
|
351
|
+
});
|
346
352
|
}
|
347
353
|
const { fileMap } = await (0, file_map_utils_1.createFileMapUsingProjectGraph)(projectGraph);
|
348
354
|
const fileToProjectMap = createFileToProjectMap(fileMap.projectFileMap);
|
@@ -903,6 +909,10 @@ async function getCommits(fromSHA, toSHA) {
|
|
903
909
|
// Parse as conventional commits
|
904
910
|
return (0, git_1.parseCommits)(rawCommits);
|
905
911
|
}
|
912
|
+
async function filterProjectCommits({ fromSHA, toSHA, projectPath, }) {
|
913
|
+
const allCommits = await getCommits(fromSHA, toSHA);
|
914
|
+
return allCommits.filter((c) => c.affectedFiles.find((f) => f.startsWith(projectPath)));
|
915
|
+
}
|
906
916
|
function filterHiddenChanges(changes, conventionalCommitsConfig) {
|
907
917
|
return changes.filter((change) => {
|
908
918
|
const type = change.type;
|
@@ -956,7 +956,7 @@ Valid values are: ${version_1.validReleaseVersionPrefixes
|
|
956
956
|
let bumpType = 'none';
|
957
957
|
if (releaseGroup.projectsRelationship === 'fixed') {
|
958
958
|
// For fixed groups, we only need to check one project
|
959
|
-
const project = releaseGroupFilteredProjects
|
959
|
+
const project = releaseGroupFilteredProjects.values().next().value;
|
960
960
|
const dependencies = this.projectGraph.dependencies[project] || [];
|
961
961
|
const hasDependencyInChangedGroup = dependencies.some((dep) => this.getReleaseGroupNameForProject(dep.target) ===
|
962
962
|
changedDependencyGroup);
|
@@ -123,7 +123,7 @@ async function reportHandler() {
|
|
123
123
|
bodyLines.push(LINE_SEPARATOR);
|
124
124
|
bodyLines.push('Local workspace plugins:');
|
125
125
|
for (const plugin of localPlugins) {
|
126
|
-
bodyLines.push(
|
126
|
+
bodyLines.push(`${chalk.green(plugin)}`);
|
127
127
|
}
|
128
128
|
}
|
129
129
|
if (cache) {
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { ProjectGraph } from '../../config/project-graph';
|
2
|
+
import { NxJsonConfiguration } from '../../config/nx-json';
|
1
3
|
import { TargetDependencyConfig } from '../../config/workspace-json-project-json';
|
2
4
|
export declare function runOne(cwd: string, args: {
|
3
5
|
[k: string]: any;
|
@@ -5,3 +7,11 @@ export declare function runOne(cwd: string, args: {
|
|
5
7
|
excludeTaskDependencies: boolean;
|
6
8
|
loadDotEnvFiles: boolean;
|
7
9
|
}): Promise<void>;
|
10
|
+
export declare function parseRunOneOptions(cwd: string, parsedArgs: {
|
11
|
+
[k: string]: any;
|
12
|
+
}, projectGraph: ProjectGraph, nxJson: NxJsonConfiguration): {
|
13
|
+
project: any;
|
14
|
+
target: any;
|
15
|
+
configuration: any;
|
16
|
+
parsedArgs: any;
|
17
|
+
};
|
@@ -1,10 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.runOne = runOne;
|
4
|
+
exports.parseRunOneOptions = parseRunOneOptions;
|
4
5
|
const run_command_1 = require("../../tasks-runner/run-command");
|
5
6
|
const command_line_utils_1 = require("../../utils/command-line-utils");
|
6
7
|
const connect_to_nx_cloud_1 = require("../connect/connect-to-nx-cloud");
|
7
|
-
const perf_hooks_1 = require("perf_hooks");
|
8
8
|
const project_graph_1 = require("../../project-graph/project-graph");
|
9
9
|
const workspace_root_1 = require("../../utils/workspace-root");
|
10
10
|
const split_target_1 = require("../../utils/split-target");
|
@@ -17,8 +17,8 @@ async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
|
|
17
17
|
excludeTaskDependencies: args.excludeTaskDependencies,
|
18
18
|
loadDotEnvFiles: process.env.NX_LOAD_DOT_ENV_FILES !== 'false',
|
19
19
|
}) {
|
20
|
-
|
21
|
-
|
20
|
+
performance.mark('code-loading:end');
|
21
|
+
performance.measure('code-loading', 'init-local', 'code-loading:end');
|
22
22
|
const nxJson = (0, configuration_1.readNxJson)();
|
23
23
|
const projectGraph = await (0, project_graph_1.createProjectGraphAsync)();
|
24
24
|
const opts = parseRunOneOptions(cwd, args, projectGraph, nxJson);
|
@@ -107,8 +107,19 @@ function parseRunOneOptions(cwd, parsedArgs, projectGraph, nxJson) {
|
|
107
107
|
project = defaultProjectName;
|
108
108
|
}
|
109
109
|
}
|
110
|
-
else {
|
111
|
-
target = parsedArgs.target
|
110
|
+
else if (parsedArgs.target) {
|
111
|
+
target = parsedArgs.target;
|
112
|
+
}
|
113
|
+
else if (parsedArgs['project:target:configuration']) {
|
114
|
+
// If project:target:configuration exists but has no colon, check if it's a project with run target
|
115
|
+
if (projectGraph.nodes[parsedArgs['project:target:configuration']]?.data
|
116
|
+
?.targets?.run) {
|
117
|
+
target = 'run';
|
118
|
+
project = parsedArgs['project:target:configuration'];
|
119
|
+
}
|
120
|
+
else {
|
121
|
+
target = parsedArgs['project:target:configuration'];
|
122
|
+
}
|
112
123
|
}
|
113
124
|
if (parsedArgs.project) {
|
114
125
|
project = parsedArgs.project;
|