nx 19.2.0-rc.0 → 19.2.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +12 -12
- package/src/command-line/connect/connect-to-nx-cloud.js +27 -8
- package/src/command-line/migrate/migrate.js +2 -26
- package/src/core/graph/main.js +1 -1
- package/src/native/native-file-cache-location.js +8 -6
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +1 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +31 -14
- package/src/nx-cloud/generators/connect-to-nx-cloud/schema.json +5 -0
- package/src/nx-cloud/utilities/url-shorten.d.ts +1 -0
- package/src/nx-cloud/utilities/url-shorten.js +77 -0
- package/src/utils/git-utils.d.ts +4 -0
- package/src/utils/git-utils.js +67 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "19.2.0-rc.
|
3
|
+
"version": "19.2.0-rc.1",
|
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": {
|
@@ -70,7 +70,7 @@
|
|
70
70
|
"yargs-parser": "21.1.1",
|
71
71
|
"node-machine-id": "1.1.12",
|
72
72
|
"ora": "5.3.0",
|
73
|
-
"@nrwl/tao": "19.2.0-rc.
|
73
|
+
"@nrwl/tao": "19.2.0-rc.1"
|
74
74
|
},
|
75
75
|
"peerDependencies": {
|
76
76
|
"@swc-node/register": "^1.8.0",
|
@@ -85,16 +85,16 @@
|
|
85
85
|
}
|
86
86
|
},
|
87
87
|
"optionalDependencies": {
|
88
|
-
"@nx/nx-darwin-x64": "19.2.0-rc.
|
89
|
-
"@nx/nx-darwin-arm64": "19.2.0-rc.
|
90
|
-
"@nx/nx-linux-x64-gnu": "19.2.0-rc.
|
91
|
-
"@nx/nx-linux-x64-musl": "19.2.0-rc.
|
92
|
-
"@nx/nx-win32-x64-msvc": "19.2.0-rc.
|
93
|
-
"@nx/nx-linux-arm64-gnu": "19.2.0-rc.
|
94
|
-
"@nx/nx-linux-arm64-musl": "19.2.0-rc.
|
95
|
-
"@nx/nx-linux-arm-gnueabihf": "19.2.0-rc.
|
96
|
-
"@nx/nx-win32-arm64-msvc": "19.2.0-rc.
|
97
|
-
"@nx/nx-freebsd-x64": "19.2.0-rc.
|
88
|
+
"@nx/nx-darwin-x64": "19.2.0-rc.1",
|
89
|
+
"@nx/nx-darwin-arm64": "19.2.0-rc.1",
|
90
|
+
"@nx/nx-linux-x64-gnu": "19.2.0-rc.1",
|
91
|
+
"@nx/nx-linux-x64-musl": "19.2.0-rc.1",
|
92
|
+
"@nx/nx-win32-x64-msvc": "19.2.0-rc.1",
|
93
|
+
"@nx/nx-linux-arm64-gnu": "19.2.0-rc.1",
|
94
|
+
"@nx/nx-linux-arm64-musl": "19.2.0-rc.1",
|
95
|
+
"@nx/nx-linux-arm-gnueabihf": "19.2.0-rc.1",
|
96
|
+
"@nx/nx-win32-arm64-msvc": "19.2.0-rc.1",
|
97
|
+
"@nx/nx-freebsd-x64": "19.2.0-rc.1"
|
98
98
|
},
|
99
99
|
"nx-migrations": {
|
100
100
|
"migrations": "./migrations.json",
|
@@ -5,6 +5,7 @@ const output_1 = require("../../utils/output");
|
|
5
5
|
const configuration_1 = require("../../config/configuration");
|
6
6
|
const tree_1 = require("../../generators/tree");
|
7
7
|
const connect_to_nx_cloud_1 = require("../../nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud");
|
8
|
+
const url_shorten_1 = require("../../nx-cloud/utilities/url-shorten");
|
8
9
|
const nx_cloud_utils_1 = require("../../utils/nx-cloud-utils");
|
9
10
|
const child_process_1 = require("../../utils/child-process");
|
10
11
|
const ab_testing_1 = require("../../utils/ab-testing");
|
@@ -43,20 +44,38 @@ exports.connectToNxCloudIfExplicitlyAsked = connectToNxCloudIfExplicitlyAsked;
|
|
43
44
|
async function connectToNxCloudCommand() {
|
44
45
|
const nxJson = (0, configuration_1.readNxJson)();
|
45
46
|
if ((0, nx_cloud_utils_1.isNxCloudUsed)(nxJson)) {
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
if (process.env.NX_NEW_CLOUD_ONBOARDING !== 'true') {
|
48
|
+
output_1.output.log({
|
49
|
+
title: '✔ This workspace already has Nx Cloud set up',
|
50
|
+
bodyLines: [
|
51
|
+
'If you have not done so already, connect your workspace to your Nx Cloud account:',
|
52
|
+
`- Login at ${(0, nx_cloud_utils_1.getNxCloudUrl)(nxJson)} to connect your repository`,
|
53
|
+
],
|
54
|
+
});
|
55
|
+
}
|
56
|
+
else {
|
57
|
+
const token = process.env.NX_CLOUD_ACCESS_TOKEN || nxJson.nxCloudAccessToken;
|
58
|
+
if (!token) {
|
59
|
+
throw new Error(`Unable to authenticate. Either define accessToken in nx.json or set the NX_CLOUD_ACCESS_TOKEN env variable.`);
|
60
|
+
}
|
61
|
+
const connectCloudUrl = await (0, url_shorten_1.shortenedCloudUrl)('nx-connect', token);
|
62
|
+
output_1.output.log({
|
63
|
+
title: '✔ This workspace already has Nx Cloud set up',
|
64
|
+
bodyLines: [
|
65
|
+
'If you have not done so already, connect your workspace to your Nx Cloud account:',
|
66
|
+
`- Connect with Nx Cloud at:
|
67
|
+
|
68
|
+
${connectCloudUrl}`,
|
69
|
+
],
|
70
|
+
});
|
71
|
+
}
|
53
72
|
return false;
|
54
73
|
}
|
55
74
|
const tree = new tree_1.FsTree(workspace_root_1.workspaceRoot, false, 'connect-to-nx-cloud');
|
56
75
|
const callback = await (0, connect_to_nx_cloud_1.connectToNxCloud)(tree, {});
|
57
76
|
tree.lock();
|
58
77
|
(0, tree_1.flushChanges)(workspace_root_1.workspaceRoot, tree.listChanges());
|
59
|
-
callback();
|
78
|
+
await callback();
|
60
79
|
return true;
|
61
80
|
}
|
62
81
|
exports.connectToNxCloudCommand = connectToNxCloudCommand;
|
@@ -11,6 +11,7 @@ const util_1 = require("util");
|
|
11
11
|
const tree_1 = require("../../generators/tree");
|
12
12
|
const fileutils_1 = require("../../utils/fileutils");
|
13
13
|
const logger_1 = require("../../utils/logger");
|
14
|
+
const git_utils_1 = require("../../utils/git-utils");
|
14
15
|
const package_json_1 = require("../../utils/package-json");
|
15
16
|
const package_manager_1 = require("../../utils/package-manager");
|
16
17
|
const params_1 = require("../../utils/params");
|
@@ -925,7 +926,7 @@ async function executeMigrations(root, migrations, isVerbose, shouldCreateCommit
|
|
925
926
|
installDepsIfChanged();
|
926
927
|
const commitMessage = `${commitPrefix}${m.name}`;
|
927
928
|
try {
|
928
|
-
const committedSha = commitChanges(commitMessage);
|
929
|
+
const committedSha = (0, git_utils_1.commitChanges)(commitMessage);
|
929
930
|
if (committedSha) {
|
930
931
|
logger_1.logger.info(chalk.dim(`- Commit created for changes: ${committedSha}`));
|
931
932
|
}
|
@@ -1007,31 +1008,6 @@ function getStringifiedPackageJsonDeps(root) {
|
|
1007
1008
|
return '';
|
1008
1009
|
}
|
1009
1010
|
}
|
1010
|
-
function commitChanges(commitMessage) {
|
1011
|
-
try {
|
1012
|
-
(0, child_process_1.execSync)('git add -A', { encoding: 'utf8', stdio: 'pipe' });
|
1013
|
-
(0, child_process_1.execSync)('git commit --no-verify -F -', {
|
1014
|
-
encoding: 'utf8',
|
1015
|
-
stdio: 'pipe',
|
1016
|
-
input: commitMessage,
|
1017
|
-
});
|
1018
|
-
}
|
1019
|
-
catch (err) {
|
1020
|
-
throw new Error(`Error committing changes:\n${err.stderr}`);
|
1021
|
-
}
|
1022
|
-
return getLatestCommitSha();
|
1023
|
-
}
|
1024
|
-
function getLatestCommitSha() {
|
1025
|
-
try {
|
1026
|
-
return (0, child_process_1.execSync)('git rev-parse HEAD', {
|
1027
|
-
encoding: 'utf8',
|
1028
|
-
stdio: 'pipe',
|
1029
|
-
}).trim();
|
1030
|
-
}
|
1031
|
-
catch {
|
1032
|
-
return null;
|
1033
|
-
}
|
1034
|
-
}
|
1035
1011
|
async function runNxMigration(root, collectionPath, collection, name) {
|
1036
1012
|
const { path: implPath, fnSymbol } = getImplementationPath(collection, collectionPath, name);
|
1037
1013
|
const fn = require(implPath)[fnSymbol];
|