nx 19.5.7 → 19.6.0-beta.1
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +12 -12
- package/release/changelog-renderer/index.js +16 -1
- package/release/index.d.ts +1 -1
- package/release/index.js +2 -1
- package/schemas/nx-schema.json +3 -0
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +1 -0
- package/src/command-line/affected/affected.js +1 -1
- package/src/command-line/connect/connect-to-nx-cloud.js +2 -1
- package/src/command-line/init/init-v2.js +1 -1
- package/src/command-line/release/changelog.d.ts +2 -7
- package/src/command-line/release/changelog.js +415 -363
- package/src/command-line/release/command-object.d.ts +1 -0
- package/src/command-line/release/command-object.js +14 -0
- package/src/command-line/release/config/deep-merge-json.d.ts +1 -0
- package/src/command-line/release/config/deep-merge-json.js +28 -0
- package/src/command-line/release/config/version-plans.d.ts +5 -0
- package/src/command-line/release/config/version-plans.js +9 -5
- package/src/command-line/release/index.d.ts +16 -4
- package/src/command-line/release/index.js +23 -9
- package/src/command-line/release/plan.d.ts +2 -1
- package/src/command-line/release/plan.js +93 -100
- package/src/command-line/release/publish.d.ts +2 -6
- package/src/command-line/release/publish.js +67 -52
- package/src/command-line/release/release.d.ts +2 -1
- package/src/command-line/release/release.js +181 -165
- package/src/command-line/release/utils/generate-version-plan-content.js +2 -3
- package/src/command-line/release/utils/print-config.d.ts +7 -0
- package/src/command-line/release/utils/print-config.js +36 -0
- package/src/command-line/release/version.d.ts +7 -6
- package/src/command-line/release/version.js +179 -165
- package/src/command-line/run/run-one.js +1 -1
- package/src/command-line/run-many/run-many.js +1 -1
- package/src/command-line/yargs-utils/shared-options.d.ts +1 -0
- package/src/command-line/yargs-utils/shared-options.js +5 -0
- package/src/commands-runner/create-command-graph.js +4 -2
- package/src/config/nx-json.d.ts +6 -1
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/styles.css +1 -1
- package/src/daemon/cache.d.ts +1 -0
- package/src/daemon/cache.js +25 -18
- package/src/daemon/client/client.js +9 -1
- package/src/daemon/message-types/force-shutdown.d.ts +5 -0
- package/src/daemon/message-types/force-shutdown.js +11 -0
- package/src/daemon/server/handle-force-shutdown.d.ts +5 -0
- package/src/daemon/server/handle-force-shutdown.js +18 -0
- package/src/daemon/server/handle-request-shutdown.js +2 -0
- package/src/daemon/server/server.d.ts +1 -0
- package/src/daemon/server/server.js +14 -0
- package/src/daemon/server/shutdown-utils.d.ts +2 -1
- package/src/daemon/server/shutdown-utils.js +11 -4
- package/src/daemon/server/watcher.js +3 -0
- package/src/devkit-internals.d.ts +1 -1
- package/src/devkit-internals.js +2 -1
- package/src/generators/utils/project-configuration.js +41 -11
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +45 -11
- package/src/nx-cloud/models/onboarding-status.d.ts +1 -0
- package/src/nx-cloud/models/onboarding-status.js +2 -0
- package/src/nx-cloud/nx-cloud-tasks-runner-shell.d.ts +1 -0
- package/src/nx-cloud/utilities/axios.js +9 -2
- package/src/nx-cloud/utilities/is-workspace-claimed.d.ts +1 -0
- package/src/nx-cloud/utilities/is-workspace-claimed.js +24 -0
- package/src/nx-cloud/utilities/onboarding.d.ts +5 -0
- package/src/nx-cloud/utilities/onboarding.js +28 -0
- package/src/project-graph/plugins/internal-api.js +16 -5
- package/src/project-graph/plugins/isolation/messaging.d.ts +5 -1
- package/src/project-graph/plugins/isolation/messaging.js +1 -0
- package/src/project-graph/plugins/isolation/plugin-pool.js +4 -6
- package/src/project-graph/plugins/isolation/plugin-worker.js +15 -0
- package/src/project-graph/utils/project-configuration-utils.d.ts +1 -0
- package/src/project-graph/utils/project-configuration-utils.js +6 -2
- package/src/tasks-runner/run-command.js +6 -1
- package/src/utils/command-line-utils.d.ts +1 -0
- package/src/utils/nx-cloud-utils.js +3 -1
- package/src/utils/package-json.d.ts +2 -9
- package/src/utils/package-manager.js +12 -3
@@ -42,7 +42,7 @@ function getNxInitDate() {
|
|
42
42
|
return null;
|
43
43
|
}
|
44
44
|
}
|
45
|
-
async function
|
45
|
+
async function createNxCloudWorkspaceV1(workspaceName, installationSource, nxInitDate) {
|
46
46
|
const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
|
47
47
|
const response = await require('axios').post(`${apiUrl}/nx-cloud/create-org-and-workspace`, {
|
48
48
|
workspaceName,
|
@@ -54,6 +54,18 @@ async function createNxCloudWorkspace(workspaceName, installationSource, nxInitD
|
|
54
54
|
}
|
55
55
|
return response.data;
|
56
56
|
}
|
57
|
+
async function createNxCloudWorkspaceV2(workspaceName, installationSource, nxInitDate) {
|
58
|
+
const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
|
59
|
+
const response = await require('axios').post(`${apiUrl}/nx-cloud/v2/create-org-and-workspace`, {
|
60
|
+
workspaceName,
|
61
|
+
installationSource,
|
62
|
+
nxInitDate,
|
63
|
+
});
|
64
|
+
if (response.data.message) {
|
65
|
+
throw new Error(response.data.message);
|
66
|
+
}
|
67
|
+
return response.data;
|
68
|
+
}
|
57
69
|
async function printSuccessMessage(token, installationSource, usesGithub) {
|
58
70
|
const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)(installationSource, token, usesGithub);
|
59
71
|
output_1.output.note({
|
@@ -82,6 +94,19 @@ function addNxCloudOptionsToNxJson(tree, token, directory = '') {
|
|
82
94
|
});
|
83
95
|
}
|
84
96
|
}
|
97
|
+
function addNxCloudIdToNxJson(tree, nxCloudId, directory = tree.root) {
|
98
|
+
const nxJsonPath = (0, path_1.join)(directory, 'nx.json');
|
99
|
+
if (tree.exists(nxJsonPath)) {
|
100
|
+
(0, json_1.updateJson)(tree, (0, path_1.join)(directory, 'nx.json'), (nxJson) => {
|
101
|
+
const overrideUrl = process.env.NX_CLOUD_API || process.env.NRWL_API;
|
102
|
+
if (overrideUrl) {
|
103
|
+
nxJson.nxCloudUrl = overrideUrl;
|
104
|
+
}
|
105
|
+
nxJson.nxCloudId = nxCloudId;
|
106
|
+
return nxJson;
|
107
|
+
});
|
108
|
+
}
|
109
|
+
}
|
85
110
|
async function connectToNxCloud(tree, schema, nxJson = (0, nx_json_1.readNxJson)(tree)) {
|
86
111
|
schema.installationSource ??= 'user';
|
87
112
|
if (nxJson?.neverConnectToCloud) {
|
@@ -90,18 +115,27 @@ async function connectToNxCloud(tree, schema, nxJson = (0, nx_json_1.readNxJson)
|
|
90
115
|
}
|
91
116
|
else {
|
92
117
|
const usesGithub = schema.github ?? (await (0, url_shorten_1.repoUsesGithub)(schema.github));
|
93
|
-
let
|
118
|
+
let responseFromCreateNxCloudWorkspaceV1;
|
119
|
+
let responseFromCreateNxCloudWorkspaceV2;
|
94
120
|
// do NOT create Nx Cloud token (createNxCloudWorkspace)
|
95
121
|
// if user is using github and is running nx-connect
|
96
|
-
if (!(usesGithub &&
|
97
|
-
(
|
98
|
-
schema.installationSource
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
122
|
+
if (!(usesGithub && schema.installationSource === 'nx-connect')) {
|
123
|
+
if (process.env.NX_ENABLE_LOGIN === 'true') {
|
124
|
+
responseFromCreateNxCloudWorkspaceV2 = await createNxCloudWorkspaceV2(getRootPackageName(tree), schema.installationSource, getNxInitDate());
|
125
|
+
addNxCloudIdToNxJson(tree, responseFromCreateNxCloudWorkspaceV2?.nxCloudId, schema.directory);
|
126
|
+
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
|
127
|
+
silent: schema.hideFormatLogs,
|
128
|
+
});
|
129
|
+
return responseFromCreateNxCloudWorkspaceV2.nxCloudId;
|
130
|
+
}
|
131
|
+
else {
|
132
|
+
responseFromCreateNxCloudWorkspaceV1 = await createNxCloudWorkspaceV1(getRootPackageName(tree), schema.installationSource, getNxInitDate());
|
133
|
+
addNxCloudOptionsToNxJson(tree, responseFromCreateNxCloudWorkspaceV1?.token, schema.directory);
|
134
|
+
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
|
135
|
+
silent: schema.hideFormatLogs,
|
136
|
+
});
|
137
|
+
return responseFromCreateNxCloudWorkspaceV1.token;
|
138
|
+
}
|
105
139
|
}
|
106
140
|
}
|
107
141
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export type NxCloudOnBoardingStatus = 'claimed' | 'unclaimed' | 'not-configured';
|
@@ -8,8 +8,15 @@ function createApiAxiosInstance(options) {
|
|
8
8
|
let axiosConfigBuilder = (axiosConfig) => axiosConfig;
|
9
9
|
const baseUrl = process.env.NX_CLOUD_API || options.url || 'https://cloud.nx.app';
|
10
10
|
const accessToken = environment_1.ACCESS_TOKEN ? environment_1.ACCESS_TOKEN : options.accessToken;
|
11
|
-
|
12
|
-
|
11
|
+
const nxCloudId = options.nxCloudId;
|
12
|
+
// TODO(lourw): Update message with NxCloudId once it is supported
|
13
|
+
if (!accessToken && !nxCloudId) {
|
14
|
+
if (process.env.NX_ENABLE_LOGIN === 'true' && !nxCloudId) {
|
15
|
+
throw new Error(`Unable to authenticate. Please connect your workspace to Nx Cloud to define a valid Nx Cloud Id. If you are in a CI context, please set the NX_CLOUD_ACCESS_TOKEN environment variable or define an access token in your nx.json.`);
|
16
|
+
}
|
17
|
+
else {
|
18
|
+
throw new Error(`Unable to authenticate. Either define accessToken in nx.json or set the NX_CLOUD_ACCESS_TOKEN env variable. If you do not want to use Nx Cloud for this command, either set NX_NO_CLOUD=true, or pass the --no-cloud flag.`);
|
19
|
+
}
|
13
20
|
}
|
14
21
|
if (options.customProxyConfigPath) {
|
15
22
|
const { nxCloudProxyConfig } = require((0, path_1.join)(process.cwd(), options.customProxyConfigPath));
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function isWorkspaceClaimed(nxCloudAccessToken: any): Promise<any>;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isWorkspaceClaimed = isWorkspaceClaimed;
|
4
|
+
const get_cloud_options_1 = require("./get-cloud-options");
|
5
|
+
async function isWorkspaceClaimed(nxCloudAccessToken) {
|
6
|
+
if (!nxCloudAccessToken)
|
7
|
+
return false;
|
8
|
+
const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
|
9
|
+
try {
|
10
|
+
const response = await require('axios').post(`${apiUrl}/nx-cloud/is-workspace-claimed`, {
|
11
|
+
nxCloudAccessToken,
|
12
|
+
});
|
13
|
+
if (response.data.message) {
|
14
|
+
return false;
|
15
|
+
}
|
16
|
+
else {
|
17
|
+
return response.data;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
catch (e) {
|
21
|
+
// We want to handle cases the if the request fails for any reason
|
22
|
+
return false;
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import type { Tree } from '../../generators/tree';
|
2
|
+
import { NxCloudOnBoardingStatus } from '../models/onboarding-status';
|
3
|
+
export declare function createNxCloudOnboardingURLForWelcomeApp(tree: Tree, token?: string): Promise<NxCloudOnBoardingStatus>;
|
4
|
+
export declare function getNxCloudAppOnBoardingUrl(token: string): Promise<string>;
|
5
|
+
export declare function readNxCloudToken(tree: Tree): any;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createNxCloudOnboardingURLForWelcomeApp = createNxCloudOnboardingURLForWelcomeApp;
|
4
|
+
exports.getNxCloudAppOnBoardingUrl = getNxCloudAppOnBoardingUrl;
|
5
|
+
exports.readNxCloudToken = readNxCloudToken;
|
6
|
+
const devkit_exports_1 = require("../../devkit-exports");
|
7
|
+
const is_workspace_claimed_1 = require("./is-workspace-claimed");
|
8
|
+
const url_shorten_1 = require("./url-shorten");
|
9
|
+
const run_command_1 = require("../../tasks-runner/run-command");
|
10
|
+
async function createNxCloudOnboardingURLForWelcomeApp(tree, token) {
|
11
|
+
token = token || readNxCloudToken(tree);
|
12
|
+
if (!token) {
|
13
|
+
return 'not-configured';
|
14
|
+
}
|
15
|
+
return (await (0, is_workspace_claimed_1.isWorkspaceClaimed)(token)) ? 'claimed' : 'unclaimed';
|
16
|
+
}
|
17
|
+
async function getNxCloudAppOnBoardingUrl(token) {
|
18
|
+
if (!token) {
|
19
|
+
return null;
|
20
|
+
}
|
21
|
+
const onboardingUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)('nx-welcome-app', token);
|
22
|
+
return onboardingUrl;
|
23
|
+
}
|
24
|
+
function readNxCloudToken(tree) {
|
25
|
+
const nxJson = (0, devkit_exports_1.readNxJson)(tree);
|
26
|
+
const { accessToken } = (0, run_command_1.getRunnerOptions)('default', nxJson, {}, true);
|
27
|
+
return accessToken;
|
28
|
+
}
|
@@ -13,7 +13,6 @@ const loader_1 = require("./loader");
|
|
13
13
|
const utils_1 = require("./utils");
|
14
14
|
const error_types_1 = require("../error-types");
|
15
15
|
const native_1 = require("../../native");
|
16
|
-
const os_1 = require("os");
|
17
16
|
class LoadedNxPlugin {
|
18
17
|
constructor(plugin, pluginDefinition) {
|
19
18
|
this.name = plugin.name;
|
@@ -72,12 +71,24 @@ exports.LoadedNxPlugin = LoadedNxPlugin;
|
|
72
71
|
// Allows loaded plugins to not be reloaded when
|
73
72
|
// referenced multiple times.
|
74
73
|
exports.nxPluginCache = new Map();
|
74
|
+
function isIsolationEnabled() {
|
75
|
+
// Explicitly enabled, regardless of further conditions
|
76
|
+
if (process.env.NX_ISOLATE_PLUGINS === 'true') {
|
77
|
+
return true;
|
78
|
+
}
|
79
|
+
if (
|
80
|
+
// Explicitly disabled
|
81
|
+
process.env.NX_ISOLATE_PLUGINS === 'false' ||
|
82
|
+
// Isolation is disabled on WASM builds currently.
|
83
|
+
native_1.IS_WASM) {
|
84
|
+
return false;
|
85
|
+
}
|
86
|
+
// Default value
|
87
|
+
return true;
|
88
|
+
}
|
75
89
|
async function loadNxPlugins(plugins, root = workspace_root_1.workspaceRoot) {
|
76
90
|
performance.mark('loadNxPlugins:start');
|
77
|
-
const loadingMethod =
|
78
|
-
(!native_1.IS_WASM &&
|
79
|
-
(0, os_1.platform)() !== 'win32' &&
|
80
|
-
process.env.NX_ISOLATE_PLUGINS !== 'false')
|
91
|
+
const loadingMethod = isIsolationEnabled()
|
81
92
|
? isolation_1.loadNxPluginInIsolation
|
82
93
|
: loader_1.loadNxPlugin;
|
83
94
|
plugins = await normalizePlugins(plugins, root);
|
@@ -106,7 +106,11 @@ export interface PluginWorkerProcessProjectGraphResult {
|
|
106
106
|
tx: string;
|
107
107
|
};
|
108
108
|
}
|
109
|
-
export
|
109
|
+
export interface PluginWorkerShutdownMessage {
|
110
|
+
type: 'shutdown';
|
111
|
+
payload: {};
|
112
|
+
}
|
113
|
+
export type PluginWorkerMessage = PluginWorkerLoadMessage | PluginWorkerShutdownMessage | PluginWorkerCreateNodesMessage | PluginCreateDependenciesMessage | PluginWorkerProcessProjectGraphMessage | PluginCreateMetadataMessage;
|
110
114
|
export type PluginWorkerResult = PluginWorkerLoadResult | PluginWorkerCreateNodesResult | PluginCreateDependenciesResult | PluginWorkerProcessProjectGraphResult | PluginCreateMetadataResult;
|
111
115
|
export declare function isPluginWorkerMessage(message: Serializable): message is PluginWorkerMessage;
|
112
116
|
export declare function isPluginWorkerResult(message: Serializable): message is PluginWorkerResult;
|
@@ -29,8 +29,8 @@ async function loadRemoteNxPlugin(plugin, root) {
|
|
29
29
|
const exitHandler = createWorkerExitHandler(worker, pendingPromises);
|
30
30
|
const cleanupFunction = () => {
|
31
31
|
worker.off('exit', exitHandler);
|
32
|
+
shutdownPluginWorker(socket);
|
32
33
|
socket.destroy();
|
33
|
-
shutdownPluginWorker(worker);
|
34
34
|
nxPluginWorkerCache.delete(cacheKey);
|
35
35
|
};
|
36
36
|
cleanupFunctions.add(cleanupFunction);
|
@@ -55,11 +55,8 @@ async function loadRemoteNxPlugin(plugin, root) {
|
|
55
55
|
nxPluginWorkerCache.set(cacheKey, pluginPromise);
|
56
56
|
return [pluginPromise, cleanupFunction];
|
57
57
|
}
|
58
|
-
function shutdownPluginWorker(
|
59
|
-
|
60
|
-
internal_api_1.nxPluginCache.clear();
|
61
|
-
// logger.verbose(`[plugin-pool] starting worker shutdown`);
|
62
|
-
worker.kill('SIGINT');
|
58
|
+
function shutdownPluginWorker(socket) {
|
59
|
+
(0, messaging_1.sendMessageOverSocket)(socket, { type: 'shutdown', payload: {} });
|
63
60
|
}
|
64
61
|
/**
|
65
62
|
* Creates a message handler for the given worker.
|
@@ -200,6 +197,7 @@ function createWorkerExitHandler(worker, pendingPromises) {
|
|
200
197
|
}
|
201
198
|
let cleanedUp = false;
|
202
199
|
const exitHandler = () => {
|
200
|
+
internal_api_1.nxPluginCache.clear();
|
203
201
|
for (const fn of cleanupFunctions) {
|
204
202
|
fn();
|
205
203
|
}
|
@@ -49,6 +49,21 @@ const server = (0, net_1.createServer)((socket) => {
|
|
49
49
|
};
|
50
50
|
}
|
51
51
|
},
|
52
|
+
shutdown: async () => {
|
53
|
+
// Stops accepting new connections, but existing connections are
|
54
|
+
// not closed immediately.
|
55
|
+
server.close(() => {
|
56
|
+
try {
|
57
|
+
(0, fs_1.unlinkSync)(socketPath);
|
58
|
+
}
|
59
|
+
catch (e) { }
|
60
|
+
process.exit(0);
|
61
|
+
});
|
62
|
+
// Closes existing connection.
|
63
|
+
socket.end();
|
64
|
+
// Destroys the socket once it's fully closed.
|
65
|
+
socket.destroySoon();
|
66
|
+
},
|
52
67
|
createNodes: async ({ configFiles, context, tx }) => {
|
53
68
|
try {
|
54
69
|
const result = await plugin.createNodes[1](configFiles, context);
|
@@ -37,6 +37,7 @@ export type ConfigurationResult = {
|
|
37
37
|
*/
|
38
38
|
export declare function createProjectConfigurations(root: string, nxJson: NxJsonConfiguration, projectFiles: string[], // making this parameter allows devkit to pick up newly created projects
|
39
39
|
plugins: LoadedNxPlugin[]): Promise<ConfigurationResult>;
|
40
|
+
export declare function findMatchingConfigFiles(projectFiles: string[], pattern: string, include: string[], exclude: string[]): string[];
|
40
41
|
export declare function readProjectConfigurationsFromRootMap(projectRootMap: Record<string, ProjectConfiguration>): Record<string, ProjectConfiguration>;
|
41
42
|
export declare function validateProject(project: ProjectConfiguration, knownProjects: Record<string, ProjectConfiguration>): void;
|
42
43
|
export declare function mergeTargetDefaultWithTargetDefinition(targetName: string, project: ProjectConfiguration, targetDefault: Partial<TargetConfiguration>, sourceMap: Record<string, SourceInformation>): TargetConfiguration;
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mergeProjectConfigurationIntoRootMap = mergeProjectConfigurationIntoRootMap;
|
4
4
|
exports.mergeMetadata = mergeMetadata;
|
5
5
|
exports.createProjectConfigurations = createProjectConfigurations;
|
6
|
+
exports.findMatchingConfigFiles = findMatchingConfigFiles;
|
6
7
|
exports.readProjectConfigurationsFromRootMap = readProjectConfigurationsFromRootMap;
|
7
8
|
exports.validateProject = validateProject;
|
8
9
|
exports.mergeTargetDefaultWithTargetDefinition = mergeTargetDefaultWithTargetDefinition;
|
@@ -445,7 +446,7 @@ function normalizeTargets(project, sourceMaps, nxJsonConfiguration) {
|
|
445
446
|
project.targets[targetName] = normalizeTarget(project.targets[targetName], project);
|
446
447
|
const projectSourceMaps = sourceMaps[project.root];
|
447
448
|
const targetConfig = project.targets[targetName];
|
448
|
-
const targetDefaults = readTargetDefaultsForTarget(targetName, nxJsonConfiguration.targetDefaults, targetConfig.executor);
|
449
|
+
const targetDefaults = deepClone(readTargetDefaultsForTarget(targetName, nxJsonConfiguration.targetDefaults, targetConfig.executor));
|
449
450
|
// We only apply defaults if they exist
|
450
451
|
if (targetDefaults && isCompatibleTarget(targetConfig, targetDefaults)) {
|
451
452
|
project.targets[targetName] = mergeTargetDefaultWithTargetDefinition(targetName, project, normalizeTarget(targetDefaults, project), projectSourceMaps);
|
@@ -498,9 +499,12 @@ function targetDefaultShouldBeApplied(key, sourceMap) {
|
|
498
499
|
const [, plugin] = sourceInfo;
|
499
500
|
return !plugin?.startsWith('nx/');
|
500
501
|
}
|
502
|
+
function deepClone(obj) {
|
503
|
+
return JSON.parse(JSON.stringify(obj));
|
504
|
+
}
|
501
505
|
function mergeTargetDefaultWithTargetDefinition(targetName, project, targetDefault, sourceMap) {
|
502
506
|
const targetDefinition = project.targets[targetName] ?? {};
|
503
|
-
const result =
|
507
|
+
const result = deepClone(targetDefinition);
|
504
508
|
for (const key in targetDefault) {
|
505
509
|
switch (key) {
|
506
510
|
case 'options': {
|
@@ -318,7 +318,9 @@ function getTasksRunnerPath(runner, nxJson) {
|
|
318
318
|
// No runner prop in tasks runner options, check if access token is set.
|
319
319
|
nxJson.tasksRunnerOptions?.[runner]?.options?.accessToken ||
|
320
320
|
// Cloud access token specified in env var.
|
321
|
-
process.env.NX_CLOUD_ACCESS_TOKEN
|
321
|
+
process.env.NX_CLOUD_ACCESS_TOKEN ||
|
322
|
+
// Nx Cloud Id specified in nxJson
|
323
|
+
nxJson.nxCloudId;
|
322
324
|
return isCloudRunner ? 'nx-cloud' : require.resolve('./default-tasks-runner');
|
323
325
|
}
|
324
326
|
function getRunnerOptions(runner, nxJson, nxArgs, isCloudDefault) {
|
@@ -339,6 +341,9 @@ function getRunnerOptions(runner, nxJson, nxArgs, isCloudDefault) {
|
|
339
341
|
if (nxJson.nxCloudAccessToken && isCloudDefault) {
|
340
342
|
result.accessToken ??= nxJson.nxCloudAccessToken;
|
341
343
|
}
|
344
|
+
if (nxJson.nxCloudId && isCloudDefault) {
|
345
|
+
result.nxCloudId ??= nxJson.nxCloudId;
|
346
|
+
}
|
342
347
|
if (nxJson.nxCloudUrl && isCloudDefault) {
|
343
348
|
result.url ??= nxJson.nxCloudUrl;
|
344
349
|
}
|
@@ -29,6 +29,7 @@ export interface NxArgs {
|
|
29
29
|
nxIgnoreCycles?: boolean;
|
30
30
|
type?: string;
|
31
31
|
batch?: boolean;
|
32
|
+
excludeTaskDependencies?: boolean;
|
32
33
|
}
|
33
34
|
export declare function createOverrides(__overrides_unparsed__?: string[]): Record<string, any>;
|
34
35
|
export declare function splitArgsIntoNxArgsAndOverrides(args: {
|
@@ -6,12 +6,14 @@ exports.getNxCloudToken = getNxCloudToken;
|
|
6
6
|
function isNxCloudUsed(nxJson) {
|
7
7
|
return (!!process.env.NX_CLOUD_ACCESS_TOKEN ||
|
8
8
|
!!nxJson.nxCloudAccessToken ||
|
9
|
+
!!nxJson.nxCloudId ||
|
9
10
|
!!Object.values(nxJson.tasksRunnerOptions ?? {}).find((r) => r.runner == '@nrwl/nx-cloud' || r.runner == 'nx-cloud'));
|
10
11
|
}
|
11
12
|
function getNxCloudUrl(nxJson) {
|
12
13
|
const cloudRunner = Object.values(nxJson.tasksRunnerOptions ?? {}).find((r) => r.runner == '@nrwl/nx-cloud' || r.runner == 'nx-cloud');
|
13
14
|
if (!cloudRunner &&
|
14
|
-
!(nxJson.nxCloudAccessToken || process.env.NX_CLOUD_ACCESS_TOKEN)
|
15
|
+
!(nxJson.nxCloudAccessToken || process.env.NX_CLOUD_ACCESS_TOKEN) &&
|
16
|
+
!nxJson.nxCloudId)
|
15
17
|
throw new Error('nx-cloud runner not found in nx.json');
|
16
18
|
return cloudRunner?.options?.url ?? nxJson.nxCloudUrl ?? 'https://nx.app';
|
17
19
|
}
|
@@ -1,13 +1,6 @@
|
|
1
|
-
import {
|
1
|
+
import { ProjectConfiguration, ProjectMetadata, TargetConfiguration } from '../config/workspace-json-project-json';
|
2
2
|
import { PackageManagerCommands } from './package-manager';
|
3
|
-
export interface NxProjectPackageJsonConfiguration {
|
4
|
-
name?: string;
|
5
|
-
implicitDependencies?: string[];
|
6
|
-
tags?: string[];
|
7
|
-
namedInputs?: {
|
8
|
-
[inputName: string]: (string | InputDefinition)[];
|
9
|
-
};
|
10
|
-
targets?: Record<string, TargetConfiguration>;
|
3
|
+
export interface NxProjectPackageJsonConfiguration extends Partial<ProjectConfiguration> {
|
11
4
|
includedScripts?: string[];
|
12
5
|
}
|
13
6
|
export type ArrayPackageGroup = {
|
@@ -176,6 +176,7 @@ function getPackageManagerVersion(packageManager = detectPackageManager(), cwd =
|
|
176
176
|
version = (0, child_process_1.execSync)(`${packageManager} --version`, {
|
177
177
|
cwd,
|
178
178
|
encoding: 'utf-8',
|
179
|
+
windowsHide: true,
|
179
180
|
}).trim();
|
180
181
|
}
|
181
182
|
catch {
|
@@ -349,7 +350,10 @@ async function resolvePackageVersionUsingInstallation(packageName, version) {
|
|
349
350
|
const { dir, cleanup } = createTempNpmDirectory();
|
350
351
|
try {
|
351
352
|
const pmc = getPackageManagerCommand();
|
352
|
-
await execAsync(`${pmc.add} ${packageName}@${version}`, {
|
353
|
+
await execAsync(`${pmc.add} ${packageName}@${version}`, {
|
354
|
+
cwd: dir,
|
355
|
+
windowsHide: true,
|
356
|
+
});
|
353
357
|
const { packageJson } = (0, package_json_1.readModulePackageJson)(packageName, [dir]);
|
354
358
|
return packageJson.version;
|
355
359
|
}
|
@@ -372,7 +376,9 @@ async function packageRegistryView(pkg, version, args) {
|
|
372
376
|
*/
|
373
377
|
pm = 'npm';
|
374
378
|
}
|
375
|
-
const { stdout } = await execAsync(`${pm} view ${pkg}@${version} ${args}
|
379
|
+
const { stdout } = await execAsync(`${pm} view ${pkg}@${version} ${args}`, {
|
380
|
+
windowsHide: true,
|
381
|
+
});
|
376
382
|
return stdout.toString().trim();
|
377
383
|
}
|
378
384
|
async function packageRegistryPack(cwd, pkg, version) {
|
@@ -389,7 +395,10 @@ async function packageRegistryPack(cwd, pkg, version) {
|
|
389
395
|
*/
|
390
396
|
pm = 'npm';
|
391
397
|
}
|
392
|
-
const { stdout } = await execAsync(`${pm} pack ${pkg}@${version}`, {
|
398
|
+
const { stdout } = await execAsync(`${pm} pack ${pkg}@${version}`, {
|
399
|
+
cwd,
|
400
|
+
windowsHide: true,
|
401
|
+
});
|
393
402
|
const tarballPath = stdout.trim();
|
394
403
|
return { tarballPath };
|
395
404
|
}
|