nx 19.7.2 → 19.7.3
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +12 -12
- package/src/command-line/add/add.js +2 -2
- package/src/command-line/affected/command-object.js +6 -6
- package/src/command-line/deprecated/command-objects.js +3 -3
- package/src/command-line/generate/generate.js +2 -1
- package/src/command-line/import/command-object.js +8 -6
- package/src/command-line/import/import.d.ts +1 -1
- package/src/command-line/import/import.js +42 -27
- package/src/command-line/login/login.js +2 -2
- package/src/command-line/logout/logout.js +2 -2
- package/src/command-line/migrate/migrate.js +2 -2
- package/src/command-line/new/new.js +2 -1
- package/src/command-line/release/changelog.js +2 -2
- package/src/command-line/release/plan-check.js +2 -2
- package/src/command-line/release/plan.js +2 -2
- package/src/command-line/release/publish.js +2 -2
- package/src/command-line/release/release.js +2 -2
- package/src/command-line/release/version.js +2 -1
- package/src/command-line/repair/repair.js +2 -2
- package/src/command-line/run/command-object.js +3 -3
- package/src/command-line/run/run.js +3 -2
- package/src/command-line/run-many/command-object.js +2 -2
- package/src/command-line/show/command-object.js +3 -3
- package/src/command-line/sync/sync.js +69 -11
- package/src/daemon/client/client.d.ts +3 -3
- package/src/daemon/server/handle-flush-sync-generator-changes-to-disk.js +2 -2
- package/src/daemon/server/handle-get-sync-generator-changes.js +8 -6
- package/src/daemon/server/sync-generators.d.ts +4 -4
- package/src/daemon/server/sync-generators.js +11 -2
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +0 -1
- package/src/nx-cloud/utilities/get-cloud-options.d.ts +1 -0
- package/src/nx-cloud/utilities/get-cloud-options.js +4 -0
- package/src/nx-cloud/utilities/is-workspace-claimed.d.ts +1 -1
- package/src/nx-cloud/utilities/is-workspace-claimed.js +6 -5
- package/src/nx-cloud/utilities/onboarding.js +2 -2
- package/src/project-graph/error-types.d.ts +1 -1
- package/src/project-graph/error-types.js +19 -5
- package/src/tasks-runner/run-command.js +139 -29
- package/src/utils/handle-errors.d.ts +1 -0
- package/src/utils/handle-errors.js +71 -0
- package/src/utils/nx-cloud-utils.d.ts +0 -1
- package/src/utils/nx-cloud-utils.js +0 -10
- package/src/utils/params.d.ts +0 -1
- package/src/utils/params.js +0 -50
- package/src/utils/plugins/plugin-capabilities.js +4 -1
- package/src/utils/sync-generators.d.ts +35 -6
- package/src/utils/sync-generators.js +144 -47
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "19.7.
|
3
|
+
"version": "19.7.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.7.
|
74
|
+
"@nrwl/tao": "19.7.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.7.
|
90
|
-
"@nx/nx-darwin-arm64": "19.7.
|
91
|
-
"@nx/nx-linux-x64-gnu": "19.7.
|
92
|
-
"@nx/nx-linux-x64-musl": "19.7.
|
93
|
-
"@nx/nx-win32-x64-msvc": "19.7.
|
94
|
-
"@nx/nx-linux-arm64-gnu": "19.7.
|
95
|
-
"@nx/nx-linux-arm64-musl": "19.7.
|
96
|
-
"@nx/nx-linux-arm-gnueabihf": "19.7.
|
97
|
-
"@nx/nx-win32-arm64-msvc": "19.7.
|
98
|
-
"@nx/nx-freebsd-x64": "19.7.
|
89
|
+
"@nx/nx-darwin-x64": "19.7.3",
|
90
|
+
"@nx/nx-darwin-arm64": "19.7.3",
|
91
|
+
"@nx/nx-linux-x64-gnu": "19.7.3",
|
92
|
+
"@nx/nx-linux-x64-musl": "19.7.3",
|
93
|
+
"@nx/nx-win32-x64-msvc": "19.7.3",
|
94
|
+
"@nx/nx-linux-arm64-gnu": "19.7.3",
|
95
|
+
"@nx/nx-linux-arm64-musl": "19.7.3",
|
96
|
+
"@nx/nx-linux-arm-gnueabihf": "19.7.3",
|
97
|
+
"@nx/nx-win32-arm64-msvc": "19.7.3",
|
98
|
+
"@nx/nx-freebsd-x64": "19.7.3"
|
99
99
|
},
|
100
100
|
"nx-migrations": {
|
101
101
|
"migrations": "./migrations.json",
|
@@ -12,13 +12,13 @@ const fileutils_1 = require("../../utils/fileutils");
|
|
12
12
|
const logger_1 = require("../../utils/logger");
|
13
13
|
const output_1 = require("../../utils/output");
|
14
14
|
const package_manager_1 = require("../../utils/package-manager");
|
15
|
-
const
|
15
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
16
16
|
const plugins_1 = require("../../utils/plugins");
|
17
17
|
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
|
-
return (0,
|
21
|
+
return (0, handle_errors_1.handleErrors)(options.verbose, async () => {
|
22
22
|
output_1.output.addNewline();
|
23
23
|
const [pkgName, version] = parsePackageSpecifier(options.packageSpecifier);
|
24
24
|
const nxJson = (0, nx_json_1.readNxJson)();
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.yargsAffectedE2ECommand = exports.yargsAffectedLintCommand = exports.yargsAffectedBuildCommand = exports.yargsAffectedTestCommand = exports.yargsAffectedCommand = void 0;
|
4
4
|
const documentation_1 = require("../yargs-utils/documentation");
|
5
5
|
const shared_options_1 = require("../yargs-utils/shared-options");
|
6
|
-
const
|
6
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
7
7
|
exports.yargsAffectedCommand = {
|
8
8
|
command: 'affected',
|
9
9
|
describe: 'Run target for affected projects.',
|
@@ -18,7 +18,7 @@ exports.yargsAffectedCommand = {
|
|
18
18
|
}
|
19
19
|
}), 'affected'),
|
20
20
|
handler: async (args) => {
|
21
|
-
const exitCode = await (0,
|
21
|
+
const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
22
22
|
return (await Promise.resolve().then(() => require('./affected'))).affected('affected', (0, shared_options_1.withOverrides)(args));
|
23
23
|
});
|
24
24
|
process.exit(exitCode);
|
@@ -29,7 +29,7 @@ exports.yargsAffectedTestCommand = {
|
|
29
29
|
describe: false,
|
30
30
|
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withAffectedOptions)((0, shared_options_1.withRunOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withConfiguration)(yargs)))), 'affected'),
|
31
31
|
handler: async (args) => {
|
32
|
-
const exitCode = await (0,
|
32
|
+
const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
33
33
|
return (await Promise.resolve().then(() => require('./affected'))).affected('affected', {
|
34
34
|
...(0, shared_options_1.withOverrides)(args),
|
35
35
|
target: 'test',
|
@@ -43,7 +43,7 @@ exports.yargsAffectedBuildCommand = {
|
|
43
43
|
describe: false,
|
44
44
|
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withAffectedOptions)((0, shared_options_1.withRunOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withConfiguration)(yargs)))), 'affected'),
|
45
45
|
handler: async (args) => {
|
46
|
-
const exitCode = await (0,
|
46
|
+
const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
47
47
|
return (await Promise.resolve().then(() => require('./affected'))).affected('affected', {
|
48
48
|
...(0, shared_options_1.withOverrides)(args),
|
49
49
|
target: 'build',
|
@@ -57,7 +57,7 @@ exports.yargsAffectedLintCommand = {
|
|
57
57
|
describe: false,
|
58
58
|
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withAffectedOptions)((0, shared_options_1.withRunOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withConfiguration)(yargs)))), 'affected'),
|
59
59
|
handler: async (args) => {
|
60
|
-
const exitCode = await (0,
|
60
|
+
const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
61
61
|
return (await Promise.resolve().then(() => require('./affected'))).affected('affected', {
|
62
62
|
...(0, shared_options_1.withOverrides)(args),
|
63
63
|
target: 'lint',
|
@@ -71,7 +71,7 @@ exports.yargsAffectedE2ECommand = {
|
|
71
71
|
describe: false,
|
72
72
|
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withAffectedOptions)((0, shared_options_1.withRunOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withConfiguration)(yargs)))), 'affected'),
|
73
73
|
handler: async (args) => {
|
74
|
-
const exitCode = await (0,
|
74
|
+
const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
75
75
|
return (await Promise.resolve().then(() => require('./affected'))).affected('affected', {
|
76
76
|
...(0, shared_options_1.withOverrides)(args),
|
77
77
|
target: 'e2e',
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.yargsPrintAffectedCommand = exports.yargsAffectedGraphCommand = void 0;
|
4
|
-
const
|
4
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
5
5
|
const shared_options_1 = require("../yargs-utils/shared-options");
|
6
6
|
const command_object_1 = require("../graph/command-object");
|
7
7
|
const affectedGraphDeprecationMessage = 'Use `nx graph --affected`, or `nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command has been removed in Nx 19.';
|
@@ -15,7 +15,7 @@ exports.yargsAffectedGraphCommand = {
|
|
15
15
|
aliases: ['affected:dep-graph'],
|
16
16
|
builder: (yargs) => (0, shared_options_1.withAffectedOptions)((0, command_object_1.withGraphOptions)(yargs)),
|
17
17
|
handler: async (args) => {
|
18
|
-
const exitCode = await (0,
|
18
|
+
const exitCode = await (0, handle_errors_1.handleErrors)(false, () => {
|
19
19
|
throw new Error(affectedGraphDeprecationMessage);
|
20
20
|
});
|
21
21
|
process.exit(exitCode);
|
@@ -39,7 +39,7 @@ exports.yargsPrintAffectedCommand = {
|
|
39
39
|
describe: 'Select the type of projects to be returned (e.g., --type=app).',
|
40
40
|
}),
|
41
41
|
handler: async (args) => {
|
42
|
-
const exitCode = await (0,
|
42
|
+
const exitCode = await (0, handle_errors_1.handleErrors)(false, () => {
|
43
43
|
throw new Error(printAffectedDeprecationMessage);
|
44
44
|
});
|
45
45
|
process.exit(exitCode);
|
@@ -12,6 +12,7 @@ const tree_1 = require("../../generators/tree");
|
|
12
12
|
const project_graph_1 = require("../../project-graph/project-graph");
|
13
13
|
const logger_1 = require("../../utils/logger");
|
14
14
|
const params_1 = require("../../utils/params");
|
15
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
15
16
|
const local_plugins_1 = require("../../utils/plugins/local-plugins");
|
16
17
|
const print_help_1 = require("../../utils/print-help");
|
17
18
|
const workspace_root_1 = require("../../utils/workspace-root");
|
@@ -206,7 +207,7 @@ function printGenHelp(opts, schema, normalizedGeneratorName, aliases) {
|
|
206
207
|
});
|
207
208
|
}
|
208
209
|
async function generate(cwd, args) {
|
209
|
-
return (0,
|
210
|
+
return (0, handle_errors_1.handleErrors)(args.verbose, async () => {
|
210
211
|
const nxJsonConfiguration = (0, configuration_1.readNxJson)();
|
211
212
|
const projectGraph = await (0, project_graph_1.createProjectGraphAsync)();
|
212
213
|
const projectsConfigurations = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
|
@@ -3,21 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.yargsImportCommand = void 0;
|
4
4
|
const documentation_1 = require("../yargs-utils/documentation");
|
5
5
|
const shared_options_1 = require("../yargs-utils/shared-options");
|
6
|
-
const
|
6
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
7
7
|
exports.yargsImportCommand = {
|
8
|
-
command: 'import [
|
8
|
+
command: 'import [sourceRepository] [destinationDirectory]',
|
9
9
|
describe: false,
|
10
10
|
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withVerbose)(yargs
|
11
|
-
.positional('
|
11
|
+
.positional('sourceRepository', {
|
12
12
|
type: 'string',
|
13
13
|
description: 'The remote URL of the source to import.',
|
14
14
|
})
|
15
|
-
.positional('
|
15
|
+
.positional('destinationDirectory', {
|
16
16
|
type: 'string',
|
17
|
+
alias: 'destination',
|
17
18
|
description: 'The directory in the current workspace to import into.',
|
18
19
|
})
|
19
|
-
.option('
|
20
|
+
.option('sourceDirectory', {
|
20
21
|
type: 'string',
|
22
|
+
alias: 'source',
|
21
23
|
description: 'The directory in the source repository to import from.',
|
22
24
|
})
|
23
25
|
.option('ref', {
|
@@ -34,7 +36,7 @@ exports.yargsImportCommand = {
|
|
34
36
|
default: true,
|
35
37
|
})), 'import'),
|
36
38
|
handler: async (args) => {
|
37
|
-
const exitCode = await (0,
|
39
|
+
const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose, async () => {
|
38
40
|
return (await Promise.resolve().then(() => require('./import'))).importHandler(args);
|
39
41
|
});
|
40
42
|
process.exit(exitCode);
|
@@ -25,41 +25,40 @@ const needs_install_1 = require("./utils/needs-install");
|
|
25
25
|
const file_utils_1 = require("../../project-graph/file-utils");
|
26
26
|
const importRemoteName = '__tmp_nx_import__';
|
27
27
|
async function importHandler(options) {
|
28
|
-
let {
|
28
|
+
let { sourceRepository, ref, source, destination } = options;
|
29
29
|
output_1.output.log({
|
30
|
-
title: 'Nx will walk you through the process of importing code from
|
30
|
+
title: 'Nx will walk you through the process of importing code from the source repository into this repository:',
|
31
31
|
bodyLines: [
|
32
|
-
`1. Nx will clone the
|
33
|
-
`2.
|
34
|
-
`3. The
|
35
|
-
`4. Nx will recommend plugins to integrate tools used in the imported code
|
36
|
-
`5. The code will be successfully imported into this workspace`,
|
32
|
+
`1. Nx will clone the source repository into a temporary directory`,
|
33
|
+
`2. The project code from the sourceDirectory will be moved to the destinationDirectory on a temporary branch in this repository`,
|
34
|
+
`3. The temporary branch will be merged into the current branch in this repository`,
|
35
|
+
`4. Nx will recommend plugins to integrate any new tools used in the imported code`,
|
37
36
|
'',
|
38
|
-
`Git history will be preserved during this process`,
|
37
|
+
`Git history will be preserved during this process as long as you MERGE these changes. Do NOT squash and do NOT rebase the changes when merging branches. If you would like to UNDO these changes, run "git reset HEAD~1 --hard"`,
|
39
38
|
],
|
40
39
|
});
|
41
40
|
const tempImportDirectory = (0, path_1.join)(tmp_1.tmpdir, 'nx-import');
|
42
|
-
if (!
|
43
|
-
|
41
|
+
if (!sourceRepository) {
|
42
|
+
sourceRepository = (await (0, enquirer_1.prompt)([
|
44
43
|
{
|
45
44
|
type: 'input',
|
46
|
-
name: '
|
45
|
+
name: 'sourceRepository',
|
47
46
|
message: 'What is the URL of the repository you want to import? (This can be a local git repository or a git remote URL)',
|
48
47
|
required: true,
|
49
48
|
},
|
50
|
-
])).
|
49
|
+
])).sourceRepository;
|
51
50
|
}
|
52
51
|
try {
|
53
|
-
const maybeLocalDirectory = await (0, promises_1.stat)(
|
52
|
+
const maybeLocalDirectory = await (0, promises_1.stat)(sourceRepository);
|
54
53
|
if (maybeLocalDirectory.isDirectory()) {
|
55
|
-
|
54
|
+
sourceRepository = (0, path_1.resolve)(sourceRepository);
|
56
55
|
}
|
57
56
|
}
|
58
57
|
catch (e) {
|
59
58
|
// It's a remote url
|
60
59
|
}
|
61
|
-
const
|
62
|
-
const spinner = createSpinner(`Cloning ${
|
60
|
+
const sourceTempRepoPath = (0, path_1.join)(tempImportDirectory, 'repo');
|
61
|
+
const spinner = createSpinner(`Cloning ${sourceRepository} into a temporary directory: ${sourceTempRepoPath} (Use --depth to limit commit history and speed up clone times)`).start();
|
63
62
|
try {
|
64
63
|
await (0, promises_1.rm)(tempImportDirectory, { recursive: true });
|
65
64
|
}
|
@@ -67,17 +66,17 @@ async function importHandler(options) {
|
|
67
66
|
await (0, promises_1.mkdir)(tempImportDirectory, { recursive: true });
|
68
67
|
let sourceGitClient;
|
69
68
|
try {
|
70
|
-
sourceGitClient = await (0, git_utils_1.cloneFromUpstream)(
|
69
|
+
sourceGitClient = await (0, git_utils_1.cloneFromUpstream)(sourceRepository, sourceTempRepoPath, {
|
71
70
|
originName: importRemoteName,
|
72
71
|
depth: options.depth,
|
73
72
|
});
|
74
73
|
}
|
75
74
|
catch (e) {
|
76
|
-
spinner.fail(`Failed to clone ${
|
77
|
-
let errorMessage = `Failed to clone ${
|
75
|
+
spinner.fail(`Failed to clone ${sourceRepository} into ${sourceTempRepoPath}`);
|
76
|
+
let errorMessage = `Failed to clone ${sourceRepository} into ${sourceTempRepoPath}. Please double check the remote and try again.\n${e.message}`;
|
78
77
|
throw new Error(errorMessage);
|
79
78
|
}
|
80
|
-
spinner.succeed(`Cloned into ${
|
79
|
+
spinner.succeed(`Cloned into ${sourceTempRepoPath}`);
|
81
80
|
// Detecting the package manager before preparing the source repo for import.
|
82
81
|
const sourcePackageManager = (0, package_manager_1.detectPackageManager)(sourceGitClient.root);
|
83
82
|
if (!ref) {
|
@@ -116,14 +115,17 @@ async function importHandler(options) {
|
|
116
115
|
},
|
117
116
|
])).destination;
|
118
117
|
}
|
119
|
-
const absSource = (0, path_1.join)(
|
118
|
+
const absSource = (0, path_1.join)(sourceTempRepoPath, source);
|
119
|
+
if ((0, path_1.isAbsolute)(destination)) {
|
120
|
+
throw new Error(`The destination directory must be a relative path in this repository.`);
|
121
|
+
}
|
120
122
|
const absDestination = (0, path_1.join)(process.cwd(), destination);
|
121
123
|
const destinationGitClient = new git_utils_1.GitRepository(process.cwd());
|
122
124
|
await assertDestinationEmpty(destinationGitClient, absDestination);
|
123
125
|
const tempImportBranch = getTempImportBranch(ref);
|
124
126
|
await sourceGitClient.addFetchRemote(importRemoteName, ref);
|
125
127
|
await sourceGitClient.fetch(importRemoteName, ref);
|
126
|
-
spinner.succeed(`Fetched ${ref} from ${
|
128
|
+
spinner.succeed(`Fetched ${ref} from ${sourceRepository}`);
|
127
129
|
spinner.start(`Checking out a temporary branch, ${tempImportBranch} based on ${ref}`);
|
128
130
|
await sourceGitClient.checkout(tempImportBranch, {
|
129
131
|
new: true,
|
@@ -134,14 +136,15 @@ async function importHandler(options) {
|
|
134
136
|
await (0, promises_1.stat)(absSource);
|
135
137
|
}
|
136
138
|
catch (e) {
|
137
|
-
throw new Error(`The source directory ${source} does not exist in ${
|
139
|
+
throw new Error(`The source directory ${source} does not exist in ${sourceRepository}. Please double check to make sure it exists.`);
|
138
140
|
}
|
139
141
|
const packageManager = (0, package_manager_1.detectPackageManager)(workspace_root_1.workspaceRoot);
|
140
142
|
const originalPackageWorkspaces = await (0, needs_install_1.getPackagesInPackageManagerWorkspace)(packageManager);
|
143
|
+
const sourceIsNxWorkspace = (0, node_fs_1.existsSync)((0, path_1.join)(sourceGitClient.root, 'nx.json'));
|
141
144
|
const relativeDestination = (0, path_1.relative)(destinationGitClient.root, absDestination);
|
142
|
-
await (0, prepare_source_repo_1.prepareSourceRepo)(sourceGitClient, ref, source, relativeDestination, tempImportBranch,
|
143
|
-
await createTemporaryRemote(destinationGitClient, (0, path_1.join)(
|
144
|
-
await (0, merge_remote_source_1.mergeRemoteSource)(destinationGitClient,
|
145
|
+
await (0, prepare_source_repo_1.prepareSourceRepo)(sourceGitClient, ref, source, relativeDestination, tempImportBranch, sourceRepository);
|
146
|
+
await createTemporaryRemote(destinationGitClient, (0, path_1.join)(sourceTempRepoPath, '.git'), importRemoteName);
|
147
|
+
await (0, merge_remote_source_1.mergeRemoteSource)(destinationGitClient, sourceRepository, tempImportBranch, destination, importRemoteName, ref);
|
145
148
|
spinner.start('Cleaning up temporary files and remotes');
|
146
149
|
await (0, promises_1.rm)(tempImportDirectory, { recursive: true });
|
147
150
|
await destinationGitClient.deleteGitRemote(importRemoteName);
|
@@ -202,13 +205,25 @@ async function importHandler(options) {
|
|
202
205
|
});
|
203
206
|
}
|
204
207
|
await warnOnMissingWorkspacesEntry(packageManager, pmc, relativeDestination);
|
208
|
+
if (source != destination) {
|
209
|
+
output_1.output.warn({
|
210
|
+
title: `Check configuration files`,
|
211
|
+
bodyLines: [
|
212
|
+
`The source directory (${source}) and destination directory (${destination}) are different.`,
|
213
|
+
`You may need to update configuration files to match the directory in this repository.`,
|
214
|
+
sourceIsNxWorkspace
|
215
|
+
? `For example, path options in project.json such as "main", "tsConfig", and "outputPath" need to be updated.`
|
216
|
+
: `For example, relative paths in tsconfig.json and other tooling configuration files may need to be updated.`,
|
217
|
+
],
|
218
|
+
});
|
219
|
+
}
|
205
220
|
// When only a subdirectory is imported, there might be devDependencies in the root package.json file
|
206
221
|
// that needs to be ported over as well.
|
207
222
|
if (ref) {
|
208
223
|
output_1.output.log({
|
209
224
|
title: `Check root dependencies`,
|
210
225
|
bodyLines: [
|
211
|
-
`"dependencies" and "devDependencies" are not imported from the source repository (${
|
226
|
+
`"dependencies" and "devDependencies" are not imported from the source repository (${sourceRepository}).`,
|
212
227
|
`You may need to add some of those dependencies to this workspace in order to run tasks successfully.`,
|
213
228
|
],
|
214
229
|
});
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loginHandler = loginHandler;
|
4
4
|
const update_manager_1 = require("../../nx-cloud/update-manager");
|
5
5
|
const get_cloud_options_1 = require("../../nx-cloud/utilities/get-cloud-options");
|
6
|
-
const
|
6
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
7
7
|
function loginHandler(args) {
|
8
8
|
if (args.nxCloudUrl) {
|
9
9
|
process.env.NX_CLOUD_API = args.nxCloudUrl;
|
10
10
|
}
|
11
|
-
return (0,
|
11
|
+
return (0, handle_errors_1.handleErrors)(args.verbose, async () => {
|
12
12
|
const nxCloudClient = (await (0, update_manager_1.verifyOrUpdateNxCloudClient)((0, get_cloud_options_1.getCloudOptions)()))
|
13
13
|
.nxCloudClient;
|
14
14
|
await nxCloudClient.commands.login();
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.logoutHandler = logoutHandler;
|
4
4
|
const update_manager_1 = require("../../nx-cloud/update-manager");
|
5
5
|
const get_cloud_options_1 = require("../../nx-cloud/utilities/get-cloud-options");
|
6
|
-
const
|
6
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
7
7
|
function logoutHandler(args) {
|
8
|
-
return (0,
|
8
|
+
return (0, handle_errors_1.handleErrors)(args.verbose, async () => {
|
9
9
|
const nxCloudClient = (await (0, update_manager_1.verifyOrUpdateNxCloudClient)((0, get_cloud_options_1.getCloudOptions)()))
|
10
10
|
.nxCloudClient;
|
11
11
|
await nxCloudClient.commands.logout();
|
@@ -18,7 +18,7 @@ const logger_1 = require("../../utils/logger");
|
|
18
18
|
const git_utils_1 = require("../../utils/git-utils");
|
19
19
|
const package_json_1 = require("../../utils/package-json");
|
20
20
|
const package_manager_1 = require("../../utils/package-manager");
|
21
|
-
const
|
21
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
22
22
|
const connect_to_nx_cloud_1 = require("../connect/connect-to-nx-cloud");
|
23
23
|
const output_1 = require("../../utils/output");
|
24
24
|
const fs_1 = require("fs");
|
@@ -1041,7 +1041,7 @@ async function runNxMigration(root, collectionPath, collection, name) {
|
|
1041
1041
|
}
|
1042
1042
|
async function migrate(root, args, rawArgs) {
|
1043
1043
|
await client_1.daemonClient.stop();
|
1044
|
-
return (0,
|
1044
|
+
return (0, handle_errors_1.handleErrors)(process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
1045
1045
|
const opts = await parseMigrationsOptions(args);
|
1046
1046
|
if (opts.type === 'generateMigrations') {
|
1047
1047
|
await generateMigrationsJsonAndUpdatePackageJson(root, opts);
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.newWorkspace = newWorkspace;
|
4
4
|
const tree_1 = require("../../generators/tree");
|
5
5
|
const params_1 = require("../../utils/params");
|
6
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
6
7
|
const generator_utils_1 = require("../generate/generator-utils");
|
7
8
|
function removeSpecialFlags(generatorOptions) {
|
8
9
|
delete generatorOptions.interactive;
|
@@ -12,7 +13,7 @@ function removeSpecialFlags(generatorOptions) {
|
|
12
13
|
delete generatorOptions['$0'];
|
13
14
|
}
|
14
15
|
async function newWorkspace(cwd, args) {
|
15
|
-
return (0,
|
16
|
+
return (0, handle_errors_1.handleErrors)(process.env.NX_VERBOSE_LOGGING === 'true' || args.verbose, async () => {
|
16
17
|
const isInteractive = args.interactive;
|
17
18
|
const { normalizedGeneratorName, schema, implementationFactory } = (0, generator_utils_1.getGeneratorInformation)('@nx/workspace/generators.json', 'new', null, {});
|
18
19
|
removeSpecialFlags(args);
|
@@ -16,7 +16,7 @@ const project_graph_1 = require("../../project-graph/project-graph");
|
|
16
16
|
const utils_1 = require("../../tasks-runner/utils");
|
17
17
|
const is_ci_1 = require("../../utils/is-ci");
|
18
18
|
const output_1 = require("../../utils/output");
|
19
|
-
const
|
19
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
20
20
|
const path_1 = require("../../utils/path");
|
21
21
|
const workspace_root_1 = require("../../utils/workspace-root");
|
22
22
|
const config_1 = require("./config/config");
|
@@ -32,7 +32,7 @@ const print_config_1 = require("./utils/print-config");
|
|
32
32
|
const resolve_changelog_renderer_1 = require("./utils/resolve-changelog-renderer");
|
33
33
|
const resolve_nx_json_error_message_1 = require("./utils/resolve-nx-json-error-message");
|
34
34
|
const shared_1 = require("./utils/shared");
|
35
|
-
const releaseChangelogCLIHandler = (args) => (0,
|
35
|
+
const releaseChangelogCLIHandler = (args) => (0, handle_errors_1.handleErrors)(args.verbose, () => createAPI({})(args));
|
36
36
|
exports.releaseChangelogCLIHandler = releaseChangelogCLIHandler;
|
37
37
|
function createAPI(overrideReleaseConfig) {
|
38
38
|
/**
|
@@ -8,14 +8,14 @@ const project_graph_1 = require("../../project-graph/project-graph");
|
|
8
8
|
const all_file_data_1 = require("../../utils/all-file-data");
|
9
9
|
const command_line_utils_1 = require("../../utils/command-line-utils");
|
10
10
|
const output_1 = require("../../utils/output");
|
11
|
-
const
|
11
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
12
12
|
const config_1 = require("./config/config");
|
13
13
|
const deep_merge_json_1 = require("./config/deep-merge-json");
|
14
14
|
const filter_release_groups_1 = require("./config/filter-release-groups");
|
15
15
|
const version_plans_1 = require("./config/version-plans");
|
16
16
|
const get_touched_projects_for_group_1 = require("./utils/get-touched-projects-for-group");
|
17
17
|
const print_config_1 = require("./utils/print-config");
|
18
|
-
const releasePlanCheckCLIHandler = (args) => (0,
|
18
|
+
const releasePlanCheckCLIHandler = (args) => (0, handle_errors_1.handleErrors)(args.verbose, () => createAPI({})(args));
|
19
19
|
exports.releasePlanCheckCLIHandler = releasePlanCheckCLIHandler;
|
20
20
|
function createAPI(overrideReleaseConfig) {
|
21
21
|
return async function releasePlanCheck(args) {
|
@@ -13,7 +13,7 @@ const project_graph_1 = require("../../project-graph/project-graph");
|
|
13
13
|
const all_file_data_1 = require("../../utils/all-file-data");
|
14
14
|
const command_line_utils_1 = require("../../utils/command-line-utils");
|
15
15
|
const output_1 = require("../../utils/output");
|
16
|
-
const
|
16
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
17
17
|
const config_1 = require("./config/config");
|
18
18
|
const deep_merge_json_1 = require("./config/deep-merge-json");
|
19
19
|
const filter_release_groups_1 = require("./config/filter-release-groups");
|
@@ -23,7 +23,7 @@ const get_touched_projects_for_group_1 = require("./utils/get-touched-projects-f
|
|
23
23
|
const launch_editor_1 = require("./utils/launch-editor");
|
24
24
|
const print_changes_1 = require("./utils/print-changes");
|
25
25
|
const print_config_1 = require("./utils/print-config");
|
26
|
-
const releasePlanCLIHandler = (args) => (0,
|
26
|
+
const releasePlanCLIHandler = (args) => (0, handle_errors_1.handleErrors)(args.verbose, () => createAPI({})(args));
|
27
27
|
exports.releasePlanCLIHandler = releasePlanCLIHandler;
|
28
28
|
function createAPI(overrideReleaseConfig) {
|
29
29
|
return async function releasePlan(args) {
|
@@ -8,14 +8,14 @@ const project_graph_1 = require("../../project-graph/project-graph");
|
|
8
8
|
const run_command_1 = require("../../tasks-runner/run-command");
|
9
9
|
const command_line_utils_1 = require("../../utils/command-line-utils");
|
10
10
|
const output_1 = require("../../utils/output");
|
11
|
-
const
|
11
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
12
12
|
const project_graph_utils_1 = require("../../utils/project-graph-utils");
|
13
13
|
const graph_1 = require("../graph/graph");
|
14
14
|
const config_1 = require("./config/config");
|
15
15
|
const deep_merge_json_1 = require("./config/deep-merge-json");
|
16
16
|
const filter_release_groups_1 = require("./config/filter-release-groups");
|
17
17
|
const print_config_1 = require("./utils/print-config");
|
18
|
-
const releasePublishCLIHandler = (args) => (0,
|
18
|
+
const releasePublishCLIHandler = (args) => (0, handle_errors_1.handleErrors)(args.verbose, () => createAPI({})(args, true));
|
19
19
|
exports.releasePublishCLIHandler = releasePublishCLIHandler;
|
20
20
|
function createAPI(overrideReleaseConfig) {
|
21
21
|
/**
|
@@ -8,7 +8,7 @@ const nx_json_1 = require("../../config/nx-json");
|
|
8
8
|
const file_map_utils_1 = require("../../project-graph/file-map-utils");
|
9
9
|
const project_graph_1 = require("../../project-graph/project-graph");
|
10
10
|
const output_1 = require("../../utils/output");
|
11
|
-
const
|
11
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
12
12
|
const changelog_1 = require("./changelog");
|
13
13
|
const config_1 = require("./config/config");
|
14
14
|
const deep_merge_json_1 = require("./config/deep-merge-json");
|
@@ -21,7 +21,7 @@ const print_config_1 = require("./utils/print-config");
|
|
21
21
|
const resolve_nx_json_error_message_1 = require("./utils/resolve-nx-json-error-message");
|
22
22
|
const shared_1 = require("./utils/shared");
|
23
23
|
const version_1 = require("./version");
|
24
|
-
const releaseCLIHandler = (args) => (0,
|
24
|
+
const releaseCLIHandler = (args) => (0, handle_errors_1.handleErrors)(args.verbose, () => createAPI({})(args));
|
25
25
|
exports.releaseCLIHandler = releaseCLIHandler;
|
26
26
|
function createAPI(overrideReleaseConfig) {
|
27
27
|
const releaseVersion = (0, version_1.createAPI)(overrideReleaseConfig);
|
@@ -26,12 +26,13 @@ const print_changes_1 = require("./utils/print-changes");
|
|
26
26
|
const print_config_1 = require("./utils/print-config");
|
27
27
|
const resolve_nx_json_error_message_1 = require("./utils/resolve-nx-json-error-message");
|
28
28
|
const shared_1 = require("./utils/shared");
|
29
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
29
30
|
const LARGE_BUFFER = 1024 * 1000000;
|
30
31
|
// Reexport some utils for use in plugin release-version generator implementations
|
31
32
|
var semver_1 = require("./utils/semver");
|
32
33
|
Object.defineProperty(exports, "deriveNewSemverVersion", { enumerable: true, get: function () { return semver_1.deriveNewSemverVersion; } });
|
33
34
|
exports.validReleaseVersionPrefixes = ['auto', '', '~', '^', '='];
|
34
|
-
const releaseVersionCLIHandler = (args) => (0,
|
35
|
+
const releaseVersionCLIHandler = (args) => (0, handle_errors_1.handleErrors)(args.verbose, () => createAPI({})(args));
|
35
36
|
exports.releaseVersionCLIHandler = releaseVersionCLIHandler;
|
36
37
|
function createAPI(overrideReleaseConfig) {
|
37
38
|
/**
|
@@ -1,12 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.repair = repair;
|
4
|
-
const
|
4
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
5
5
|
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
|
-
return (0,
|
9
|
+
return (0, handle_errors_1.handleErrors)(args.verbose, async () => {
|
10
10
|
const nxMigrations = Object.entries(migrationsJson.generators).reduce((agg, [name, migration]) => {
|
11
11
|
const skip = migration['x-repair-skip'];
|
12
12
|
if (!skip) {
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.yargsNxInfixCommand = exports.yargsRunCommand = void 0;
|
4
4
|
const yargs_1 = require("yargs");
|
5
5
|
const shared_options_1 = require("../yargs-utils/shared-options");
|
6
|
-
const
|
6
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
7
7
|
exports.yargsRunCommand = {
|
8
8
|
command: 'run [project][:target][:configuration] [_..]',
|
9
9
|
describe: `Run a target for a project
|
@@ -15,7 +15,7 @@ exports.yargsRunCommand = {
|
|
15
15
|
You can skip the use of Nx cache by using the --skip-nx-cache option.`,
|
16
16
|
builder: (yargs) => (0, shared_options_1.withRunOneOptions)((0, shared_options_1.withBatch)(yargs)),
|
17
17
|
handler: async (args) => {
|
18
|
-
const exitCode = await (0,
|
18
|
+
const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
19
19
|
await Promise.resolve().then(() => require('./run-one')).then((m) => m.runOne(process.cwd(), (0, shared_options_1.withOverrides)(args)));
|
20
20
|
});
|
21
21
|
process.exit(exitCode);
|
@@ -29,7 +29,7 @@ exports.yargsNxInfixCommand = {
|
|
29
29
|
command: '$0 <target> [project] [_..]',
|
30
30
|
describe: 'Run a target for a project.',
|
31
31
|
handler: async (args) => {
|
32
|
-
const exitCode = await (0,
|
32
|
+
const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
33
33
|
// Yargs parses <target> as 'undefined' if running just 'nx'
|
34
34
|
if (!args.target || args.target === 'undefined') {
|
35
35
|
(0, yargs_1.showHelp)();
|
@@ -7,6 +7,7 @@ exports.printTargetRunHelp = printTargetRunHelp;
|
|
7
7
|
exports.run = run;
|
8
8
|
const npm_run_path_1 = require("npm-run-path");
|
9
9
|
const params_1 = require("../../utils/params");
|
10
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
10
11
|
const print_help_1 = require("../../utils/print-help");
|
11
12
|
const path_1 = require("path");
|
12
13
|
const serialize_overrides_into_command_line_1 = require("../../utils/serialize-overrides-into-command-line");
|
@@ -163,14 +164,14 @@ async function runExecutor(targetDescription, overrides, context) {
|
|
163
164
|
}
|
164
165
|
function printTargetRunHelp(targetDescription, root) {
|
165
166
|
const projectGraph = (0, project_graph_1.readCachedProjectGraph)();
|
166
|
-
return (0,
|
167
|
+
return (0, handle_errors_1.handleErrors)(false, async () => {
|
167
168
|
const projectsConfigurations = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
|
168
169
|
await printTargetRunHelpInternal(targetDescription, root, projectsConfigurations);
|
169
170
|
});
|
170
171
|
}
|
171
172
|
function run(cwd, root, targetDescription, overrides, isVerbose, taskGraph) {
|
172
173
|
const projectGraph = (0, project_graph_1.readCachedProjectGraph)();
|
173
|
-
return (0,
|
174
|
+
return (0, handle_errors_1.handleErrors)(isVerbose, async () => {
|
174
175
|
const projectsConfigurations = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
|
175
176
|
return iteratorToProcessStatusCode(await runExecutorInternal(targetDescription, overrides, root, cwd, projectsConfigurations, (0, configuration_1.readNxJson)(), projectGraph, taskGraph, isVerbose));
|
176
177
|
});
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.yargsRunManyCommand = void 0;
|
4
4
|
const documentation_1 = require("../yargs-utils/documentation");
|
5
5
|
const shared_options_1 = require("../yargs-utils/shared-options");
|
6
|
-
const
|
6
|
+
const handle_errors_1 = require("../../utils/handle-errors");
|
7
7
|
exports.yargsRunManyCommand = {
|
8
8
|
command: 'run-many',
|
9
9
|
describe: 'Run target for multiple listed projects.',
|
10
10
|
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)((0, shared_options_1.withRunManyOptions)((0, shared_options_1.withOutputStyleOption)((0, shared_options_1.withTargetAndConfigurationOption)((0, shared_options_1.withBatch)(yargs)))), 'run-many'),
|
11
11
|
handler: async (args) => {
|
12
|
-
const exitCode = await (0,
|
12
|
+
const exitCode = await (0, handle_errors_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
|
13
13
|
await Promise.resolve().then(() => require('./run-many')).then((m) => m.runMany((0, shared_options_1.withOverrides)(args)));
|
14
14
|
});
|
15
15
|
process.exit(exitCode);
|