nx 21.3.6 → 21.3.7
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/bin/nx.js +6 -6
- package/package.json +11 -11
- package/src/command-line/nx-cloud/connect/command-object.js +2 -1
- package/src/command-line/nx-cloud/connect/connect-to-nx-cloud.d.ts +1 -0
- package/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +14 -2
- package/src/utils/git-utils.d.ts +1 -0
- package/src/utils/git-utils.js +11 -4
package/bin/nx.js
CHANGED
@@ -68,7 +68,12 @@ async function main() {
|
|
68
68
|
handleMissingLocalInstallation(workspace ? workspace.dir : null);
|
69
69
|
}
|
70
70
|
// this file is already in the local workspace
|
71
|
-
if (
|
71
|
+
if (isNxCloudCommand(process.argv[2])) {
|
72
|
+
// nx-cloud commands can run without local Nx installation
|
73
|
+
process.env.NX_DAEMON = 'false';
|
74
|
+
require('nx/src/command-line/nx-commands').commandsObject.argv;
|
75
|
+
}
|
76
|
+
else if (isLocalInstall) {
|
72
77
|
await (0, init_local_1.initLocal)(workspace);
|
73
78
|
}
|
74
79
|
else if (localNx) {
|
@@ -82,11 +87,6 @@ async function main() {
|
|
82
87
|
require(localNx);
|
83
88
|
}
|
84
89
|
}
|
85
|
-
else if (isNxCloudCommand(process.argv[2])) {
|
86
|
-
// nx-cloud commands can run without local Nx installation
|
87
|
-
process.env.NX_DAEMON = 'false';
|
88
|
-
require('nx/src/command-line/nx-commands').commandsObject.argv;
|
89
|
-
}
|
90
90
|
}
|
91
91
|
}
|
92
92
|
function handleNoWorkspace(globalNxVersion) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "21.3.
|
3
|
+
"version": "21.3.7",
|
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.3.
|
87
|
-
"@nx/nx-darwin-x64": "21.3.
|
88
|
-
"@nx/nx-freebsd-x64": "21.3.
|
89
|
-
"@nx/nx-linux-arm-gnueabihf": "21.3.
|
90
|
-
"@nx/nx-linux-arm64-gnu": "21.3.
|
91
|
-
"@nx/nx-linux-arm64-musl": "21.3.
|
92
|
-
"@nx/nx-linux-x64-gnu": "21.3.
|
93
|
-
"@nx/nx-linux-x64-musl": "21.3.
|
94
|
-
"@nx/nx-win32-arm64-msvc": "21.3.
|
95
|
-
"@nx/nx-win32-x64-msvc": "21.3.
|
86
|
+
"@nx/nx-darwin-arm64": "21.3.7",
|
87
|
+
"@nx/nx-darwin-x64": "21.3.7",
|
88
|
+
"@nx/nx-freebsd-x64": "21.3.7",
|
89
|
+
"@nx/nx-linux-arm-gnueabihf": "21.3.7",
|
90
|
+
"@nx/nx-linux-arm64-gnu": "21.3.7",
|
91
|
+
"@nx/nx-linux-arm64-musl": "21.3.7",
|
92
|
+
"@nx/nx-linux-x64-gnu": "21.3.7",
|
93
|
+
"@nx/nx-linux-x64-musl": "21.3.7",
|
94
|
+
"@nx/nx-win32-arm64-msvc": "21.3.7",
|
95
|
+
"@nx/nx-win32-x64-msvc": "21.3.7"
|
96
96
|
},
|
97
97
|
"nx-migrations": {
|
98
98
|
"migrations": "./migrations.json",
|
@@ -10,7 +10,8 @@ exports.yargsConnectCommand = {
|
|
10
10
|
describe: `Connect workspace to Nx Cloud.`,
|
11
11
|
builder: (yargs) => (0, documentation_1.linkToNxDevAndExamples)(withConnectOptions(yargs), 'connect-to-nx-cloud'),
|
12
12
|
handler: async (args) => {
|
13
|
-
|
13
|
+
const checkRemote = process.env.NX_SKIP_CHECK_REMOTE !== 'true';
|
14
|
+
await (await Promise.resolve().then(() => require('./connect-to-nx-cloud'))).connectToNxCloudCommand({ ...args, checkRemote });
|
14
15
|
await (await Promise.resolve().then(() => require('../../../utils/ab-testing'))).recordStat({
|
15
16
|
command: 'connect',
|
16
17
|
nxVersion: versions_1.nxVersion,
|
@@ -7,6 +7,7 @@ export declare function connectToNxCloudIfExplicitlyAsked(opts: NxArgs): Promise
|
|
7
7
|
export declare function connectWorkspaceToCloud(options: ConnectToNxCloudOptions, directory?: string): Promise<string>;
|
8
8
|
export declare function connectToNxCloudCommand(options: {
|
9
9
|
generateToken?: boolean;
|
10
|
+
checkRemote?: boolean;
|
10
11
|
}, command?: string): Promise<boolean>;
|
11
12
|
export declare function connectExistingRepoToNxCloudPrompt(command?: string, key?: MessageKey): Promise<boolean>;
|
12
13
|
export declare function connectToNxCloudWithPrompt(command: string): Promise<void>;
|
@@ -17,8 +17,9 @@ const ab_testing_1 = require("../../../utils/ab-testing");
|
|
17
17
|
const versions_1 = require("../../../utils/versions");
|
18
18
|
const workspace_root_1 = require("../../../utils/workspace-root");
|
19
19
|
const chalk = require("chalk");
|
20
|
-
const
|
21
|
-
const
|
20
|
+
const git_utils_1 = require("../../../utils/git-utils");
|
21
|
+
const ora = require('ora');
|
22
|
+
const open = require('open');
|
22
23
|
function onlyDefaultRunnerIsUsed(nxJson) {
|
23
24
|
const defaultRunner = nxJson.tasksRunnerOptions?.default?.runner;
|
24
25
|
if (!defaultRunner) {
|
@@ -59,6 +60,17 @@ async function connectToNxCloudCommand(options, command) {
|
|
59
60
|
const installationSource = process.env.NX_CONSOLE
|
60
61
|
? 'nx-console'
|
61
62
|
: 'nx-connect';
|
63
|
+
const hasRemote = !!(0, git_utils_1.getGitRemote)();
|
64
|
+
if (!hasRemote && options.checkRemote) {
|
65
|
+
output_1.output.error({
|
66
|
+
title: 'Missing VCS provider',
|
67
|
+
bodyLines: [
|
68
|
+
'Push this repository to a VCS provider (e.g., GitHub) and try again.',
|
69
|
+
'Go to https://github.com/new to create a repository on GitHub.',
|
70
|
+
],
|
71
|
+
});
|
72
|
+
return false;
|
73
|
+
}
|
62
74
|
if ((0, nx_cloud_utils_1.isNxCloudUsed)(nxJson)) {
|
63
75
|
const token = process.env.NX_CLOUD_ACCESS_TOKEN ||
|
64
76
|
nxJson.nxCloudAccessToken ||
|
package/src/utils/git-utils.d.ts
CHANGED
package/src/utils/git-utils.js
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.GitRepository = void 0;
|
4
4
|
exports.cloneFromUpstream = cloneFromUpstream;
|
5
|
+
exports.getGitRemote = getGitRemote;
|
5
6
|
exports.getGithubSlugOrNull = getGithubSlugOrNull;
|
6
7
|
exports.extractUserAndRepoFromGitHubUrl = extractUserAndRepoFromGitHubUrl;
|
7
8
|
exports.commitChanges = commitChanges;
|
@@ -170,15 +171,21 @@ class GitRepository {
|
|
170
171
|
}
|
171
172
|
}
|
172
173
|
exports.GitRepository = GitRepository;
|
174
|
+
function getGitRemote() {
|
175
|
+
const res = (0, child_process_1.execSync)('git remote -v', {
|
176
|
+
stdio: 'pipe',
|
177
|
+
windowsHide: false,
|
178
|
+
})
|
179
|
+
.toString()
|
180
|
+
.trim();
|
181
|
+
return res;
|
182
|
+
}
|
173
183
|
/**
|
174
184
|
* This is currently duplicated in Nx Console. Please let @MaxKless know if you make changes here.
|
175
185
|
*/
|
176
186
|
function getGithubSlugOrNull() {
|
177
187
|
try {
|
178
|
-
const gitRemote = (
|
179
|
-
stdio: 'pipe',
|
180
|
-
windowsHide: false,
|
181
|
-
}).toString();
|
188
|
+
const gitRemote = getGitRemote();
|
182
189
|
// If there are no remotes, we default to github
|
183
190
|
if (!gitRemote || gitRemote.length === 0) {
|
184
191
|
return 'github';
|