nx 19.6.1 → 19.6.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/.eslintrc.json +12 -1
- package/README.md +1 -1
- package/package.json +12 -12
- package/src/command-line/add/add.js +1 -5
- package/src/command-line/add/command-object.js +1 -5
- package/src/command-line/affected/affected.js +0 -3
- package/src/command-line/exec/exec.js +0 -3
- package/src/command-line/generate/command-object.js +2 -5
- package/src/command-line/generate/generate.js +4 -8
- package/src/command-line/graph/graph.d.ts +18 -1
- package/src/command-line/import/command-object.js +1 -1
- package/src/command-line/import/utils/prepare-source-repo.js +2 -2
- package/src/command-line/migrate/command-object.js +3 -2
- package/src/command-line/migrate/migrate.js +5 -39
- package/src/command-line/release/changelog.js +0 -3
- package/src/command-line/release/command-object.js +1 -5
- package/src/command-line/release/plan-check.js +0 -3
- package/src/command-line/release/plan.js +0 -3
- package/src/command-line/release/publish.js +0 -6
- package/src/command-line/release/release.js +0 -3
- package/src/command-line/release/version.js +0 -3
- package/src/command-line/repair/command-object.js +2 -4
- package/src/command-line/repair/repair.js +2 -6
- package/src/command-line/run/run-one.js +0 -3
- package/src/command-line/show/command-object.js +2 -2
- package/src/command-line/sync/command-object.js +3 -8
- package/src/command-line/sync/sync.js +1 -5
- package/src/command-line/watch/command-object.js +1 -1
- package/src/command-line/watch/watch.js +0 -3
- package/src/command-line/yargs-utils/shared-options.d.ts +2 -1
- package/src/command-line/yargs-utils/shared-options.js +14 -18
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/client/client.js +4 -2
- package/src/devkit-exports.d.ts +1 -0
- package/src/native/assert-supported-platform.js +1 -1
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/utilities/url-shorten.js +1 -1
- package/src/plugins/js/package-json/create-package-json.d.ts +1 -0
- package/src/plugins/js/package-json/create-package-json.js +1 -1
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +11 -6
- package/src/tasks-runner/cache.js +1 -1
- package/src/utils/git-utils.js +1 -1
- package/src/utils/logger.js +1 -1
package/.eslintrc.json
CHANGED
@@ -100,7 +100,18 @@
|
|
100
100
|
"events", // This is coming from @storybook/builder-manager since it uses the browser polyfill
|
101
101
|
"process", // This is coming from @storybook/builder-manager since it uses the browser polyfill
|
102
102
|
"prettier", // This is coming from @storybook/builder-manager since it uses the browser polyfill
|
103
|
-
"util" // This is coming from @storybook/builder-manager since it uses the browser polyfill
|
103
|
+
"util", // This is coming from @storybook/builder-manager since it uses the browser polyfill
|
104
|
+
// The native modules are optional and only one of them will ever be installed on a given machine
|
105
|
+
"@nx/nx-darwin-x64",
|
106
|
+
"@nx/nx-darwin-arm64",
|
107
|
+
"@nx/nx-linux-x64-gnu",
|
108
|
+
"@nx/nx-linux-x64-musl",
|
109
|
+
"@nx/nx-win32-x64-msvc",
|
110
|
+
"@nx/nx-linux-arm64-gnu",
|
111
|
+
"@nx/nx-linux-arm64-musl",
|
112
|
+
"@nx/nx-linux-arm-gnueabihf",
|
113
|
+
"@nx/nx-win32-arm64-msvc",
|
114
|
+
"@nx/nx-freebsd-x64"
|
104
115
|
]
|
105
116
|
}
|
106
117
|
]
|
package/README.md
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
# Nx: Smart Monorepos · Fast CI
|
24
24
|
|
25
|
-
Nx is a build system
|
25
|
+
Nx is a build system, optimized for monorepos, with plugins for popular frameworks and tools and advanced CI capabilities including caching and distribution.
|
26
26
|
|
27
27
|
## Getting Started
|
28
28
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "19.6.
|
3
|
+
"version": "19.6.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": {
|
@@ -71,7 +71,7 @@
|
|
71
71
|
"yargs-parser": "21.1.1",
|
72
72
|
"node-machine-id": "1.1.12",
|
73
73
|
"ora": "5.3.0",
|
74
|
-
"@nrwl/tao": "19.6.
|
74
|
+
"@nrwl/tao": "19.6.3"
|
75
75
|
},
|
76
76
|
"peerDependencies": {
|
77
77
|
"@swc-node/register": "^1.8.0",
|
@@ -86,16 +86,16 @@
|
|
86
86
|
}
|
87
87
|
},
|
88
88
|
"optionalDependencies": {
|
89
|
-
"@nx/nx-darwin-x64": "19.6.
|
90
|
-
"@nx/nx-darwin-arm64": "19.6.
|
91
|
-
"@nx/nx-linux-x64-gnu": "19.6.
|
92
|
-
"@nx/nx-linux-x64-musl": "19.6.
|
93
|
-
"@nx/nx-win32-x64-msvc": "19.6.
|
94
|
-
"@nx/nx-linux-arm64-gnu": "19.6.
|
95
|
-
"@nx/nx-linux-arm64-musl": "19.6.
|
96
|
-
"@nx/nx-linux-arm-gnueabihf": "19.6.
|
97
|
-
"@nx/nx-win32-arm64-msvc": "19.6.
|
98
|
-
"@nx/nx-freebsd-x64": "19.6.
|
89
|
+
"@nx/nx-darwin-x64": "19.6.3",
|
90
|
+
"@nx/nx-darwin-arm64": "19.6.3",
|
91
|
+
"@nx/nx-linux-x64-gnu": "19.6.3",
|
92
|
+
"@nx/nx-linux-x64-musl": "19.6.3",
|
93
|
+
"@nx/nx-win32-x64-msvc": "19.6.3",
|
94
|
+
"@nx/nx-linux-arm64-gnu": "19.6.3",
|
95
|
+
"@nx/nx-linux-arm64-musl": "19.6.3",
|
96
|
+
"@nx/nx-linux-arm-gnueabihf": "19.6.3",
|
97
|
+
"@nx/nx-win32-arm64-msvc": "19.6.3",
|
98
|
+
"@nx/nx-freebsd-x64": "19.6.3"
|
99
99
|
},
|
100
100
|
"nx-migrations": {
|
101
101
|
"migrations": "./migrations.json",
|
@@ -18,11 +18,7 @@ const versions_1 = require("../../utils/versions");
|
|
18
18
|
const workspace_root_1 = require("../../utils/workspace-root");
|
19
19
|
const add_nx_scripts_1 = require("../init/implementation/dot-nx/add-nx-scripts");
|
20
20
|
function addHandler(options) {
|
21
|
-
|
22
|
-
process.env.NX_VERBOSE_LOGGING = 'true';
|
23
|
-
}
|
24
|
-
const isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
25
|
-
return (0, params_1.handleErrors)(isVerbose, async () => {
|
21
|
+
return (0, params_1.handleErrors)(options.verbose, async () => {
|
26
22
|
output_1.output.addNewline();
|
27
23
|
const [pkgName, version] = parsePackageSpecifier(options.packageSpecifier);
|
28
24
|
const nxJson = (0, nx_json_1.readNxJson)();
|
@@ -5,7 +5,7 @@ const shared_options_1 = require("../yargs-utils/shared-options");
|
|
5
5
|
exports.yargsAddCommand = {
|
6
6
|
command: 'add <packageSpecifier>',
|
7
7
|
describe: 'Install a plugin and initialize it.',
|
8
|
-
builder: (yargs) => yargs
|
8
|
+
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs)
|
9
9
|
.parserConfiguration({
|
10
10
|
'strip-dashed': true,
|
11
11
|
'unknown-options-as-args': true,
|
@@ -17,10 +17,6 @@ exports.yargsAddCommand = {
|
|
17
17
|
.option('updatePackageScripts', {
|
18
18
|
type: 'boolean',
|
19
19
|
description: 'Update `package.json` scripts with inferred targets. Defaults to `true` when the package is a core Nx plugin',
|
20
|
-
})
|
21
|
-
.option('verbose', {
|
22
|
-
type: 'boolean',
|
23
|
-
description: 'Prints additional information about the commands (e.g., stack traces)',
|
24
20
|
})
|
25
21
|
.example('$0 add @nx/react', 'Install the latest version of the `@nx/react` package and run its `@nx/react:init` generator')
|
26
22
|
.example('$0 add non-core-nx-plugin', 'Install the latest version of the `non-core-nx-plugin` package and run its `non-core-nx-plugin:init` generator if available')
|
@@ -27,9 +27,6 @@ async function affected(command, args, extraTargetDependencies = {}, extraOption
|
|
27
27
|
const { nxArgs, overrides } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', {
|
28
28
|
printWarnings: command !== 'print-affected' && !args.plain && args.graph !== 'stdout',
|
29
29
|
}, nxJson);
|
30
|
-
if (nxArgs.verbose) {
|
31
|
-
process.env.NX_VERBOSE_LOGGING = 'true';
|
32
|
-
}
|
33
30
|
await (0, connect_to_nx_cloud_1.connectToNxCloudIfExplicitlyAsked)(nxArgs);
|
34
31
|
const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
|
35
32
|
const projects = await getAffectedGraphNodes(nxArgs, projectGraph);
|
@@ -20,9 +20,6 @@ const get_command_projects_1 = require("../../commands-runner/get-command-projec
|
|
20
20
|
async function nxExecCommand(args) {
|
21
21
|
const nxJson = (0, configuration_1.readNxJson)();
|
22
22
|
const { nxArgs, overrides } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'run-many', { printWarnings: args.graph !== 'stdout' }, nxJson);
|
23
|
-
if (nxArgs.verbose) {
|
24
|
-
process.env.NX_VERBOSE_LOGGING = 'true';
|
25
|
-
}
|
26
23
|
const scriptArgV = readScriptArgV(overrides);
|
27
24
|
const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
|
28
25
|
// NX is already running
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.yargsGenerateCommand = void 0;
|
4
4
|
const path_1 = require("../../utils/path");
|
5
|
+
const shared_options_1 = require("../yargs-utils/shared-options");
|
5
6
|
exports.yargsGenerateCommand = {
|
6
7
|
command: 'generate <generator> [_..]',
|
7
8
|
describe: 'Generate or update source code (e.g., nx generate @nx/js:lib mylib).',
|
@@ -15,7 +16,7 @@ exports.yargsGenerateCommand = {
|
|
15
16
|
};
|
16
17
|
function withGenerateOptions(yargs) {
|
17
18
|
const generatorWillShowHelp = process.argv[3] && !process.argv[3].startsWith('-');
|
18
|
-
const res = yargs
|
19
|
+
const res = (0, shared_options_1.withVerbose)(yargs)
|
19
20
|
.positional('generator', {
|
20
21
|
describe: 'Name of the generator (e.g., @nx/js:library, library)',
|
21
22
|
type: 'string',
|
@@ -31,10 +32,6 @@ function withGenerateOptions(yargs) {
|
|
31
32
|
describe: 'When false disables interactive input prompts for options',
|
32
33
|
type: 'boolean',
|
33
34
|
default: true,
|
34
|
-
})
|
35
|
-
.option('verbose', {
|
36
|
-
describe: 'Prints additional information about the commands (e.g., stack traces)',
|
37
|
-
type: 'boolean',
|
38
35
|
})
|
39
36
|
.option('quiet', {
|
40
37
|
describe: 'Hides logs from tree operations (e.g. `CREATE package.json`)',
|
@@ -206,11 +206,7 @@ function printGenHelp(opts, schema, normalizedGeneratorName, aliases) {
|
|
206
206
|
});
|
207
207
|
}
|
208
208
|
async function generate(cwd, args) {
|
209
|
-
|
210
|
-
process.env.NX_VERBOSE_LOGGING = 'true';
|
211
|
-
}
|
212
|
-
const verbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
213
|
-
return (0, params_1.handleErrors)(verbose, async () => {
|
209
|
+
return (0, params_1.handleErrors)(args.verbose, async () => {
|
214
210
|
const nxJsonConfiguration = (0, configuration_1.readNxJson)();
|
215
211
|
const projectGraph = await (0, project_graph_1.createProjectGraphAsync)();
|
216
212
|
const projectsConfigurations = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
|
@@ -229,9 +225,9 @@ async function generate(cwd, args) {
|
|
229
225
|
printGenHelp(opts, schema, normalizedGeneratorName, aliases);
|
230
226
|
return 0;
|
231
227
|
}
|
232
|
-
const combinedOpts = await (0, params_1.combineOptionsForGenerator)(opts.generatorOptions, opts.collectionName, normalizedGeneratorName, projectsConfigurations, nxJsonConfiguration, schema, opts.interactive, (0, calculate_default_project_name_1.calculateDefaultProjectName)(cwd, workspace_root_1.workspaceRoot, projectsConfigurations, nxJsonConfiguration), (0, path_1.relative)(workspace_root_1.workspaceRoot, cwd), verbose);
|
228
|
+
const combinedOpts = await (0, params_1.combineOptionsForGenerator)(opts.generatorOptions, opts.collectionName, normalizedGeneratorName, projectsConfigurations, nxJsonConfiguration, schema, opts.interactive, (0, calculate_default_project_name_1.calculateDefaultProjectName)(cwd, workspace_root_1.workspaceRoot, projectsConfigurations, nxJsonConfiguration), (0, path_1.relative)(workspace_root_1.workspaceRoot, cwd), args.verbose);
|
233
229
|
if ((0, generator_utils_1.getGeneratorInformation)(opts.collectionName, normalizedGeneratorName, workspace_root_1.workspaceRoot, projectsConfigurations.projects).isNxGenerator) {
|
234
|
-
const host = new tree_1.FsTree(workspace_root_1.workspaceRoot, verbose, `generating (${opts.collectionName}:${normalizedGeneratorName})`);
|
230
|
+
const host = new tree_1.FsTree(workspace_root_1.workspaceRoot, args.verbose, `generating (${opts.collectionName}:${normalizedGeneratorName})`);
|
235
231
|
const implementation = implementationFactory();
|
236
232
|
// @todo(v17): Remove this, isStandalonePreset property is defunct.
|
237
233
|
if (normalizedGeneratorName === 'preset' && !isStandalonePreset) {
|
@@ -259,7 +255,7 @@ async function generate(cwd, args) {
|
|
259
255
|
return (await Promise.resolve().then(() => require('../../adapter/ngcli-adapter'))).generate(workspace_root_1.workspaceRoot, {
|
260
256
|
...opts,
|
261
257
|
generatorOptions: combinedOpts,
|
262
|
-
}, projectsConfigurations.projects, verbose);
|
258
|
+
}, projectsConfigurations.projects, args.verbose);
|
263
259
|
}
|
264
260
|
});
|
265
261
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ProjectFileMap, ProjectGraphDependency, ProjectGraphProjectNode } from '../../config/project-graph';
|
1
|
+
import { ProjectFileMap, ProjectGraph, ProjectGraphDependency, ProjectGraphProjectNode } from '../../config/project-graph';
|
2
2
|
import { TaskGraph } from '../../config/task-graph';
|
3
3
|
export interface GraphError {
|
4
4
|
message: string;
|
@@ -48,3 +48,20 @@ export declare function generateGraph(args: {
|
|
48
48
|
exclude?: string[];
|
49
49
|
affected?: boolean;
|
50
50
|
}, affectedProjects: string[]): Promise<void>;
|
51
|
+
/**
|
52
|
+
* The data type that `nx graph --file graph.json` or `nx build --graph graph.json` contains
|
53
|
+
*/
|
54
|
+
export interface GraphJson {
|
55
|
+
/**
|
56
|
+
* A graph of tasks populated with `nx build --graph`
|
57
|
+
*/
|
58
|
+
tasks?: TaskGraph;
|
59
|
+
/**
|
60
|
+
* The plans for hashing a task in the task graph
|
61
|
+
*/
|
62
|
+
taskPlans?: Record<string, string[]>;
|
63
|
+
/**
|
64
|
+
* The project graph
|
65
|
+
*/
|
66
|
+
graph: ProjectGraph;
|
67
|
+
}
|
@@ -30,7 +30,7 @@ exports.yargsImportCommand = {
|
|
30
30
|
default: true,
|
31
31
|
})), 'import'),
|
32
32
|
handler: async (args) => {
|
33
|
-
const exitCode = await (0, params_1.handleErrors)(args.verbose
|
33
|
+
const exitCode = await (0, params_1.handleErrors)(args.verbose, async () => {
|
34
34
|
return (await Promise.resolve().then(() => require('./import'))).importHandler(args);
|
35
35
|
});
|
36
36
|
process.exit(exitCode);
|
@@ -61,7 +61,7 @@ async function prepareSourceRepo(gitClient, ref, source, relativeDestination, te
|
|
61
61
|
await (0, promises_1.rm)(destinationInSource, {
|
62
62
|
recursive: true,
|
63
63
|
});
|
64
|
-
await gitClient.commit(
|
64
|
+
await gitClient.commit(`chore(repo): move ${source} to ${relativeDestination} to prepare to be imported`);
|
65
65
|
needsSquash = true;
|
66
66
|
}
|
67
67
|
catch { }
|
@@ -92,7 +92,7 @@ async function prepareSourceRepo(gitClient, ref, source, relativeDestination, te
|
|
92
92
|
});
|
93
93
|
}
|
94
94
|
}
|
95
|
-
await gitClient.commit(
|
95
|
+
await gitClient.commit(`chore(repo): move ${source} to ${relativeDestination} to prepare to be imported`);
|
96
96
|
if (needsSquash) {
|
97
97
|
await gitClient.squashLastTwoCommits();
|
98
98
|
}
|
@@ -8,6 +8,7 @@ const child_process_2 = require("child_process");
|
|
8
8
|
const package_manager_1 = require("../../utils/package-manager");
|
9
9
|
const fileutils_1 = require("../../utils/fileutils");
|
10
10
|
const workspace_root_1 = require("../../utils/workspace-root");
|
11
|
+
const shared_options_1 = require("../yargs-utils/shared-options");
|
11
12
|
exports.yargsMigrateCommand = {
|
12
13
|
command: 'migrate [packageAndVersion]',
|
13
14
|
describe: `Creates a migrations file or runs migrations from the migrations file.
|
@@ -27,7 +28,7 @@ exports.yargsInternalMigrateCommand = {
|
|
27
28
|
};
|
28
29
|
function withMigrationOptions(yargs) {
|
29
30
|
const defaultCommitPrefix = 'chore: [nx migration] ';
|
30
|
-
return yargs
|
31
|
+
return (0, shared_options_1.withVerbose)(yargs)
|
31
32
|
.positional('packageAndVersion', {
|
32
33
|
describe: `The target package and version (e.g, @nx/workspace@16.0.0)`,
|
33
34
|
type: 'string',
|
@@ -146,7 +147,7 @@ function nxCliPath() {
|
|
146
147
|
}
|
147
148
|
catch (e) {
|
148
149
|
console.error(`Failed to install the ${version} version of the migration script. Using the current version.`);
|
149
|
-
if (process.env.NX_VERBOSE_LOGGING) {
|
150
|
+
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
150
151
|
console.error(e);
|
151
152
|
}
|
152
153
|
return null;
|
@@ -1040,9 +1040,6 @@ async function runNxMigration(root, collectionPath, collection, name) {
|
|
1040
1040
|
return changes;
|
1041
1041
|
}
|
1042
1042
|
async function migrate(root, args, rawArgs) {
|
1043
|
-
if (args['verbose']) {
|
1044
|
-
process.env.NX_VERBOSE_LOGGING = 'true';
|
1045
|
-
}
|
1046
1043
|
await client_1.daemonClient.stop();
|
1047
1044
|
return (0, params_1.handleErrors)(process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
1048
1045
|
const opts = await parseMigrationsOptions(args);
|
@@ -1082,55 +1079,24 @@ function getImplementationPath(collection, collectionPath, name) {
|
|
1082
1079
|
}
|
1083
1080
|
return { path: implPath, fnSymbol };
|
1084
1081
|
}
|
1085
|
-
// TODO (
|
1086
|
-
// ```
|
1087
|
-
// return !collection.generators[name] && collection.schematics[name]
|
1088
|
-
// ```
|
1082
|
+
// TODO (v21): Remove CLI determination of Angular Migration
|
1089
1083
|
function isAngularMigration(collection, collectionPath, name) {
|
1090
1084
|
const entry = collection.generators?.[name] || collection.schematics?.[name];
|
1091
|
-
// In the future we will determine this based on the location of the entry in the collection.
|
1092
|
-
// If the entry is under `schematics`, it will be assumed to be an angular cli migration.
|
1093
|
-
// If the entry is under `generators`, it will be assumed to be an nx migration.
|
1094
|
-
// For now, we will continue to obey the cli property, if it exists.
|
1095
|
-
// If it doesn't exist, we will check if the implementation references @angular/devkit.
|
1096
1085
|
const shouldBeNx = !!collection.generators?.[name];
|
1097
1086
|
const shouldBeNg = !!collection.schematics?.[name];
|
1098
|
-
|
1099
|
-
const { path: implementationPath } = getImplementationPath(collection, collectionPath, name);
|
1100
|
-
const implStringContents = (0, fs_1.readFileSync)(implementationPath, 'utf-8');
|
1101
|
-
// TODO (v17): Remove this check and the cli property access - it is only here for backwards compatibility.
|
1102
|
-
if (['@angular/material', '@angular/cdk'].includes(collection.name) ||
|
1103
|
-
[
|
1104
|
-
"import('@angular-devkit",
|
1105
|
-
'import("@angular-devkit',
|
1106
|
-
"require('@angular-devkit",
|
1107
|
-
'require("@angular-devkit',
|
1108
|
-
"from '@angular-devkit",
|
1109
|
-
'from "@angular-devkit',
|
1110
|
-
].some((s) => implStringContents.includes(s))) {
|
1111
|
-
useAngularDevkitToRunMigration = true;
|
1112
|
-
}
|
1113
|
-
if (useAngularDevkitToRunMigration && shouldBeNx) {
|
1087
|
+
if (entry.cli && entry.cli !== 'nx' && collection.generators?.[name]) {
|
1114
1088
|
output_1.output.warn({
|
1115
1089
|
title: `The migration '${collection.name}:${name}' appears to be an Angular CLI migration, but is located in the 'generators' section of migrations.json.`,
|
1116
1090
|
bodyLines: [
|
1117
|
-
'In Nx
|
1118
|
-
|
1119
|
-
],
|
1120
|
-
});
|
1121
|
-
}
|
1122
|
-
if (!useAngularDevkitToRunMigration && entry.cli === 'nx' && shouldBeNg) {
|
1123
|
-
output_1.output.warn({
|
1124
|
-
title: `The migration '${collection.name}:${name}' appears to be an Nx migration, but is located in the 'schematics' section of migrations.json.`,
|
1125
|
-
bodyLines: [
|
1126
|
-
'In Nx 17, migrations inside `generators` will be treated as nx devkit migrations.',
|
1091
|
+
'In Nx 21, migrations inside `generators` will be treated as Nx Devkit migrations and therefore may not run correctly if they are using Angular Devkit.',
|
1092
|
+
'If the migration should be run with Angular Devkit, please place the migration inside `schematics` instead.',
|
1127
1093
|
"Please open an issue on the plugin's repository if you believe this is an error.",
|
1128
1094
|
],
|
1129
1095
|
});
|
1130
1096
|
}
|
1131
1097
|
// Currently, if the cli property exists we listen to it. If its nx, its not an ng cli migration.
|
1132
1098
|
// If the property is not set, we will fall back to our intuition.
|
1133
|
-
return entry.cli ? entry.cli !== 'nx' :
|
1099
|
+
return entry.cli ? entry.cli !== 'nx' : !shouldBeNx && shouldBeNg;
|
1134
1100
|
}
|
1135
1101
|
const getNgCompatLayer = (() => {
|
1136
1102
|
let _ngCliAdapter;
|
@@ -44,9 +44,6 @@ function createAPI(overrideReleaseConfig) {
|
|
44
44
|
const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
|
45
45
|
const nxJson = (0, nx_json_1.readNxJson)();
|
46
46
|
const userProvidedReleaseConfig = (0, deep_merge_json_1.deepMergeJson)(nxJson.release ?? {}, overrideReleaseConfig ?? {});
|
47
|
-
if (args.verbose) {
|
48
|
-
process.env.NX_VERBOSE_LOGGING = 'true';
|
49
|
-
}
|
50
47
|
// Apply default configuration to any optional user configuration
|
51
48
|
const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, await (0, file_map_utils_1.createProjectFileMapUsingProjectGraph)(projectGraph), userProvidedReleaseConfig);
|
52
49
|
if (configError) {
|
@@ -9,7 +9,7 @@ const shared_options_1 = require("../yargs-utils/shared-options");
|
|
9
9
|
exports.yargsReleaseCommand = {
|
10
10
|
command: 'release',
|
11
11
|
describe: 'Orchestrate versioning and publishing of applications and libraries',
|
12
|
-
builder: (yargs) => yargs
|
12
|
+
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs)
|
13
13
|
.command(releaseCommand)
|
14
14
|
.command(versionCommand)
|
15
15
|
.command(changelogCommand)
|
@@ -36,10 +36,6 @@ exports.yargsReleaseCommand = {
|
|
36
36
|
alias: 'd',
|
37
37
|
type: 'boolean',
|
38
38
|
default: false,
|
39
|
-
})
|
40
|
-
.option('verbose', {
|
41
|
-
type: 'boolean',
|
42
|
-
describe: 'Prints additional information about the commands (e.g., stack traces)',
|
43
39
|
})
|
44
40
|
// NOTE: The camel case format is required for the coerce() function to be called correctly. It still supports --print-config casing.
|
45
41
|
.option('printConfig', {
|
@@ -24,9 +24,6 @@ function createAPI(overrideReleaseConfig) {
|
|
24
24
|
const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
|
25
25
|
const nxJson = (0, nx_json_1.readNxJson)();
|
26
26
|
const userProvidedReleaseConfig = (0, deep_merge_json_1.deepMergeJson)(nxJson.release ?? {}, overrideReleaseConfig ?? {});
|
27
|
-
if (args.verbose) {
|
28
|
-
process.env.NX_VERBOSE_LOGGING = 'true';
|
29
|
-
}
|
30
27
|
// Apply default configuration to any optional user configuration
|
31
28
|
const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, await (0, file_map_utils_1.createProjectFileMapUsingProjectGraph)(projectGraph), userProvidedReleaseConfig);
|
32
29
|
if (configError) {
|
@@ -27,9 +27,6 @@ function createAPI(overrideReleaseConfig) {
|
|
27
27
|
const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
|
28
28
|
const nxJson = (0, nx_json_1.readNxJson)();
|
29
29
|
const userProvidedReleaseConfig = (0, deep_merge_json_1.deepMergeJson)(nxJson.release ?? {}, overrideReleaseConfig ?? {});
|
30
|
-
if (args.verbose) {
|
31
|
-
process.env.NX_VERBOSE_LOGGING = 'true';
|
32
|
-
}
|
33
30
|
// Apply default configuration to any optional user configuration
|
34
31
|
const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, await (0, file_map_utils_1.createProjectFileMapUsingProjectGraph)(projectGraph), userProvidedReleaseConfig);
|
35
32
|
if (configError) {
|
@@ -35,9 +35,6 @@ function createAPI(overrideReleaseConfig) {
|
|
35
35
|
const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
|
36
36
|
const nxJson = (0, nx_json_1.readNxJson)();
|
37
37
|
const userProvidedReleaseConfig = (0, deep_merge_json_1.deepMergeJson)(nxJson.release ?? {}, overrideReleaseConfig ?? {});
|
38
|
-
if (_args.verbose) {
|
39
|
-
process.env.NX_VERBOSE_LOGGING = 'true';
|
40
|
-
}
|
41
38
|
// Apply default configuration to any optional user configuration
|
42
39
|
const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, await (0, file_map_utils_1.createProjectFileMapUsingProjectGraph)(projectGraph), userProvidedReleaseConfig);
|
43
40
|
if (configError) {
|
@@ -114,9 +111,6 @@ async function runPublishOnProjects(args, projectGraph, nxJson, projectNames, is
|
|
114
111
|
*/
|
115
112
|
process.env.NX_DRY_RUN = 'true';
|
116
113
|
}
|
117
|
-
if (args.verbose) {
|
118
|
-
process.env.NX_VERBOSE_LOGGING = 'true';
|
119
|
-
}
|
120
114
|
if (args.firstRelease) {
|
121
115
|
overrides.firstRelease = args.firstRelease;
|
122
116
|
}
|
@@ -31,9 +31,6 @@ function createAPI(overrideReleaseConfig) {
|
|
31
31
|
const projectGraph = await (0, project_graph_1.createProjectGraphAsync)({ exitOnError: true });
|
32
32
|
const nxJson = (0, nx_json_1.readNxJson)();
|
33
33
|
const userProvidedReleaseConfig = (0, deep_merge_json_1.deepMergeJson)(nxJson.release ?? {}, overrideReleaseConfig ?? {});
|
34
|
-
if (args.verbose) {
|
35
|
-
process.env.NX_VERBOSE_LOGGING = 'true';
|
36
|
-
}
|
37
34
|
const hasVersionGitConfig = Object.keys(userProvidedReleaseConfig.version?.git ?? {}).length > 0;
|
38
35
|
const hasChangelogGitConfig = Object.keys(userProvidedReleaseConfig.changelog?.git ?? {}).length > 0;
|
39
36
|
if (hasVersionGitConfig || hasChangelogGitConfig) {
|
@@ -44,9 +44,6 @@ function createAPI(overrideReleaseConfig) {
|
|
44
44
|
const { projects } = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
|
45
45
|
const nxJson = (0, nx_json_1.readNxJson)();
|
46
46
|
const userProvidedReleaseConfig = (0, deep_merge_json_1.deepMergeJson)(nxJson.release ?? {}, overrideReleaseConfig ?? {});
|
47
|
-
if (args.verbose) {
|
48
|
-
process.env.NX_VERBOSE_LOGGING = 'true';
|
49
|
-
}
|
50
47
|
// Apply default configuration to any optional user configuration
|
51
48
|
const { error: configError, nxReleaseConfig } = await (0, config_1.createNxReleaseConfig)(projectGraph, await (0, file_map_utils_1.createProjectFileMapUsingProjectGraph)(projectGraph), userProvidedReleaseConfig);
|
52
49
|
if (configError) {
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.yargsRepairCommand = void 0;
|
4
4
|
const documentation_1 = require("../yargs-utils/documentation");
|
5
|
+
const shared_options_1 = require("../yargs-utils/shared-options");
|
5
6
|
exports.yargsRepairCommand = {
|
6
7
|
command: 'repair',
|
7
8
|
describe: `Repair any configuration that is no longer supported by Nx.
|
@@ -14,9 +15,6 @@ exports.yargsRepairCommand = {
|
|
14
15
|
If your repository has only ever updated to newer versions of Nx with
|
15
16
|
\`nx migrate\`, running \`nx repair\` should do nothing.
|
16
17
|
`,
|
17
|
-
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)(yargs, 'repair')
|
18
|
-
type: 'boolean',
|
19
|
-
describe: 'Prints additional information about the commands (e.g., stack traces)',
|
20
|
-
}),
|
18
|
+
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withVerbose)(yargs), 'repair'),
|
21
19
|
handler: async (args) => process.exit(await (await Promise.resolve().then(() => require('./repair'))).repair(args)),
|
22
20
|
};
|
@@ -6,11 +6,7 @@ const migrationsJson = require("../../../migrations.json");
|
|
6
6
|
const migrate_1 = require("../migrate/migrate");
|
7
7
|
const output_1 = require("../../utils/output");
|
8
8
|
async function repair(args, extraMigrations = []) {
|
9
|
-
|
10
|
-
process.env.NX_VERBOSE_LOGGING = 'true';
|
11
|
-
}
|
12
|
-
const verbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
13
|
-
return (0, params_1.handleErrors)(verbose, async () => {
|
9
|
+
return (0, params_1.handleErrors)(args.verbose, async () => {
|
14
10
|
const nxMigrations = Object.entries(migrationsJson.generators).reduce((agg, [name, migration]) => {
|
15
11
|
const skip = migration['x-repair-skip'];
|
16
12
|
if (!skip) {
|
@@ -25,7 +21,7 @@ async function repair(args, extraMigrations = []) {
|
|
25
21
|
return agg;
|
26
22
|
}, []);
|
27
23
|
const migrations = [...nxMigrations, ...extraMigrations];
|
28
|
-
const migrationsThatMadeNoChanges = await (0, migrate_1.executeMigrations)(process.cwd(), migrations, verbose, false, '');
|
24
|
+
const migrationsThatMadeNoChanges = await (0, migrate_1.executeMigrations)(process.cwd(), migrations, args.verbose, false, '');
|
29
25
|
if (migrationsThatMadeNoChanges.length < migrations.length) {
|
30
26
|
output_1.output.success({
|
31
27
|
title: `Successfully repaired your configuration. This workspace is up to date!`,
|
@@ -28,9 +28,6 @@ async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
|
|
28
28
|
configuration: opts.configuration,
|
29
29
|
targets: [opts.target],
|
30
30
|
}, 'run-one', { printWarnings: args.graph !== 'stdout' }, nxJson);
|
31
|
-
if (nxArgs.verbose) {
|
32
|
-
process.env.NX_VERBOSE_LOGGING = 'true';
|
33
|
-
}
|
34
31
|
if (nxArgs.help) {
|
35
32
|
await (await Promise.resolve().then(() => require('./run'))).printTargetRunHelp(opts, workspace_root_1.workspaceRoot);
|
36
33
|
process.exit(0);
|
@@ -65,7 +65,7 @@ const showProjectsCommand = {
|
|
65
65
|
.example('$0 show projects --type app --affected', 'Show affected apps in the workspace')
|
66
66
|
.example('$0 show projects --affected --exclude=*-e2e', 'Show affected projects in the workspace, excluding end-to-end projects'),
|
67
67
|
handler: async (args) => {
|
68
|
-
const exitCode = await (0, params_1.handleErrors)(args.verbose
|
68
|
+
const exitCode = await (0, params_1.handleErrors)(args.verbose, async () => {
|
69
69
|
const { showProjectsHandler } = await Promise.resolve().then(() => require('./projects'));
|
70
70
|
await showProjectsHandler(args);
|
71
71
|
});
|
@@ -106,7 +106,7 @@ const showProjectCommand = {
|
|
106
106
|
.example('$0 show project my-app', 'View project information for my-app in JSON format')
|
107
107
|
.example('$0 show project my-app --web', 'View project information for my-app in the browser'),
|
108
108
|
handler: async (args) => {
|
109
|
-
const exitCode = await (0, params_1.handleErrors)(args.verbose
|
109
|
+
const exitCode = await (0, params_1.handleErrors)(args.verbose, async () => {
|
110
110
|
const { showProjectHandler } = await Promise.resolve().then(() => require('./project'));
|
111
111
|
await showProjectHandler(args);
|
112
112
|
});
|
@@ -1,13 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.yargsSyncCheckCommand = exports.yargsSyncCommand = void 0;
|
4
|
+
const shared_options_1 = require("../yargs-utils/shared-options");
|
4
5
|
exports.yargsSyncCommand = {
|
5
6
|
command: 'sync',
|
6
7
|
describe: false,
|
7
|
-
builder: (yargs) =>
|
8
|
-
type: 'boolean',
|
9
|
-
description: 'Prints additional information about the commands (e.g., stack traces)',
|
10
|
-
}),
|
8
|
+
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs),
|
11
9
|
handler: async (args) => {
|
12
10
|
process.exit(await Promise.resolve().then(() => require('./sync')).then((m) => m.syncHandler(args)));
|
13
11
|
},
|
@@ -15,10 +13,7 @@ exports.yargsSyncCommand = {
|
|
15
13
|
exports.yargsSyncCheckCommand = {
|
16
14
|
command: 'sync:check',
|
17
15
|
describe: false,
|
18
|
-
builder: (yargs) =>
|
19
|
-
type: 'boolean',
|
20
|
-
description: 'Prints additional information about the commands (e.g., stack traces)',
|
21
|
-
}),
|
16
|
+
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs),
|
22
17
|
handler: async (args) => {
|
23
18
|
process.exit(await Promise.resolve().then(() => require('./sync')).then((m) => m.syncHandler({ ...args, check: true })));
|
24
19
|
},
|
@@ -8,11 +8,7 @@ const params_1 = require("../../utils/params");
|
|
8
8
|
const sync_generators_1 = require("../../utils/sync-generators");
|
9
9
|
const chalk = require("chalk");
|
10
10
|
function syncHandler(options) {
|
11
|
-
|
12
|
-
process.env.NX_VERBOSE_LOGGING = 'true';
|
13
|
-
}
|
14
|
-
const isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
15
|
-
return (0, params_1.handleErrors)(isVerbose, async () => {
|
11
|
+
return (0, params_1.handleErrors)(options.verbose, async () => {
|
16
12
|
const projectGraph = await (0, project_graph_1.createProjectGraphAsync)();
|
17
13
|
const syncGenerators = await (0, sync_generators_1.collectAllRegisteredSyncGenerators)(projectGraph);
|
18
14
|
const results = await (0, sync_generators_1.getSyncGeneratorChanges)(syncGenerators);
|
@@ -114,9 +114,6 @@ class BatchCommandRunner extends BatchFunctionRunner {
|
|
114
114
|
}
|
115
115
|
async function watch(args) {
|
116
116
|
const projectReplacementRegex = new RegExp(args.projectNameEnvName ?? DEFAULT_PROJECT_NAME_ENV, 'g');
|
117
|
-
if (args.verbose) {
|
118
|
-
process.env.NX_VERBOSE_LOGGING = 'true';
|
119
|
-
}
|
120
117
|
if (!client_1.daemonClient.enabled()) {
|
121
118
|
output_1.output.error({
|
122
119
|
title: 'Daemon is not running. The watch command is not supported without the Nx Daemon.',
|
@@ -1,7 +1,8 @@
|
|
1
|
-
import { Argv } from 'yargs';
|
1
|
+
import { Argv, ParserConfigurationOptions } from 'yargs';
|
2
2
|
interface ExcludeOptions {
|
3
3
|
exclude: string[];
|
4
4
|
}
|
5
|
+
export declare const defaultYargsParserConfiguration: Partial<ParserConfigurationOptions>;
|
5
6
|
export declare function withExcludeOption(yargs: Argv): Argv<ExcludeOptions>;
|
6
7
|
export interface RunOptions {
|
7
8
|
exclude: string;
|