nx 19.5.2 → 19.5.4
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/nx-cloud.d.ts +2 -1
- package/bin/nx-cloud.js +9 -17
- package/package.json +13 -13
- package/release/changelog-renderer/index.js +5 -4
- package/src/command-line/connect/connect-to-nx-cloud.d.ts +2 -0
- package/src/command-line/connect/connect-to-nx-cloud.js +33 -6
- package/src/command-line/connect/view-logs.js +5 -3
- package/src/command-line/examples.js +4 -0
- package/src/command-line/init/implementation/add-nx-to-monorepo.js +1 -1
- package/src/command-line/init/implementation/add-nx-to-nest.js +1 -1
- package/src/command-line/init/implementation/add-nx-to-npm-repo.js +1 -1
- package/src/command-line/init/implementation/angular/index.js +1 -1
- package/src/command-line/init/implementation/angular/legacy-angular-versions.js +1 -1
- package/src/command-line/init/implementation/utils.d.ts +1 -1
- package/src/command-line/init/implementation/utils.js +7 -5
- package/src/command-line/init/init-v2.js +1 -4
- package/src/command-line/list/list.js +10 -14
- package/src/command-line/migrate/migrate.js +19 -7
- package/src/command-line/release/changelog.js +1 -0
- package/src/command-line/release/command-object.js +5 -21
- package/src/command-line/release/config/config.js +4 -0
- package/src/command-line/release/plan.js +2 -12
- package/src/command-line/release/utils/generate-version-plan-content.d.ts +1 -0
- package/src/command-line/release/utils/generate-version-plan-content.js +21 -0
- package/src/command-line/release/utils/shared.js +8 -5
- package/src/command-line/release/version.js +4 -2
- package/src/command-line/report/report.d.ts +1 -0
- package/src/command-line/report/report.js +14 -9
- package/src/command-line/reset/command-object.d.ts +1 -0
- package/src/command-line/reset/command-object.js +4 -0
- package/src/command-line/reset/reset.js +13 -0
- package/src/command-line/run/run.js +2 -14
- package/src/command-line/watch/watch.js +1 -1
- package/src/daemon/socket-utils.js +1 -1
- package/src/daemon/tmp-dir.d.ts +1 -1
- package/src/daemon/tmp-dir.js +3 -2
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +6 -0
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +15 -5
- package/src/migrations/update-16-0-0/update-nx-cloud-runner.js +2 -0
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +1 -1
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +3 -1
- package/src/native/index.d.ts +2 -0
- package/src/native/native-bindings.js +1 -0
- package/src/native/nx.wasi.cjs +35 -33
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +3 -2
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +19 -66
- package/src/nx-cloud/utilities/client.d.ts +10 -0
- package/src/nx-cloud/utilities/client.js +35 -0
- package/src/nx-cloud/utilities/url-shorten.d.ts +3 -3
- package/src/nx-cloud/utilities/url-shorten.js +18 -13
- package/src/project-graph/plugins/internal-api.js +4 -1
- package/src/tasks-runner/run-command.d.ts +4 -4
- package/src/tasks-runner/run-command.js +22 -17
- package/src/tasks-runner/task-env.js +3 -2
- package/src/tasks-runner/task-graph-utils.d.ts +3 -0
- package/src/tasks-runner/task-graph-utils.js +34 -0
- package/src/tasks-runner/utils.js +9 -5
- package/src/utils/chunkify.d.ts +10 -0
- package/src/utils/chunkify.js +19 -12
- package/src/utils/command-line-utils.d.ts +3 -0
- package/src/utils/command-line-utils.js +11 -7
- package/src/utils/git-utils.js +14 -4
- package/src/utils/plugins/core-plugins.d.ts +6 -3
- package/src/utils/plugins/core-plugins.js +107 -115
- package/src/utils/plugins/index.d.ts +4 -4
- package/src/utils/plugins/index.js +7 -8
- package/src/utils/plugins/installed-plugins.d.ts +2 -3
- package/src/utils/plugins/installed-plugins.js +4 -31
- package/src/utils/plugins/local-plugins.d.ts +2 -3
- package/src/utils/plugins/local-plugins.js +2 -29
- package/src/utils/plugins/output.d.ts +5 -0
- package/src/utils/plugins/output.js +104 -0
- package/src/utils/plugins/plugin-capabilities.d.ts +12 -2
- package/src/utils/plugins/plugin-capabilities.js +2 -87
- package/src/utils/plugins/community-plugins.d.ts +0 -2
- package/src/utils/plugins/community-plugins.js +0 -28
- package/src/utils/plugins/models.d.ts +0 -22
- package/src/utils/plugins/models.js +0 -2
- package/src/utils/plugins/shared.d.ts +0 -1
- package/src/utils/plugins/shared.js +0 -7
@@ -128,11 +128,13 @@ function createCommitMessageValues(releaseGroups, releaseGroupToFilteredProjects
|
|
128
128
|
}
|
129
129
|
// One entry for the whole group for fixed groups
|
130
130
|
const projectVersionData = versionData[releaseGroupProjectNames[0]]; // all at the same version, so we can just pick the first one
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
131
|
+
if (projectVersionData.newVersion !== null) {
|
132
|
+
const releaseVersion = new ReleaseVersion({
|
133
|
+
version: projectVersionData.newVersion,
|
134
|
+
releaseTagPattern: releaseGroup.releaseTagPattern,
|
135
|
+
});
|
136
|
+
commitMessageValues.push(`- release-group: ${releaseGroup.name} ${releaseVersion.rawVersion}`);
|
137
|
+
}
|
136
138
|
}
|
137
139
|
return commitMessageValues;
|
138
140
|
}
|
@@ -169,6 +171,7 @@ function createGitTagValues(releaseGroups, releaseGroupToFilteredProjects, versi
|
|
169
171
|
if (projectVersionData.newVersion !== null) {
|
170
172
|
tags.push((0, utils_1.interpolate)(releaseGroup.releaseTagPattern, {
|
171
173
|
version: projectVersionData.newVersion,
|
174
|
+
releaseGroupName: releaseGroup.name,
|
172
175
|
}));
|
173
176
|
}
|
174
177
|
}
|
@@ -140,8 +140,9 @@ async function releaseVersion(args) {
|
|
140
140
|
...tree.listChanges().map((f) => f.path),
|
141
141
|
...additionalChangedFiles,
|
142
142
|
];
|
143
|
+
const deletedFiles = Array.from(additionalDeletedFiles);
|
143
144
|
// No further actions are necessary in this scenario (e.g. if conventional commits detected no changes)
|
144
|
-
if (!changedFiles.length) {
|
145
|
+
if (!changedFiles.length && !deletedFiles.length) {
|
145
146
|
return {
|
146
147
|
// An overall workspace version cannot be relevant when filtering to independent projects
|
147
148
|
workspaceVersion: undefined,
|
@@ -151,7 +152,7 @@ async function releaseVersion(args) {
|
|
151
152
|
if (args.gitCommit ?? nxReleaseConfig.version.git.commit) {
|
152
153
|
await (0, shared_1.commitChanges)({
|
153
154
|
changedFiles,
|
154
|
-
deletedFiles
|
155
|
+
deletedFiles,
|
155
156
|
isDryRun: !!args.dryRun,
|
156
157
|
isVerbose: !!args.verbose,
|
157
158
|
gitCommitMessages: (0, shared_1.createCommitMessageValues)(releaseGroups, releaseGroupToFilteredProjects, versionData, commitMessage),
|
@@ -162,6 +163,7 @@ async function releaseVersion(args) {
|
|
162
163
|
output_1.output.logSingleLine(`Staging changed files with git`);
|
163
164
|
await (0, git_1.gitAdd)({
|
164
165
|
changedFiles,
|
166
|
+
deletedFiles,
|
165
167
|
dryRun: args.dryRun,
|
166
168
|
verbose: args.verbose,
|
167
169
|
});
|
@@ -43,14 +43,18 @@ const LINE_SEPARATOR = '---------------------------------------';
|
|
43
43
|
*
|
44
44
|
*/
|
45
45
|
async function reportHandler() {
|
46
|
-
const { pm, pmVersion, localPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, } = await getReportData();
|
47
|
-
const
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
46
|
+
const { pm, pmVersion, localPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, nativeTarget, } = await getReportData();
|
47
|
+
const fields = [
|
48
|
+
['Node', process.versions.node],
|
49
|
+
['OS', `${process.platform}-${process.arch}`],
|
50
|
+
['Native Target', nativeTarget ?? 'Unavailable'],
|
51
|
+
[pm, pmVersion],
|
52
52
|
];
|
53
|
-
let padding = Math.max(...
|
53
|
+
let padding = Math.max(...fields.map((f) => f[0].length));
|
54
|
+
const bodyLines = fields.map(([field, value]) => `${field.padEnd(padding)} : ${value}`);
|
55
|
+
bodyLines.push('');
|
56
|
+
padding =
|
57
|
+
Math.max(...packageVersionsWeCareAbout.map((x) => x.package.length)) + 1;
|
54
58
|
packageVersionsWeCareAbout.forEach((p) => {
|
55
59
|
bodyLines.push(`${chalk.green(p.package.padEnd(padding))} : ${chalk.bold(p.version)}`);
|
56
60
|
});
|
@@ -116,6 +120,7 @@ async function getReportData() {
|
|
116
120
|
});
|
117
121
|
}
|
118
122
|
const outOfSyncPackageGroup = findMisalignedPackagesForPackage(nxPackageJson);
|
123
|
+
const native = isNativeAvailable();
|
119
124
|
return {
|
120
125
|
pm,
|
121
126
|
pmVersion,
|
@@ -125,6 +130,7 @@ async function getReportData() {
|
|
125
130
|
packageVersionsWeCareAbout,
|
126
131
|
outOfSyncPackageGroup,
|
127
132
|
projectGraphError,
|
133
|
+
nativeTarget: native ? native.getBinaryTarget() : null,
|
128
134
|
};
|
129
135
|
}
|
130
136
|
async function tryGetProjectGraph() {
|
@@ -248,8 +254,7 @@ function findInstalledPackagesWeCareAbout() {
|
|
248
254
|
}
|
249
255
|
function isNativeAvailable() {
|
250
256
|
try {
|
251
|
-
require('../../native');
|
252
|
-
return true;
|
257
|
+
return require('../../native');
|
253
258
|
}
|
254
259
|
catch {
|
255
260
|
return false;
|
@@ -13,6 +13,10 @@ exports.yargsResetCommand = {
|
|
13
13
|
.option('onlyDaemon', {
|
14
14
|
description: 'Stops the Nx Daemon, it will be restarted fresh when the next Nx command is run.',
|
15
15
|
type: 'boolean',
|
16
|
+
})
|
17
|
+
.option('onlyCloud', {
|
18
|
+
description: 'Resets the Nx Cloud client. NOTE: Does not clear the remote cache.',
|
19
|
+
type: 'boolean',
|
16
20
|
})
|
17
21
|
.option('onlyWorkspaceData', {
|
18
22
|
description: 'Clears the workspace data directory. Used by Nx to store cached data about the current workspace (e.g. partial results, incremental data, etc)',
|
@@ -6,6 +6,8 @@ const client_1 = require("../../daemon/client/client");
|
|
6
6
|
const cache_directory_1 = require("../../utils/cache-directory");
|
7
7
|
const output_1 = require("../../utils/output");
|
8
8
|
const native_file_cache_location_1 = require("../../native/native-file-cache-location");
|
9
|
+
const client_2 = require("../../nx-cloud/utilities/client");
|
10
|
+
const get_cloud_options_1 = require("../../nx-cloud/utilities/get-cloud-options");
|
9
11
|
// Wait at max 5 seconds before giving up on a failing operation.
|
10
12
|
const INCREMENTAL_BACKOFF_MAX_DURATION = 5000;
|
11
13
|
// If an operation fails, wait 100ms before first retry.
|
@@ -61,6 +63,9 @@ async function resetHandler(args) {
|
|
61
63
|
errors.push('Failed to clean up the workspace data directory.');
|
62
64
|
}
|
63
65
|
}
|
66
|
+
if (all || args.onlyCloud) {
|
67
|
+
await resetCloudClient();
|
68
|
+
}
|
64
69
|
if (errors.length > 0) {
|
65
70
|
output_1.output.error({
|
66
71
|
title: 'Failed to reset the Nx workspace.',
|
@@ -77,6 +82,14 @@ async function resetHandler(args) {
|
|
77
82
|
function killDaemon() {
|
78
83
|
return client_1.daemonClient.stop();
|
79
84
|
}
|
85
|
+
async function resetCloudClient() {
|
86
|
+
// Remove nx cloud marker files. This helps if the use happens to run `nx-cloud start-ci-run` or
|
87
|
+
// similar commands on their local machine.
|
88
|
+
try {
|
89
|
+
(await (0, client_2.getCloudClient)((0, get_cloud_options_1.getCloudOptions)())).invoke('cleanup');
|
90
|
+
}
|
91
|
+
catch { }
|
92
|
+
}
|
80
93
|
function cleanupCacheEntries() {
|
81
94
|
return incrementalBackoff(INCREMENTAL_BACKOFF_FIRST_DELAY, INCREMENTAL_BACKOFF_MAX_DURATION, () => {
|
82
95
|
(0, fs_extra_1.rmSync)(cache_directory_1.cacheDir, { recursive: true, force: true });
|
@@ -35,20 +35,8 @@ async function* promiseToIterator(v) {
|
|
35
35
|
yield await v;
|
36
36
|
}
|
37
37
|
async function iteratorToProcessStatusCode(i) {
|
38
|
-
|
39
|
-
|
40
|
-
// on version 12.0.1, a SASS compilation implementation was
|
41
|
-
// introduced making use of workers and it's unref()-ing the worker
|
42
|
-
// too early, causing the process to exit early in environments
|
43
|
-
// like CI or when running Docker builds.
|
44
|
-
const keepProcessAliveInterval = setInterval(() => { }, 1000);
|
45
|
-
try {
|
46
|
-
const { success } = await (0, async_iterator_1.getLastValueFromAsyncIterableIterator)(i);
|
47
|
-
return success ? 0 : 1;
|
48
|
-
}
|
49
|
-
finally {
|
50
|
-
clearInterval(keepProcessAliveInterval);
|
51
|
-
}
|
38
|
+
const { success } = await (0, async_iterator_1.getLastValueFromAsyncIterableIterator)(i);
|
39
|
+
return success ? 0 : 1;
|
52
40
|
}
|
53
41
|
async function parseExecutorAndTarget({ project, target }, root, projectsConfigurations) {
|
54
42
|
const proj = projectsConfigurations.projects[project];
|
@@ -117,7 +117,7 @@ async function watch(args) {
|
|
117
117
|
if (args.verbose) {
|
118
118
|
process.env.NX_VERBOSE_LOGGING = 'true';
|
119
119
|
}
|
120
|
-
if (client_1.daemonClient.enabled()) {
|
120
|
+
if (!client_1.daemonClient.enabled()) {
|
121
121
|
output_1.output.error({
|
122
122
|
title: 'Daemon is not running. The watch command is not supported without the Nx Daemon.',
|
123
123
|
});
|
@@ -25,7 +25,7 @@ const getForkedProcessOsSocketPath = (id) => {
|
|
25
25
|
};
|
26
26
|
exports.getForkedProcessOsSocketPath = getForkedProcessOsSocketPath;
|
27
27
|
const getPluginOsSocketPath = (id) => {
|
28
|
-
let path = (0, path_1.resolve)((0, path_1.join)((0, tmp_dir_1.getSocketDir)(), 'plugin' + id + '.sock'));
|
28
|
+
let path = (0, path_1.resolve)((0, path_1.join)((0, tmp_dir_1.getSocketDir)(true), 'plugin' + id + '.sock'));
|
29
29
|
return exports.isWindows ? '\\\\.\\pipe\\nx\\' + (0, path_1.resolve)(path) : (0, path_1.resolve)(path);
|
30
30
|
};
|
31
31
|
exports.getPluginOsSocketPath = getPluginOsSocketPath;
|
package/src/daemon/tmp-dir.d.ts
CHANGED
@@ -8,5 +8,5 @@ export declare function isDaemonDisabled(): boolean;
|
|
8
8
|
* We try to create a socket file in a tmp dir, but if it doesn't work because
|
9
9
|
* for instance we don't have permissions, we create it in DAEMON_DIR_FOR_CURRENT_WORKSPACE
|
10
10
|
*/
|
11
|
-
export declare function getSocketDir(): string;
|
11
|
+
export declare function getSocketDir(alreadyUnique?: boolean): string;
|
12
12
|
export declare function removeSocketDir(): void;
|
package/src/daemon/tmp-dir.js
CHANGED
@@ -51,9 +51,10 @@ function socketDirName() {
|
|
51
51
|
* We try to create a socket file in a tmp dir, but if it doesn't work because
|
52
52
|
* for instance we don't have permissions, we create it in DAEMON_DIR_FOR_CURRENT_WORKSPACE
|
53
53
|
*/
|
54
|
-
function getSocketDir() {
|
54
|
+
function getSocketDir(alreadyUnique = false) {
|
55
55
|
try {
|
56
|
-
const dir = process.env.NX_DAEMON_SOCKET_DIR ??
|
56
|
+
const dir = process.env.NX_DAEMON_SOCKET_DIR ??
|
57
|
+
(alreadyUnique ? tmp_1.tmpdir : socketDirName());
|
57
58
|
(0, fs_extra_1.ensureDirSync)(dir);
|
58
59
|
return dir;
|
59
60
|
}
|
@@ -6,3 +6,9 @@ import type { Tree } from '../tree';
|
|
6
6
|
export declare function formatChangedFilesWithPrettierIfAvailable(tree: Tree, options?: {
|
7
7
|
silent?: boolean;
|
8
8
|
}): Promise<void>;
|
9
|
+
export declare function formatFilesWithPrettierIfAvailable(files: {
|
10
|
+
path: string;
|
11
|
+
content: string | Buffer;
|
12
|
+
}[], root: string, options?: {
|
13
|
+
silent?: boolean;
|
14
|
+
}): Promise<Map<string, string>>;
|
@@ -1,23 +1,32 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.formatChangedFilesWithPrettierIfAvailable = formatChangedFilesWithPrettierIfAvailable;
|
4
|
+
exports.formatFilesWithPrettierIfAvailable = formatFilesWithPrettierIfAvailable;
|
4
5
|
const path = require("path");
|
5
6
|
/**
|
6
7
|
* Formats all the created or updated files using Prettier
|
7
8
|
* @param tree - the file system tree
|
8
9
|
*/
|
9
10
|
async function formatChangedFilesWithPrettierIfAvailable(tree, options) {
|
11
|
+
const files = new Set(tree.listChanges().filter((file) => file.type !== 'DELETE'));
|
12
|
+
const results = await formatFilesWithPrettierIfAvailable(Array.from(files), tree.root, options);
|
13
|
+
for (const [path, content] of results) {
|
14
|
+
tree.write(path, content);
|
15
|
+
}
|
16
|
+
}
|
17
|
+
async function formatFilesWithPrettierIfAvailable(files, root, options) {
|
18
|
+
const results = new Map();
|
10
19
|
let prettier;
|
11
20
|
try {
|
12
21
|
prettier = await Promise.resolve().then(() => require('prettier'));
|
13
22
|
}
|
14
23
|
catch { }
|
15
|
-
if (!prettier)
|
16
|
-
return;
|
17
|
-
|
24
|
+
if (!prettier) {
|
25
|
+
return results;
|
26
|
+
}
|
18
27
|
await Promise.all(Array.from(files).map(async (file) => {
|
19
28
|
try {
|
20
|
-
const systemPath = path.join(
|
29
|
+
const systemPath = path.join(root, file.path);
|
21
30
|
let options = {
|
22
31
|
filepath: systemPath,
|
23
32
|
};
|
@@ -35,7 +44,7 @@ async function formatChangedFilesWithPrettierIfAvailable(tree, options) {
|
|
35
44
|
if (support.ignored || !support.inferredParser) {
|
36
45
|
return;
|
37
46
|
}
|
38
|
-
|
47
|
+
results.set(file.path,
|
39
48
|
// In prettier v3 the format result is a promise
|
40
49
|
await prettier.format(file.content.toString('utf-8'), options));
|
41
50
|
}
|
@@ -45,4 +54,5 @@ async function formatChangedFilesWithPrettierIfAvailable(tree, options) {
|
|
45
54
|
}
|
46
55
|
}
|
47
56
|
}));
|
57
|
+
return results;
|
48
58
|
}
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = default_1;
|
4
4
|
const project_configuration_1 = require("../../generators/utils/project-configuration");
|
5
5
|
const json_1 = require("../../generators/utils/json");
|
6
|
+
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
6
7
|
async function default_1(tree) {
|
7
8
|
(0, json_1.updateJson)(tree, 'package.json', (json) => {
|
8
9
|
if (json.dependencies && json.dependencies['@nrwl/nx-cloud']) {
|
@@ -24,4 +25,5 @@ async function default_1(tree) {
|
|
24
25
|
}
|
25
26
|
}
|
26
27
|
(0, project_configuration_1.updateNxJson)(tree, nxJson);
|
28
|
+
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
27
29
|
}
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import { Tree } from '../../generators/tree';
|
2
|
-
export default function migrate(tree: Tree): void
|
2
|
+
export default function migrate(tree: Tree): Promise<void>;
|
@@ -2,8 +2,10 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.default = migrate;
|
4
4
|
const nx_json_1 = require("../../generators/utils/nx-json");
|
5
|
-
|
5
|
+
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
6
|
+
async function migrate(tree) {
|
6
7
|
const nxJson = (0, nx_json_1.readNxJson)(tree);
|
7
8
|
nxJson.useInferencePlugins = false;
|
8
9
|
(0, nx_json_1.updateNxJson)(tree, nxJson);
|
10
|
+
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
9
11
|
}
|
package/src/native/index.d.ts
CHANGED
@@ -116,6 +116,8 @@ export interface FileSetInput {
|
|
116
116
|
|
117
117
|
export declare export function findImports(projectFileMap: Record<string, Array<string>>): Array<ImportResult>
|
118
118
|
|
119
|
+
export declare export function getBinaryTarget(): string
|
120
|
+
|
119
121
|
/**
|
120
122
|
* Expands the given outputs into a list of existing files.
|
121
123
|
* This is used when hashing outputs
|
@@ -372,6 +372,7 @@ module.exports.copy = nativeBinding.copy
|
|
372
372
|
module.exports.EventType = nativeBinding.EventType
|
373
373
|
module.exports.expandOutputs = nativeBinding.expandOutputs
|
374
374
|
module.exports.findImports = nativeBinding.findImports
|
375
|
+
module.exports.getBinaryTarget = nativeBinding.getBinaryTarget
|
375
376
|
module.exports.getFilesForOutputs = nativeBinding.getFilesForOutputs
|
376
377
|
module.exports.hashArray = nativeBinding.hashArray
|
377
378
|
module.exports.hashFile = nativeBinding.hashFile
|
package/src/native/nx.wasi.cjs
CHANGED
@@ -88,39 +88,40 @@ function __napi_rs_initialize_modules(__napiInstance) {
|
|
88
88
|
__napiInstance.exports['__napi_register__copy_3']?.()
|
89
89
|
__napiInstance.exports['__napi_register__hash_array_4']?.()
|
90
90
|
__napiInstance.exports['__napi_register__hash_file_5']?.()
|
91
|
-
__napiInstance.exports['
|
92
|
-
__napiInstance.exports['
|
93
|
-
__napiInstance.exports['
|
94
|
-
__napiInstance.exports['
|
95
|
-
__napiInstance.exports['
|
96
|
-
__napiInstance.exports['
|
97
|
-
__napiInstance.exports['
|
98
|
-
__napiInstance.exports['
|
99
|
-
__napiInstance.exports['
|
100
|
-
__napiInstance.exports['
|
101
|
-
__napiInstance.exports['
|
102
|
-
__napiInstance.exports['
|
103
|
-
__napiInstance.exports['
|
104
|
-
__napiInstance.exports['
|
105
|
-
__napiInstance.exports['
|
106
|
-
__napiInstance.exports['
|
107
|
-
__napiInstance.exports['
|
108
|
-
__napiInstance.exports['
|
109
|
-
__napiInstance.exports['
|
110
|
-
__napiInstance.exports['
|
111
|
-
__napiInstance.exports['
|
112
|
-
__napiInstance.exports['
|
113
|
-
__napiInstance.exports['
|
114
|
-
__napiInstance.exports['
|
115
|
-
__napiInstance.exports['
|
116
|
-
__napiInstance.exports['
|
117
|
-
__napiInstance.exports['
|
118
|
-
__napiInstance.exports['
|
119
|
-
__napiInstance.exports['
|
120
|
-
__napiInstance.exports['
|
121
|
-
__napiInstance.exports['
|
122
|
-
__napiInstance.exports['
|
123
|
-
__napiInstance.exports['
|
91
|
+
__napiInstance.exports['__napi_register__IS_WASM_6']?.()
|
92
|
+
__napiInstance.exports['__napi_register__get_binary_target_7']?.()
|
93
|
+
__napiInstance.exports['__napi_register__ImportResult_struct_8']?.()
|
94
|
+
__napiInstance.exports['__napi_register__find_imports_9']?.()
|
95
|
+
__napiInstance.exports['__napi_register__transfer_project_graph_10']?.()
|
96
|
+
__napiInstance.exports['__napi_register__ExternalNode_struct_11']?.()
|
97
|
+
__napiInstance.exports['__napi_register__Target_struct_12']?.()
|
98
|
+
__napiInstance.exports['__napi_register__Project_struct_13']?.()
|
99
|
+
__napiInstance.exports['__napi_register__ProjectGraph_struct_14']?.()
|
100
|
+
__napiInstance.exports['__napi_register__HashPlanner_struct_15']?.()
|
101
|
+
__napiInstance.exports['__napi_register__HashPlanner_impl_19']?.()
|
102
|
+
__napiInstance.exports['__napi_register__HashDetails_struct_20']?.()
|
103
|
+
__napiInstance.exports['__napi_register__HasherOptions_struct_21']?.()
|
104
|
+
__napiInstance.exports['__napi_register__TaskHasher_struct_22']?.()
|
105
|
+
__napiInstance.exports['__napi_register__TaskHasher_impl_25']?.()
|
106
|
+
__napiInstance.exports['__napi_register__Task_struct_26']?.()
|
107
|
+
__napiInstance.exports['__napi_register__TaskTarget_struct_27']?.()
|
108
|
+
__napiInstance.exports['__napi_register__TaskGraph_struct_28']?.()
|
109
|
+
__napiInstance.exports['__napi_register__FileData_struct_29']?.()
|
110
|
+
__napiInstance.exports['__napi_register__InputsInput_struct_30']?.()
|
111
|
+
__napiInstance.exports['__napi_register__FileSetInput_struct_31']?.()
|
112
|
+
__napiInstance.exports['__napi_register__RuntimeInput_struct_32']?.()
|
113
|
+
__napiInstance.exports['__napi_register__EnvironmentInput_struct_33']?.()
|
114
|
+
__napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_34']?.()
|
115
|
+
__napiInstance.exports['__napi_register__DepsOutputsInput_struct_35']?.()
|
116
|
+
__napiInstance.exports['__napi_register__NxJson_struct_36']?.()
|
117
|
+
__napiInstance.exports['__napi_register__WorkspaceContext_struct_37']?.()
|
118
|
+
__napiInstance.exports['__napi_register__WorkspaceContext_impl_46']?.()
|
119
|
+
__napiInstance.exports['__napi_register__WorkspaceErrors_47']?.()
|
120
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_48']?.()
|
121
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_49']?.()
|
122
|
+
__napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_50']?.()
|
123
|
+
__napiInstance.exports['__napi_register__FileMap_struct_51']?.()
|
124
|
+
__napiInstance.exports['__napi_register____test_only_transfer_file_map_52']?.()
|
124
125
|
}
|
125
126
|
module.exports.HashPlanner = __napiModule.exports.HashPlanner
|
126
127
|
module.exports.ImportResult = __napiModule.exports.ImportResult
|
@@ -129,6 +130,7 @@ module.exports.WorkspaceContext = __napiModule.exports.WorkspaceContext
|
|
129
130
|
module.exports.copy = __napiModule.exports.copy
|
130
131
|
module.exports.expandOutputs = __napiModule.exports.expandOutputs
|
131
132
|
module.exports.findImports = __napiModule.exports.findImports
|
133
|
+
module.exports.getBinaryTarget = __napiModule.exports.getBinaryTarget
|
132
134
|
module.exports.getFilesForOutputs = __napiModule.exports.getFilesForOutputs
|
133
135
|
module.exports.hashArray = __napiModule.exports.hashArray
|
134
136
|
module.exports.hashFile = __napiModule.exports.hashFile
|
Binary file
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import { Tree } from '../../../generators/tree';
|
2
|
-
|
2
|
+
export declare function printSuccessMessage(token: string | undefined, installationSource: string, usesGithub: boolean): Promise<string>;
|
3
|
+
export interface ConnectToNxCloudOptions {
|
3
4
|
analytics?: boolean;
|
4
5
|
installationSource?: string;
|
5
6
|
hideFormatLogs?: boolean;
|
6
7
|
github?: boolean;
|
7
8
|
directory?: string;
|
8
9
|
}
|
9
|
-
export declare function connectToNxCloud(tree: Tree, schema: ConnectToNxCloudOptions): Promise<
|
10
|
+
export declare function connectToNxCloud(tree: Tree, schema: ConnectToNxCloudOptions): Promise<string>;
|
10
11
|
export default connectToNxCloud;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.printSuccessMessage = printSuccessMessage;
|
3
4
|
exports.connectToNxCloud = connectToNxCloud;
|
4
5
|
const child_process_1 = require("child_process");
|
5
6
|
const output_1 = require("../../../utils/output");
|
@@ -8,9 +9,6 @@ const nx_json_1 = require("../../../generators/utils/nx-json");
|
|
8
9
|
const format_changed_files_with_prettier_if_available_1 = require("../../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
9
10
|
const url_shorten_1 = require("../../utilities/url-shorten");
|
10
11
|
const get_cloud_options_1 = require("../../utilities/get-cloud-options");
|
11
|
-
const git_utils_1 = require("../../../utils/git-utils");
|
12
|
-
const ora = require("ora");
|
13
|
-
const open = require("open");
|
14
12
|
function printCloudConnectionDisabledMessage() {
|
15
13
|
output_1.output.error({
|
16
14
|
title: `Connections to Nx Cloud are disabled for this workspace`,
|
@@ -55,60 +53,20 @@ async function createNxCloudWorkspace(workspaceName, installationSource, nxInitD
|
|
55
53
|
}
|
56
54
|
return response.data;
|
57
55
|
}
|
58
|
-
async function printSuccessMessage(
|
59
|
-
const connectCloudUrl = await (0, url_shorten_1.
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
`- Go to the following URL to connect your workspace to Nx Cloud:`,
|
73
|
-
'',
|
74
|
-
`${connectCloudUrl}`,
|
75
|
-
],
|
76
|
-
});
|
77
|
-
}
|
78
|
-
}
|
79
|
-
else {
|
80
|
-
if (installationSource === 'create-nx-workspace') {
|
81
|
-
output_1.output.note({
|
82
|
-
title: `Your Nx Cloud workspace is ready.`,
|
83
|
-
bodyLines: [
|
84
|
-
`To claim it, connect it to your Nx Cloud account:`,
|
85
|
-
`- Push your repository to your git hosting provider.`,
|
86
|
-
`- Go to the following URL to connect your workspace to Nx Cloud:`,
|
87
|
-
'',
|
88
|
-
`${connectCloudUrl}`,
|
89
|
-
],
|
90
|
-
});
|
91
|
-
(0, git_utils_1.commitChanges)(`feat(nx): Added Nx Cloud token to your nx.json
|
92
|
-
|
93
|
-
To connect your workspace to Nx Cloud, push your repository
|
94
|
-
to your git hosting provider and go to the following URL:
|
95
|
-
|
96
|
-
${connectCloudUrl}`, directory);
|
97
|
-
}
|
98
|
-
else {
|
99
|
-
output_1.output.note({
|
100
|
-
title: `Your Nx Cloud workspace is ready.`,
|
101
|
-
bodyLines: [
|
102
|
-
`To claim it, connect it to your Nx Cloud account:`,
|
103
|
-
`- Commit and push your changes.`,
|
104
|
-
`- Create a pull request for the changes.`,
|
105
|
-
`- Go to the following URL to connect your workspace to Nx Cloud:`,
|
106
|
-
'',
|
107
|
-
`${connectCloudUrl}`,
|
108
|
-
],
|
109
|
-
});
|
110
|
-
}
|
111
|
-
}
|
56
|
+
async function printSuccessMessage(token, installationSource, usesGithub) {
|
57
|
+
const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)(installationSource, token, usesGithub);
|
58
|
+
output_1.output.note({
|
59
|
+
title: `Your Nx Cloud workspace is ready.`,
|
60
|
+
bodyLines: [
|
61
|
+
`To claim it, connect it to your Nx Cloud account:`,
|
62
|
+
`- Commit and push your changes.`,
|
63
|
+
`- Create a pull request for the changes.`,
|
64
|
+
`- Go to the following URL to connect your workspace to Nx Cloud:`,
|
65
|
+
'',
|
66
|
+
`${connectCloudUrl}`,
|
67
|
+
],
|
68
|
+
});
|
69
|
+
return connectCloudUrl;
|
112
70
|
}
|
113
71
|
function addNxCloudOptionsToNxJson(tree, nxJson, token) {
|
114
72
|
nxJson ??= {
|
@@ -125,12 +83,11 @@ async function connectToNxCloud(tree, schema) {
|
|
125
83
|
schema.installationSource ??= 'user';
|
126
84
|
const nxJson = (0, nx_json_1.readNxJson)(tree);
|
127
85
|
if (nxJson?.neverConnectToCloud) {
|
128
|
-
|
129
|
-
|
130
|
-
};
|
86
|
+
printCloudConnectionDisabledMessage();
|
87
|
+
return null;
|
131
88
|
}
|
132
89
|
else {
|
133
|
-
const usesGithub = await (0, url_shorten_1.repoUsesGithub)(schema.github);
|
90
|
+
const usesGithub = schema.github ?? (await (0, url_shorten_1.repoUsesGithub)(schema.github));
|
134
91
|
let responseFromCreateNxCloudWorkspace;
|
135
92
|
// do NOT create Nx Cloud token (createNxCloudWorkspace)
|
136
93
|
// if user is using github and is running nx-connect
|
@@ -140,12 +97,8 @@ async function connectToNxCloud(tree, schema) {
|
|
140
97
|
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
|
141
98
|
silent: schema.hideFormatLogs,
|
142
99
|
});
|
100
|
+
return responseFromCreateNxCloudWorkspace.token;
|
143
101
|
}
|
144
|
-
const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
|
145
|
-
return async () => await printSuccessMessage(responseFromCreateNxCloudWorkspace?.url ?? apiUrl, responseFromCreateNxCloudWorkspace?.token, schema.installationSource, usesGithub, schema.directory);
|
146
102
|
}
|
147
103
|
}
|
148
|
-
function sleep(ms) {
|
149
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
150
|
-
}
|
151
104
|
exports.default = connectToNxCloud;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { CloudTaskRunnerOptions } from '../nx-cloud-tasks-runner-shell';
|
2
|
+
export declare class UnknownCommandError extends Error {
|
3
|
+
command: string;
|
4
|
+
availableCommands: string[];
|
5
|
+
constructor(command: string, availableCommands: string[]);
|
6
|
+
}
|
7
|
+
export declare function getCloudClient(options: CloudTaskRunnerOptions): Promise<{
|
8
|
+
invoke: (command: string) => void;
|
9
|
+
availableCommands: string[];
|
10
|
+
}>;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.UnknownCommandError = void 0;
|
4
|
+
exports.getCloudClient = getCloudClient;
|
5
|
+
const resolution_helpers_1 = require("../resolution-helpers");
|
6
|
+
const update_manager_1 = require("../update-manager");
|
7
|
+
class UnknownCommandError extends Error {
|
8
|
+
constructor(command, availableCommands) {
|
9
|
+
super(`Unknown Command "${command}"`);
|
10
|
+
this.command = command;
|
11
|
+
this.availableCommands = availableCommands;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
exports.UnknownCommandError = UnknownCommandError;
|
15
|
+
async function getCloudClient(options) {
|
16
|
+
const { nxCloudClient } = await (0, update_manager_1.verifyOrUpdateNxCloudClient)(options);
|
17
|
+
const paths = (0, resolution_helpers_1.findAncestorNodeModules)(__dirname, []);
|
18
|
+
nxCloudClient.configureLightClientRequire()(paths);
|
19
|
+
return {
|
20
|
+
invoke: (command) => {
|
21
|
+
if (command in nxCloudClient.commands) {
|
22
|
+
nxCloudClient.commands[command]()
|
23
|
+
.then(() => process.exit(0))
|
24
|
+
.catch((e) => {
|
25
|
+
console.error(e);
|
26
|
+
process.exit(1);
|
27
|
+
});
|
28
|
+
}
|
29
|
+
else {
|
30
|
+
throw new UnknownCommandError(command, Object.keys(nxCloudClient.commands));
|
31
|
+
}
|
32
|
+
},
|
33
|
+
availableCommands: Object.keys(nxCloudClient.commands),
|
34
|
+
};
|
35
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
export declare function
|
2
|
-
export declare function repoUsesGithub(github?: boolean): Promise<boolean>;
|
3
|
-
export declare function getURLifShortenFailed(usesGithub: boolean, githubSlug: string, apiUrl: string, source: string, accessToken?: string): string;
|
1
|
+
export declare function createNxCloudOnboardingURL(onboardingSource: string, accessToken?: string, usesGithub?: boolean, meta?: string): Promise<string>;
|
2
|
+
export declare function repoUsesGithub(github?: boolean, githubSlug?: string, apiUrl?: string): Promise<boolean>;
|
3
|
+
export declare function getURLifShortenFailed(usesGithub: boolean, githubSlug: string | null, apiUrl: string, source: string, accessToken?: string): string;
|
4
4
|
export declare function getNxCloudVersion(apiUrl: string): Promise<string | null>;
|
5
5
|
export declare function removeVersionModifier(versionString: string): string;
|
6
6
|
export declare function versionIsValid(version: string): boolean;
|