nx 21.4.0-beta.2 → 21.4.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/package.json +11 -11
- package/src/command-line/init/implementation/utils.d.ts.map +1 -1
- package/src/command-line/init/implementation/utils.js +1 -2
- package/src/command-line/mcp/command-object.d.ts +3 -0
- package/src/command-line/mcp/command-object.d.ts.map +1 -0
- package/src/command-line/mcp/command-object.js +24 -0
- package/src/command-line/mcp/mcp.d.ts +3 -0
- package/src/command-line/mcp/mcp.d.ts.map +1 -0
- package/src/command-line/mcp/mcp.js +22 -0
- package/src/command-line/nx-cloud/connect/connect-to-nx-cloud.d.ts.map +1 -1
- package/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +4 -4
- package/src/command-line/nx-cloud/connect/view-logs.d.ts.map +1 -1
- package/src/command-line/nx-cloud/connect/view-logs.js +3 -5
- package/src/command-line/nx-commands.d.ts.map +1 -1
- package/src/command-line/nx-commands.js +2 -0
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +1 -1
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts.map +1 -1
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +5 -3
- package/src/nx-cloud/utilities/onboarding.d.ts.map +1 -1
- package/src/nx-cloud/utilities/onboarding.js +1 -1
- package/src/nx-cloud/utilities/url-shorten.d.ts +1 -2
- package/src/nx-cloud/utilities/url-shorten.d.ts.map +1 -1
- package/src/nx-cloud/utilities/url-shorten.js +17 -21
- package/src/plugins/js/index.d.ts.map +1 -1
- package/src/plugins/js/index.js +10 -16
- package/src/plugins/js/lock-file/bun-parser.d.ts +15 -0
- package/src/plugins/js/lock-file/bun-parser.d.ts.map +1 -0
- package/src/plugins/js/lock-file/bun-parser.js +964 -0
- package/src/plugins/js/lock-file/lock-file.d.ts +2 -2
- package/src/plugins/js/lock-file/lock-file.d.ts.map +1 -1
- package/src/plugins/js/lock-file/lock-file.js +40 -17
- package/src/utils/ab-testing.d.ts +1 -1
- package/src/utils/ab-testing.d.ts.map +1 -1
- package/src/utils/ab-testing.js +1 -1
- package/src/utils/git-utils.d.ts +6 -6
- package/src/utils/git-utils.d.ts.map +1 -1
- package/src/utils/git-utils.js +75 -50
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "21.4.0-beta.
|
3
|
+
"version": "21.4.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.4.0-beta.
|
87
|
-
"@nx/nx-darwin-x64": "21.4.0-beta.
|
88
|
-
"@nx/nx-freebsd-x64": "21.4.0-beta.
|
89
|
-
"@nx/nx-linux-arm-gnueabihf": "21.4.0-beta.
|
90
|
-
"@nx/nx-linux-arm64-gnu": "21.4.0-beta.
|
91
|
-
"@nx/nx-linux-arm64-musl": "21.4.0-beta.
|
92
|
-
"@nx/nx-linux-x64-gnu": "21.4.0-beta.
|
93
|
-
"@nx/nx-linux-x64-musl": "21.4.0-beta.
|
94
|
-
"@nx/nx-win32-arm64-msvc": "21.4.0-beta.
|
95
|
-
"@nx/nx-win32-x64-msvc": "21.4.0-beta.
|
86
|
+
"@nx/nx-darwin-arm64": "21.4.0-beta.3",
|
87
|
+
"@nx/nx-darwin-x64": "21.4.0-beta.3",
|
88
|
+
"@nx/nx-freebsd-x64": "21.4.0-beta.3",
|
89
|
+
"@nx/nx-linux-arm-gnueabihf": "21.4.0-beta.3",
|
90
|
+
"@nx/nx-linux-arm64-gnu": "21.4.0-beta.3",
|
91
|
+
"@nx/nx-linux-arm64-musl": "21.4.0-beta.3",
|
92
|
+
"@nx/nx-linux-x64-gnu": "21.4.0-beta.3",
|
93
|
+
"@nx/nx-linux-x64-musl": "21.4.0-beta.3",
|
94
|
+
"@nx/nx-win32-arm64-msvc": "21.4.0-beta.3",
|
95
|
+
"@nx/nx-win32-x64-msvc": "21.4.0-beta.3"
|
96
96
|
},
|
97
97
|
"nx-migrations": {
|
98
98
|
"migrations": "./migrations.json",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/command-line/init/implementation/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAQ9D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAEL,sBAAsB,EACvB,MAAM,gCAAgC,CAAC;
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/command-line/init/implementation/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAQ9D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAEL,sBAAsB,EACvB,MAAM,gCAAgC,CAAC;AASxC,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,kBAAkB,EAAE,MAAM,EAAE,EAC5B,mBAAmB,EAAE,MAAM,EAAE,EAC7B,aAAa,EAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,QA0C1C;AAED,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC7B,mBAAmB,CA+GrB;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,kBAAkB,CAAC,EAAE,MAAM,EAAE,QAY9B;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,QAqC3C;AAED,wBAAgB,UAAU,CACxB,QAAQ,EAAE,MAAM,EAChB,GAAG,GAAE,sBAAmD,QAOzD;AAED,wBAAsB,SAAS,CAC7B,kBAAkB,EACd,SAAS,GACT,iBAAiB,GACjB,aAAa,GACb,kBAAkB,GAClB,cAAc,GACd,kBAAkB,GAClB,mBAAmB,iBAMxB;AAED,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAAE,GACnB,IAAI,CAiBN;AAED,wBAAgB,oCAAoC,CAClD,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,EAAE,EAC1B,GAAG,EAAE,sBAAsB,QAqB5B;AAED,wBAAgB,0BAA0B,CAAC,eAAe,EAAE,MAAM,QAQjE;AAED,wBAAgB,iBAAiB,CAAC,EAChC,aAAa,EACb,WAAW,GACZ,EAAE;IACD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB,GAAG,IAAI,CAUP;AAED,wBAAgB,UAAU,CAAC,WAAW,EAAE,WAAW,WASlD;AAED,wBAAgB,KAAK,CAAC,WAAW,EAAE,WAAW,WAa7C"}
|
@@ -21,7 +21,6 @@ const path_2 = require("../../../utils/path");
|
|
21
21
|
const versions_1 = require("../../../utils/versions");
|
22
22
|
const fs_1 = require("fs");
|
23
23
|
const connect_to_nx_cloud_1 = require("../../../nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud");
|
24
|
-
const url_shorten_1 = require("../../../nx-cloud/utilities/url-shorten");
|
25
24
|
const connect_to_nx_cloud_2 = require("../../nx-cloud/connect/connect-to-nx-cloud");
|
26
25
|
const deduce_default_base_1 = require("./deduce-default-base");
|
27
26
|
function createNxJsonFile(repoRoot, topologicalTargets, cacheableOperations, scriptOutputs) {
|
@@ -216,7 +215,7 @@ async function initCloud(installationSource) {
|
|
216
215
|
const token = await (0, connect_to_nx_cloud_2.connectWorkspaceToCloud)({
|
217
216
|
installationSource,
|
218
217
|
});
|
219
|
-
await (0, connect_to_nx_cloud_1.printSuccessMessage)(token, installationSource
|
218
|
+
await (0, connect_to_nx_cloud_1.printSuccessMessage)(token, installationSource);
|
220
219
|
}
|
221
220
|
function addVsCodeRecommendedExtensions(repoRoot, extensions) {
|
222
221
|
const vsCodeExtensionsPath = (0, path_1.join)(repoRoot, '.vscode/extensions.json');
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"command-object.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/mcp/command-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,eAAO,MAAM,eAAe,EAAE,aAqB7B,CAAC"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.yargsMcpCommand = void 0;
|
4
|
+
exports.yargsMcpCommand = {
|
5
|
+
command: 'mcp',
|
6
|
+
describe: 'Starts the Nx MCP server.',
|
7
|
+
builder: (y) => y
|
8
|
+
.version(false)
|
9
|
+
.strict(false)
|
10
|
+
.parserConfiguration({
|
11
|
+
'unknown-options-as-args': true,
|
12
|
+
'populate--': true,
|
13
|
+
})
|
14
|
+
.usage('')
|
15
|
+
.help(false)
|
16
|
+
.showHelp(async () => {
|
17
|
+
await (await Promise.resolve().then(() => require('./mcp'))).showHelp();
|
18
|
+
process.exit(0);
|
19
|
+
}),
|
20
|
+
handler: async (args) => {
|
21
|
+
await (await Promise.resolve().then(() => require('./mcp'))).mcpHandler(args);
|
22
|
+
process.exit(0);
|
23
|
+
},
|
24
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/mcp/mcp.ts"],"names":[],"mappings":"AAIA,wBAAsB,UAAU,CAAC,IAAI,EAAE,GAAG,iBAOzC;AAED,wBAAsB,QAAQ,kBAa7B"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.mcpHandler = mcpHandler;
|
4
|
+
exports.showHelp = showHelp;
|
5
|
+
const child_process_1 = require("child_process");
|
6
|
+
const package_manager_1 = require("../../utils/package-manager");
|
7
|
+
const workspace_root_1 = require("../../utils/workspace-root");
|
8
|
+
async function mcpHandler(args) {
|
9
|
+
const packageManagerCommands = (0, package_manager_1.getPackageManagerCommand)();
|
10
|
+
(0, child_process_1.spawnSync)(packageManagerCommands.dlx, ['-y', 'nx-mcp@latest', ...args['_']], {
|
11
|
+
stdio: 'inherit',
|
12
|
+
cwd: workspace_root_1.workspaceRoot,
|
13
|
+
});
|
14
|
+
}
|
15
|
+
async function showHelp() {
|
16
|
+
const packageManagerCommands = (0, package_manager_1.getPackageManagerCommand)();
|
17
|
+
const helpOutput = (0, child_process_1.spawnSync)(packageManagerCommands.dlx, ['-y', 'nx-mcp@latest', '--help'], {
|
18
|
+
cwd: workspace_root_1.workspaceRoot,
|
19
|
+
encoding: 'utf-8',
|
20
|
+
});
|
21
|
+
console.log(helpOutput.stdout?.toString().replaceAll('nx-mcp', 'nx mcp'));
|
22
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"connect-to-nx-cloud.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/command-line/nx-cloud/connect/connect-to-nx-cloud.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,uBAAuB,EACxB,MAAM,sEAAsE,CAAC;AAI9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EACL,UAAU,EAIX,MAAM,2BAA2B,CAAC;AAQnC,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,mBAAmB,WAclE;AAED,wBAAsB,iCAAiC,CACrD,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,uBAAuB,EAChC,SAAS,SAAgB,mBAO1B;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE;IAAE,aAAa,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,EAC3D,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC,
|
1
|
+
{"version":3,"file":"connect-to-nx-cloud.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/command-line/nx-cloud/connect/connect-to-nx-cloud.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,uBAAuB,EACxB,MAAM,sEAAsE,CAAC;AAI9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EACL,UAAU,EAIX,MAAM,2BAA2B,CAAC;AAQnC,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,mBAAmB,WAclE;AAED,wBAAsB,iCAAiC,CACrD,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,uBAAuB,EAChC,SAAS,SAAgB,mBAO1B;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE;IAAE,aAAa,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,EAC3D,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC,CA6ElB;AAMD,wBAAsB,kCAAkC,CACtD,OAAO,SAAS,EAChB,GAAG,GAAE,UAA2B,GAC/B,OAAO,CAAC,OAAO,CAAC,CAWlB;AAED,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,MAAM,iBAY/D"}
|
@@ -16,8 +16,8 @@ const child_process_1 = require("../../../utils/child-process");
|
|
16
16
|
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
|
-
const chalk = require("chalk");
|
20
19
|
const git_utils_1 = require("../../../utils/git-utils");
|
20
|
+
const chalk = require("chalk");
|
21
21
|
const ora = require('ora');
|
22
22
|
const open = require('open');
|
23
23
|
function onlyDefaultRunnerIsUsed(nxJson) {
|
@@ -60,7 +60,7 @@ async function connectToNxCloudCommand(options, command) {
|
|
60
60
|
const installationSource = process.env.NX_CONSOLE
|
61
61
|
? 'nx-console'
|
62
62
|
: 'nx-connect';
|
63
|
-
const hasRemote = !!(0, git_utils_1.
|
63
|
+
const hasRemote = !!(0, git_utils_1.getVcsRemoteInfo)();
|
64
64
|
if (!hasRemote && options.checkRemote) {
|
65
65
|
output_1.output.error({
|
66
66
|
title: 'Missing VCS provider',
|
@@ -78,7 +78,7 @@ async function connectToNxCloudCommand(options, command) {
|
|
78
78
|
if (!token) {
|
79
79
|
throw new Error(`Unable to authenticate. If you are connecting to Nx Cloud locally, set Nx Cloud ID in nx.json. If you are connecting in a CI context, either define accessToken in nx.json or set the NX_CLOUD_ACCESS_TOKEN env variable.`);
|
80
80
|
}
|
81
|
-
const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)(installationSource, token, options?.generateToken
|
81
|
+
const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)(installationSource, token, undefined, options?.generateToken === true);
|
82
82
|
output_1.output.log({
|
83
83
|
title: '✔ This workspace already has Nx Cloud set up',
|
84
84
|
bodyLines: [
|
@@ -93,7 +93,7 @@ async function connectToNxCloudCommand(options, command) {
|
|
93
93
|
generateToken: options?.generateToken,
|
94
94
|
installationSource: command ?? installationSource,
|
95
95
|
});
|
96
|
-
const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)('nx-connect', token, options?.generateToken
|
96
|
+
const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)('nx-connect', token, undefined, options?.generateToken === true);
|
97
97
|
try {
|
98
98
|
const cloudConnectSpinner = ora(`Opening Nx Cloud ${connectCloudUrl} in your browser to connect your workspace.`).start();
|
99
99
|
await sleep(2000);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"view-logs.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/command-line/nx-cloud/connect/view-logs.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"view-logs.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/command-line/nx-cloud/connect/view-logs.ts"],"names":[],"mappings":"AAWA,wBAAsB,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAiDhD"}
|
@@ -7,8 +7,6 @@ const nx_cloud_utils_1 = require("../../../utils/nx-cloud-utils");
|
|
7
7
|
const output_1 = require("../../../utils/output");
|
8
8
|
const nx_json_1 = require("../../../config/nx-json");
|
9
9
|
const connect_to_nx_cloud_1 = require("./connect-to-nx-cloud");
|
10
|
-
const connect_to_nx_cloud_2 = require("../../../nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud");
|
11
|
-
const url_shorten_1 = require("../../../nx-cloud/utilities/url-shorten");
|
12
10
|
async function viewLogs() {
|
13
11
|
const cloudUsed = (0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)());
|
14
12
|
if (cloudUsed) {
|
@@ -28,10 +26,10 @@ async function viewLogs() {
|
|
28
26
|
output_1.output.log({
|
29
27
|
title: 'Connecting to Nx Cloud',
|
30
28
|
});
|
31
|
-
|
29
|
+
await (0, connect_to_nx_cloud_1.connectWorkspaceToCloud)({
|
32
30
|
installationSource: 'view-logs',
|
31
|
+
generateToken: true,
|
33
32
|
});
|
34
|
-
await (0, connect_to_nx_cloud_2.printSuccessMessage)(token, 'view-logs', await (0, url_shorten_1.repoUsesGithub)());
|
35
33
|
}
|
36
34
|
catch (e) {
|
37
35
|
output_1.output.log({
|
@@ -48,7 +46,7 @@ async function viewLogs() {
|
|
48
46
|
if (!cloudUsed) {
|
49
47
|
output_1.output.note({
|
50
48
|
title: 'Your workspace is now connected to Nx Cloud',
|
51
|
-
bodyLines: [`Learn more about Nx Cloud at https://nx.
|
49
|
+
bodyLines: [`Learn more about Nx Cloud at https://nx.dev/nx-cloud`],
|
52
50
|
});
|
53
51
|
}
|
54
52
|
return 0;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nx-commands.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/command-line/nx-commands.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"nx-commands.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/command-line/nx-commands.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAuD/B,eAAO,MAAM,mBAAmB,EAAE,OAAO,CAAC,KAAK,CAAC,0BAA0B,CAEzE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,qBAmDf,CAAC"}
|
@@ -33,6 +33,7 @@ const command_object_27 = require("./nx-cloud/fix-ci/command-object");
|
|
33
33
|
const command_objects_1 = require("./deprecated/command-objects");
|
34
34
|
const command_object_28 = require("./sync/command-object");
|
35
35
|
const output_1 = require("../utils/output");
|
36
|
+
const command_object_29 = require("./mcp/command-object");
|
36
37
|
// Ensure that the output takes up the available width of the terminal.
|
37
38
|
yargs.wrap(yargs.terminalWidth());
|
38
39
|
exports.parserConfiguration = {
|
@@ -88,6 +89,7 @@ exports.commandsObject = yargs
|
|
88
89
|
.command(command_object_25.yargsRecordCommand)
|
89
90
|
.command(command_object_26.yargsStartCiRunCommand)
|
90
91
|
.command(command_object_27.yargsFixCiCommand)
|
92
|
+
.command(command_object_29.yargsMcpCommand)
|
91
93
|
.command(resolveConformanceCommandObject())
|
92
94
|
.command(resolveConformanceCheckCommandObject())
|
93
95
|
.scriptName('nx')
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Tree } from '../../../generators/tree';
|
2
2
|
import { NxJsonConfiguration } from '../../../config/nx-json';
|
3
|
-
export declare function printSuccessMessage(token: string | undefined, installationSource: string
|
3
|
+
export declare function printSuccessMessage(token: string | undefined, installationSource: string): Promise<string>;
|
4
4
|
export interface ConnectToNxCloudOptions {
|
5
5
|
analytics?: boolean;
|
6
6
|
installationSource?: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"connect-to-nx-cloud.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;
|
1
|
+
{"version":3,"file":"connect-to-nx-cloud.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAwF9D,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,kBAAkB,EAAE,MAAM,mBAgB3B;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAgDD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,uBAAuB,EAC/B,MAAM,sCAAmB,GACxB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA6ExB;AAED,iBAAe,yBAAyB,CACtC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,uBAAuB,iBAGjC;AAED,eAAe,yBAAyB,CAAC"}
|
@@ -10,6 +10,7 @@ const format_changed_files_with_prettier_if_available_1 = require("../../../gene
|
|
10
10
|
const url_shorten_1 = require("../../utilities/url-shorten");
|
11
11
|
const get_cloud_options_1 = require("../../utilities/get-cloud-options");
|
12
12
|
const path_1 = require("path");
|
13
|
+
const git_utils_1 = require("../../../utils/git-utils");
|
13
14
|
function printCloudConnectionDisabledMessage() {
|
14
15
|
output_1.output.error({
|
15
16
|
title: `Connections to Nx Cloud are disabled for this workspace`,
|
@@ -66,8 +67,8 @@ async function createNxCloudWorkspaceV2(workspaceName, installationSource, nxIni
|
|
66
67
|
}
|
67
68
|
return response.data;
|
68
69
|
}
|
69
|
-
async function printSuccessMessage(token, installationSource
|
70
|
-
const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)(installationSource, token,
|
70
|
+
async function printSuccessMessage(token, installationSource) {
|
71
|
+
const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)(installationSource, token, undefined, false);
|
71
72
|
output_1.output.note({
|
72
73
|
title: `Your Self-Healing CI and Remote Caching setup is almost complete`,
|
73
74
|
bodyLines: [
|
@@ -109,7 +110,8 @@ async function connectToNxCloud(tree, schema, nxJson = (0, nx_json_1.readNxJson)
|
|
109
110
|
printCloudConnectionDisabledMessage();
|
110
111
|
return null;
|
111
112
|
}
|
112
|
-
const
|
113
|
+
const remoteInfo = await (0, git_utils_1.getVcsRemoteInfo)();
|
114
|
+
const isGitHubDetected = schema.github ?? remoteInfo?.domain === 'github.com';
|
113
115
|
let responseFromCreateNxCloudWorkspaceV1;
|
114
116
|
let responseFromCreateNxCloudWorkspaceV2;
|
115
117
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"onboarding.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/nx-cloud/utilities/onboarding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAMtE,wBAAsB,uCAAuC,CAC3D,IAAI,EAAE,IAAI,EACV,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,uBAAuB,CAAC,CAMlC;AAED,wBAAsB,0BAA0B,CAAC,KAAK,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"onboarding.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/nx-cloud/utilities/onboarding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAMtE,wBAAsB,uCAAuC,CAC3D,IAAI,EAAE,IAAI,EACV,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,uBAAuB,CAAC,CAMlC;AAED,wBAAsB,0BAA0B,CAAC,KAAK,EAAE,MAAM,mBAW7D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,OAS1C"}
|
@@ -18,7 +18,7 @@ async function getNxCloudAppOnBoardingUrl(token) {
|
|
18
18
|
if (!token) {
|
19
19
|
return null;
|
20
20
|
}
|
21
|
-
const onboardingUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)('nx-welcome-app', token);
|
21
|
+
const onboardingUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)('nx-welcome-app', token, undefined, false);
|
22
22
|
return onboardingUrl;
|
23
23
|
}
|
24
24
|
function readNxCloudToken(tree) {
|
@@ -1,7 +1,6 @@
|
|
1
1
|
/**
|
2
2
|
* This is currently duplicated in Nx Console. Please let @MaxKless know if you make changes here.
|
3
3
|
*/
|
4
|
-
export declare function createNxCloudOnboardingURL(onboardingSource: string, accessToken?: string,
|
5
|
-
export declare function repoUsesGithub(github?: boolean, githubSlug?: string, apiUrl?: string): Promise<boolean>;
|
4
|
+
export declare function createNxCloudOnboardingURL(onboardingSource: string, accessToken?: string, meta?: string, forceManual?: boolean, forceGithub?: boolean): Promise<string>;
|
6
5
|
export declare function getURLifShortenFailed(usesGithub: boolean, githubSlug: string | null, apiUrl: string, source: string, accessToken?: string): string;
|
7
6
|
//# sourceMappingURL=url-shorten.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"url-shorten.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/nx-cloud/utilities/url-shorten.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,gBAAgB,EAAE,MAAM,EACxB,WAAW,CAAC,EAAE,MAAM,EACpB,
|
1
|
+
{"version":3,"file":"url-shorten.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/nx-cloud/utilities/url-shorten.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,gBAAgB,EAAE,MAAM,EACxB,WAAW,CAAC,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE,MAAM,EACb,WAAW,UAAQ,EACnB,WAAW,UAAQ,mBAkDpB;AAcD,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,OAAO,EACnB,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,MAAM,UAYrB"}
|
@@ -1,19 +1,27 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.createNxCloudOnboardingURL = createNxCloudOnboardingURL;
|
4
|
-
exports.repoUsesGithub = repoUsesGithub;
|
5
4
|
exports.getURLifShortenFailed = getURLifShortenFailed;
|
6
5
|
const logger_1 = require("../../utils/logger");
|
7
|
-
const git_utils_1 = require("../../utils/git-utils");
|
8
6
|
const get_cloud_options_1 = require("./get-cloud-options");
|
7
|
+
const git_utils_1 = require("../../utils/git-utils");
|
9
8
|
/**
|
10
9
|
* This is currently duplicated in Nx Console. Please let @MaxKless know if you make changes here.
|
11
10
|
*/
|
12
|
-
async function createNxCloudOnboardingURL(onboardingSource, accessToken,
|
13
|
-
const
|
11
|
+
async function createNxCloudOnboardingURL(onboardingSource, accessToken, meta, forceManual = false, forceGithub = false) {
|
12
|
+
const remoteInfo = (0, git_utils_1.getVcsRemoteInfo)();
|
14
13
|
const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
|
15
|
-
|
16
|
-
|
14
|
+
const installationSupportsGitHub = await getInstallationSupportsGitHub(apiUrl);
|
15
|
+
let usesGithub = false;
|
16
|
+
if (forceGithub) {
|
17
|
+
usesGithub = installationSupportsGitHub;
|
18
|
+
}
|
19
|
+
else if (forceManual) {
|
20
|
+
usesGithub = false;
|
21
|
+
}
|
22
|
+
else {
|
23
|
+
usesGithub =
|
24
|
+
remoteInfo?.domain === 'github.com' && installationSupportsGitHub;
|
17
25
|
}
|
18
26
|
const source = getSource(onboardingSource);
|
19
27
|
try {
|
@@ -21,7 +29,8 @@ async function createNxCloudOnboardingURL(onboardingSource, accessToken, usesGit
|
|
21
29
|
type: usesGithub ? 'GITHUB' : 'MANUAL',
|
22
30
|
source,
|
23
31
|
accessToken: usesGithub ? null : accessToken,
|
24
|
-
selectedRepositoryName:
|
32
|
+
selectedRepositoryName: remoteInfo?.slug ?? null,
|
33
|
+
repositoryDomain: remoteInfo?.domain ?? null,
|
25
34
|
meta,
|
26
35
|
});
|
27
36
|
if (!response?.data || response.data.message) {
|
@@ -32,21 +41,8 @@ async function createNxCloudOnboardingURL(onboardingSource, accessToken, usesGit
|
|
32
41
|
catch (e) {
|
33
42
|
logger_1.logger.verbose(`Failed to shorten Nx Cloud URL.
|
34
43
|
${e}`);
|
35
|
-
return getURLifShortenFailed(usesGithub,
|
36
|
-
}
|
37
|
-
}
|
38
|
-
async function repoUsesGithub(github, githubSlug, apiUrl) {
|
39
|
-
if (!apiUrl) {
|
40
|
-
apiUrl = (0, get_cloud_options_1.getCloudUrl)();
|
44
|
+
return getURLifShortenFailed(usesGithub, usesGithub ? remoteInfo?.slug : null, apiUrl, source, accessToken);
|
41
45
|
}
|
42
|
-
if (!githubSlug) {
|
43
|
-
githubSlug = (0, git_utils_1.getGithubSlugOrNull)();
|
44
|
-
}
|
45
|
-
const installationSupportsGitHub = await getInstallationSupportsGitHub(apiUrl);
|
46
|
-
return ((!!githubSlug || !!github) &&
|
47
|
-
(apiUrl.includes('cloud.nx.app') ||
|
48
|
-
apiUrl.includes('eu.nx.app') ||
|
49
|
-
installationSupportsGitHub));
|
50
46
|
}
|
51
47
|
function getSource(installationSource) {
|
52
48
|
if (installationSource.includes('nx-init')) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/plugins/js/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,kBAAkB,EAElB,WAAW,EAEX,aAAa,EACd,MAAM,6BAA6B,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/plugins/js/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,kBAAkB,EAElB,WAAW,EAEX,aAAa,EACd,MAAM,6BAA6B,CAAC;AAkBrC,eAAO,MAAM,IAAI,oCAAoC,CAAC;AAStD,eAAO,MAAM,aAAa,EAAE,aAK3B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,WA0CzB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,kBAkDhC,CAAC"}
|
package/src/plugins/js/index.js
CHANGED
@@ -4,17 +4,17 @@ exports.createDependencies = exports.createNodes = exports.createNodesV2 = expor
|
|
4
4
|
const fs_1 = require("fs");
|
5
5
|
const path_1 = require("path");
|
6
6
|
const perf_hooks_1 = require("perf_hooks");
|
7
|
+
const file_hasher_1 = require("../../hasher/file-hasher");
|
8
|
+
const plugins_1 = require("../../project-graph/plugins");
|
7
9
|
const cache_directory_1 = require("../../utils/cache-directory");
|
8
10
|
const globs_1 = require("../../utils/globs");
|
9
|
-
const
|
11
|
+
const package_manager_1 = require("../../utils/package-manager");
|
12
|
+
const versions_1 = require("../../utils/versions");
|
13
|
+
const workspace_root_1 = require("../../utils/workspace-root");
|
14
|
+
const bun_parser_1 = require("./lock-file/bun-parser");
|
10
15
|
const lock_file_1 = require("./lock-file/lock-file");
|
11
16
|
const build_dependencies_1 = require("./project-graph/build-dependencies/build-dependencies");
|
12
17
|
const config_1 = require("./utils/config");
|
13
|
-
const file_hasher_1 = require("../../hasher/file-hasher");
|
14
|
-
const package_manager_1 = require("../../utils/package-manager");
|
15
|
-
const workspace_root_1 = require("../../utils/workspace-root");
|
16
|
-
const versions_1 = require("../../utils/versions");
|
17
|
-
const child_process_1 = require("child_process");
|
18
18
|
exports.name = 'nx/js/dependencies-and-lockfile';
|
19
19
|
let parsedLockFile = {};
|
20
20
|
exports.createNodesV2 = [
|
@@ -38,11 +38,8 @@ exports.createNodes = [
|
|
38
38
|
}
|
39
39
|
const lockFilePath = (0, path_1.join)(workspace_root_1.workspaceRoot, lockFile);
|
40
40
|
const lockFileContents = packageManager !== 'bun'
|
41
|
-
? (0, fs_1.readFileSync)(lockFilePath)
|
42
|
-
: (0,
|
43
|
-
maxBuffer: 1024 * 1024 * 10,
|
44
|
-
windowsHide: false,
|
45
|
-
}).toString();
|
41
|
+
? (0, fs_1.readFileSync)(lockFilePath, 'utf-8')
|
42
|
+
: (0, bun_parser_1.readBunLockFile)(lockFilePath);
|
46
43
|
const lockFileHash = getLockFileHash(lockFileContents);
|
47
44
|
if (!lockFileNeedsReprocessing(lockFileHash)) {
|
48
45
|
const nodes = readCachedParsedLockFile().externalNodes;
|
@@ -68,11 +65,8 @@ const createDependencies = (_, ctx) => {
|
|
68
65
|
parsedLockFile.externalNodes) {
|
69
66
|
const lockFilePath = (0, path_1.join)(workspace_root_1.workspaceRoot, (0, lock_file_1.getLockFileName)(packageManager));
|
70
67
|
const lockFileContents = packageManager !== 'bun'
|
71
|
-
? (0, fs_1.readFileSync)(lockFilePath)
|
72
|
-
: (0,
|
73
|
-
maxBuffer: 1024 * 1024 * 10,
|
74
|
-
windowsHide: false,
|
75
|
-
}).toString();
|
68
|
+
? (0, fs_1.readFileSync)(lockFilePath, 'utf-8')
|
69
|
+
: (0, bun_parser_1.readBunLockFile)(lockFilePath);
|
76
70
|
const lockFileHash = getLockFileHash(lockFileContents);
|
77
71
|
if (!lockFileNeedsReprocessing(lockFileHash)) {
|
78
72
|
lockfileDependencies = readCachedParsedLockFile().dependencies ?? [];
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { type ProjectGraphExternalNode } from '../../../config/project-graph';
|
2
|
+
import type { CreateDependenciesContext } from '../../../project-graph/plugins';
|
3
|
+
import { type RawProjectGraphDependency } from '../../../project-graph/project-graph-builder';
|
4
|
+
export declare const BUN_LOCK_FILE = "bun.lockb";
|
5
|
+
export declare const BUN_TEXT_LOCK_FILE = "bun.lock";
|
6
|
+
export declare class BunLockfileParseError extends Error {
|
7
|
+
readonly cause?: Error;
|
8
|
+
constructor(message: string, cause?: Error);
|
9
|
+
}
|
10
|
+
export declare function readBunLockFile(lockFilePath: string): string;
|
11
|
+
export declare function getBunTextLockfileDependencies(lockFileContent: string, lockFileHash: string, ctx: CreateDependenciesContext): RawProjectGraphDependency[];
|
12
|
+
/** @internal */
|
13
|
+
export declare function clearCache(): void;
|
14
|
+
export declare function getBunTextLockfileNodes(lockFileContent: string, lockFileHash: string): Record<string, ProjectGraphExternalNode>;
|
15
|
+
//# sourceMappingURL=bun-parser.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bun-parser.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/bun-parser.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EACL,KAAK,yBAAyB,EAE/B,MAAM,8CAA8C,CAAC;AAiHtD,eAAO,MAAM,aAAa,cAAc,CAAC;AACzC,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAa7C,qBAAa,qBAAsB,SAAQ,KAAK;aACD,KAAK,CAAC,EAAE,KAAK;gBAA9C,OAAO,EAAE,MAAM,EAAkB,KAAK,CAAC,EAAE,KAAK;CAI3D;AAED,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAU5D;AAED,wBAAgB,8BAA8B,CAC5C,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,yBAAyB,GAC7B,yBAAyB,EAAE,CAiC7B;AAED,gBAAgB;AAChB,wBAAgB,UAAU,IAAI,IAAI,CAMjC;AAyTD,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,GACnB,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CA+C1C"}
|