nx 20.0.0-beta.4 → 20.0.0-beta.6
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.json +12 -2
- package/migrations.json +0 -37
- package/package.json +12 -13
- package/src/command-line/release/index.d.ts +5 -2
- package/src/command-line/release/publish.d.ts +6 -1
- package/src/command-line/release/publish.js +31 -25
- package/src/command-line/release/utils/print-changes.js +6 -4
- package/src/command-line/release/utils/resolve-nx-json-error-message.js +4 -3
- package/src/command-line/release/version.d.ts +3 -3
- package/src/config/workspace-json-project-json.d.ts +14 -0
- package/src/core/graph/main.js +1 -1
- package/src/daemon/server/handle-hash-tasks.js +1 -1
- package/src/executors/run-commands/run-commands.impl.js +15 -22
- package/src/hasher/create-task-hasher.js +1 -1
- package/src/hasher/task-hasher.d.ts +2 -6
- package/src/hasher/task-hasher.js +6 -32
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/utilities/axios.js +1 -2
- package/src/nx-cloud/utilities/onboarding.js +2 -2
- package/src/nx-cloud/utilities/url-shorten.js +5 -5
- package/src/project-graph/file-utils.d.ts +2 -2
- package/src/project-graph/file-utils.js +2 -2
- package/src/tasks-runner/cache.d.ts +1 -2
- package/src/tasks-runner/cache.js +4 -4
- package/src/tasks-runner/create-task-graph.d.ts +2 -0
- package/src/tasks-runner/create-task-graph.js +35 -1
- package/src/tasks-runner/task-orchestrator.js +1 -1
- package/src/utils/git-utils.js +2 -2
- package/src/utils/plugins/output.js +1 -1
- package/src/hasher/node-task-hasher-impl.d.ts +0 -48
- package/src/hasher/node-task-hasher-impl.js +0 -449
- package/src/migrations/update-15-0-0/prefix-outputs.d.ts +0 -2
- package/src/migrations/update-15-0-0/prefix-outputs.js +0 -49
- package/src/migrations/update-16-0-0/remove-nrwl-cli.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-nrwl-cli.js +0 -16
- package/src/migrations/update-16-0-0/update-depends-on-to-tokens.d.ts +0 -2
- package/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +0 -97
- package/src/migrations/update-16-0-0/update-nx-cloud-runner.d.ts +0 -2
- package/src/migrations/update-16-0-0/update-nx-cloud-runner.js +0 -29
- package/src/migrations/update-16-2-0/remove-run-commands-output-path.d.ts +0 -2
- package/src/migrations/update-16-2-0/remove-run-commands-output-path.js +0 -45
- package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.d.ts +0 -12
- package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.js +0 -67
@@ -25,7 +25,7 @@ async function handleHashTasks(payload) {
|
|
25
25
|
const nxJson = (0, configuration_1.readNxJson)();
|
26
26
|
if (projectGraph !== storedProjectGraph) {
|
27
27
|
storedProjectGraph = projectGraph;
|
28
|
-
storedHasher = new task_hasher_1.InProcessTaskHasher(
|
28
|
+
storedHasher = new task_hasher_1.InProcessTaskHasher(projectGraph, nxJson, rustReferences, payload.runnerOptions);
|
29
29
|
}
|
30
30
|
const response = JSON.stringify(await storedHasher.hashTasks(payload.tasks, payload.taskGraph, payload.env));
|
31
31
|
return {
|
@@ -16,22 +16,11 @@ let pseudoTerminal;
|
|
16
16
|
const childProcesses = new Set();
|
17
17
|
function loadEnvVarsFile(path, env = {}) {
|
18
18
|
(0, task_env_1.unloadDotEnvFile)(path, env);
|
19
|
-
const result = (0, task_env_1.loadAndExpandDotEnvFile)(path, env
|
19
|
+
const result = (0, task_env_1.loadAndExpandDotEnvFile)(path, env);
|
20
20
|
if (result.error) {
|
21
21
|
throw result.error;
|
22
22
|
}
|
23
23
|
}
|
24
|
-
function loadEnvVars(path, env = {}) {
|
25
|
-
if (path) {
|
26
|
-
loadEnvVarsFile(path, env);
|
27
|
-
}
|
28
|
-
else {
|
29
|
-
try {
|
30
|
-
loadEnvVarsFile('.env', env);
|
31
|
-
}
|
32
|
-
catch { }
|
33
|
-
}
|
34
|
-
}
|
35
24
|
const propKeys = [
|
36
25
|
'command',
|
37
26
|
'commands',
|
@@ -292,20 +281,24 @@ function calculateCwd(cwd, context) {
|
|
292
281
|
return cwd;
|
293
282
|
return path.join(context.root, cwd);
|
294
283
|
}
|
295
|
-
|
296
|
-
|
297
|
-
|
284
|
+
/**
|
285
|
+
* Env variables are processed in the following order:
|
286
|
+
* - env option from executor options
|
287
|
+
* - env file from envFile option if provided
|
288
|
+
* - local env variables
|
289
|
+
*/
|
290
|
+
function processEnv(color, cwd, envOptionFromExecutor, envFile) {
|
291
|
+
let localEnv = (0, npm_run_path_1.env)({ cwd: cwd ?? process.cwd() });
|
292
|
+
localEnv = {
|
298
293
|
...process.env,
|
299
294
|
...localEnv,
|
300
295
|
};
|
301
|
-
|
302
|
-
|
303
|
-
loadEnvVars(envFile, res);
|
296
|
+
if (process.env.NX_LOAD_DOT_ENV_FILES !== 'false' && envFile) {
|
297
|
+
loadEnvVarsFile(envFile, localEnv);
|
304
298
|
}
|
305
|
-
|
306
|
-
|
307
|
-
...
|
308
|
-
...env,
|
299
|
+
let res = {
|
300
|
+
...localEnv,
|
301
|
+
...envOptionFromExecutor,
|
309
302
|
};
|
310
303
|
// need to override PATH to make sure we are using the local node_modules
|
311
304
|
if (localEnv.PATH)
|
@@ -10,6 +10,6 @@ function createTaskHasher(projectGraph, nxJson, runnerOptions) {
|
|
10
10
|
}
|
11
11
|
else {
|
12
12
|
const { fileMap, allWorkspaceFiles, rustReferences } = (0, build_project_graph_1.getFileMap)();
|
13
|
-
return new task_hasher_1.InProcessTaskHasher(
|
13
|
+
return new task_hasher_1.InProcessTaskHasher(projectGraph, nxJson, rustReferences, runnerOptions);
|
14
14
|
}
|
15
15
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { FileData,
|
1
|
+
import { FileData, ProjectGraph, ProjectGraphProjectNode } from '../config/project-graph';
|
2
2
|
import { NxJsonConfiguration } from '../config/nx-json';
|
3
3
|
import { Task, TaskGraph } from '../config/task-graph';
|
4
4
|
import { DaemonClient } from '../daemon/client/client';
|
@@ -66,16 +66,12 @@ export declare class DaemonBasedTaskHasher implements TaskHasher {
|
|
66
66
|
hashTask(task: Task, taskGraph?: TaskGraph, env?: NodeJS.ProcessEnv): Promise<Hash>;
|
67
67
|
}
|
68
68
|
export declare class InProcessTaskHasher implements TaskHasher {
|
69
|
-
private readonly projectFileMap;
|
70
|
-
private readonly allWorkspaceFiles;
|
71
69
|
private readonly projectGraph;
|
72
70
|
private readonly nxJson;
|
73
71
|
private readonly externalRustReferences;
|
74
72
|
private readonly options;
|
75
|
-
static version: string;
|
76
73
|
private taskHasher;
|
77
|
-
|
78
|
-
constructor(projectFileMap: ProjectFileMap, allWorkspaceFiles: FileData[], projectGraph: ProjectGraph, nxJson: NxJsonConfiguration, externalRustReferences: NxWorkspaceFilesExternals | null, options: any);
|
74
|
+
constructor(projectGraph: ProjectGraph, nxJson: NxJsonConfiguration, externalRustReferences: NxWorkspaceFilesExternals | null, options: any);
|
79
75
|
hashTasks(tasks: Task[], taskGraph?: TaskGraph, env?: NodeJS.ProcessEnv): Promise<Hash[]>;
|
80
76
|
hashTask(task: Task, taskGraph?: TaskGraph, env?: NodeJS.ProcessEnv): Promise<Hash>;
|
81
77
|
private createHashDetails;
|
@@ -11,7 +11,6 @@ exports.expandSingleProjectInputs = expandSingleProjectInputs;
|
|
11
11
|
exports.expandNamedInput = expandNamedInput;
|
12
12
|
exports.filterUsingGlobPatterns = filterUsingGlobPatterns;
|
13
13
|
const file_hasher_1 = require("./file-hasher");
|
14
|
-
const node_task_hasher_impl_1 = require("./node-task-hasher-impl");
|
15
14
|
const minimatch_1 = require("minimatch");
|
16
15
|
const native_task_hasher_impl_1 = require("./native-task-hasher-impl");
|
17
16
|
const workspace_root_1 = require("../utils/workspace-root");
|
@@ -29,42 +28,18 @@ class DaemonBasedTaskHasher {
|
|
29
28
|
}
|
30
29
|
exports.DaemonBasedTaskHasher = DaemonBasedTaskHasher;
|
31
30
|
class InProcessTaskHasher {
|
32
|
-
constructor(
|
33
|
-
this.projectFileMap = projectFileMap;
|
34
|
-
this.allWorkspaceFiles = allWorkspaceFiles;
|
31
|
+
constructor(projectGraph, nxJson, externalRustReferences, options) {
|
35
32
|
this.projectGraph = projectGraph;
|
36
33
|
this.nxJson = nxJson;
|
37
34
|
this.externalRustReferences = externalRustReferences;
|
38
35
|
this.options = options;
|
39
|
-
this.
|
40
|
-
|
41
|
-
|
42
|
-
: []).map((r) => ({ runtime: r }));
|
43
|
-
if (process.env.NX_CLOUD_ENCRYPTION_KEY) {
|
44
|
-
legacyRuntimeInputs.push({ env: 'NX_CLOUD_ENCRYPTION_KEY' });
|
45
|
-
}
|
46
|
-
const legacyFilesetInputs = [
|
47
|
-
'nx.json',
|
48
|
-
// ignore files will change the set of inputs to the hasher
|
49
|
-
'.gitignore',
|
50
|
-
'.nxignore',
|
51
|
-
].map((d) => ({ fileset: `{workspaceRoot}/${d}` }));
|
52
|
-
this.taskHasher = !this.useNativeTaskHasher
|
53
|
-
? new node_task_hasher_impl_1.NodeTaskHasherImpl(nxJson, legacyRuntimeInputs, legacyFilesetInputs, this.projectFileMap, this.allWorkspaceFiles, this.projectGraph, {
|
54
|
-
selectivelyHashTsConfig: this.options?.selectivelyHashTsConfig ?? false,
|
55
|
-
})
|
56
|
-
: new native_task_hasher_impl_1.NativeTaskHasherImpl(workspace_root_1.workspaceRoot, nxJson, this.projectGraph, this.externalRustReferences, {
|
57
|
-
selectivelyHashTsConfig: this.options?.selectivelyHashTsConfig ?? false,
|
58
|
-
});
|
36
|
+
this.taskHasher = new native_task_hasher_impl_1.NativeTaskHasherImpl(workspace_root_1.workspaceRoot, this.nxJson, this.projectGraph, this.externalRustReferences, {
|
37
|
+
selectivelyHashTsConfig: this.options?.selectivelyHashTsConfig ?? false,
|
38
|
+
});
|
59
39
|
}
|
60
40
|
async hashTasks(tasks, taskGraph, env) {
|
61
|
-
|
62
|
-
|
63
|
-
return tasks.map((task, index) => this.createHashDetails(task, hashes[index]));
|
64
|
-
}
|
65
|
-
else {
|
66
|
-
return await Promise.all(tasks.map((t) => this.hashTask(t, taskGraph, env)));
|
67
|
-
}
|
41
|
+
const hashes = await this.taskHasher.hashTasks(tasks, taskGraph, env ?? process.env);
|
42
|
+
return tasks.map((task, index) => this.createHashDetails(task, hashes[index]));
|
68
43
|
}
|
69
44
|
async hashTask(task, taskGraph, env) {
|
70
45
|
const res = await this.taskHasher.hashTask(task, taskGraph, env ?? process.env);
|
@@ -98,7 +73,6 @@ class InProcessTaskHasher {
|
|
98
73
|
}
|
99
74
|
}
|
100
75
|
exports.InProcessTaskHasher = InProcessTaskHasher;
|
101
|
-
InProcessTaskHasher.version = '3.0';
|
102
76
|
const DEFAULT_INPUTS = [
|
103
77
|
{
|
104
78
|
fileset: '{projectRoot}/**/*',
|
Binary file
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createApiAxiosInstance = createApiAxiosInstance;
|
4
4
|
const path_1 = require("path");
|
5
5
|
const environment_1 = require("./environment");
|
6
|
-
const axios = require('axios');
|
7
6
|
function createApiAxiosInstance(options) {
|
8
7
|
let axiosConfigBuilder = (axiosConfig) => axiosConfig;
|
9
8
|
const baseUrl = process.env.NX_CLOUD_API || options.url || 'https://cloud.nx.app';
|
@@ -17,7 +16,7 @@ function createApiAxiosInstance(options) {
|
|
17
16
|
const { nxCloudProxyConfig } = require((0, path_1.join)(process.cwd(), options.customProxyConfigPath));
|
18
17
|
axiosConfigBuilder = nxCloudProxyConfig ?? axiosConfigBuilder;
|
19
18
|
}
|
20
|
-
return axios.create(axiosConfigBuilder({
|
19
|
+
return require('axios').create(axiosConfigBuilder({
|
21
20
|
baseURL: baseUrl,
|
22
21
|
timeout: environment_1.NX_CLOUD_NO_TIMEOUTS ? environment_1.UNLIMITED_TIMEOUT : 10000,
|
23
22
|
headers: { authorization: accessToken },
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createNxCloudOnboardingURLForWelcomeApp = createNxCloudOnboardingURLForWelcomeApp;
|
4
4
|
exports.getNxCloudAppOnBoardingUrl = getNxCloudAppOnBoardingUrl;
|
5
5
|
exports.readNxCloudToken = readNxCloudToken;
|
6
|
-
const devkit_exports_1 = require("../../devkit-exports");
|
7
6
|
const is_workspace_claimed_1 = require("./is-workspace-claimed");
|
8
7
|
const url_shorten_1 = require("./url-shorten");
|
9
8
|
const run_command_1 = require("../../tasks-runner/run-command");
|
9
|
+
const nx_json_1 = require("../../generators/utils/nx-json");
|
10
10
|
async function createNxCloudOnboardingURLForWelcomeApp(tree, token) {
|
11
11
|
token = token || readNxCloudToken(tree);
|
12
12
|
if (!token) {
|
@@ -22,7 +22,7 @@ async function getNxCloudAppOnBoardingUrl(token) {
|
|
22
22
|
return onboardingUrl;
|
23
23
|
}
|
24
24
|
function readNxCloudToken(tree) {
|
25
|
-
const nxJson = (0,
|
25
|
+
const nxJson = (0, nx_json_1.readNxJson)(tree);
|
26
26
|
const { accessToken, nxCloudId } = (0, run_command_1.getRunnerOptions)('default', nxJson, {}, true);
|
27
27
|
return accessToken || nxCloudId;
|
28
28
|
}
|
@@ -7,7 +7,7 @@ exports.getNxCloudVersion = getNxCloudVersion;
|
|
7
7
|
exports.removeVersionModifier = removeVersionModifier;
|
8
8
|
exports.versionIsValid = versionIsValid;
|
9
9
|
exports.compareCleanCloudVersions = compareCleanCloudVersions;
|
10
|
-
const
|
10
|
+
const logger_1 = require("../../utils/logger");
|
11
11
|
const git_utils_1 = require("../../utils/git-utils");
|
12
12
|
const get_cloud_options_1 = require("./get-cloud-options");
|
13
13
|
/**
|
@@ -27,7 +27,7 @@ async function createNxCloudOnboardingURL(onboardingSource, accessToken, usesGit
|
|
27
27
|
}
|
28
28
|
}
|
29
29
|
catch (e) {
|
30
|
-
|
30
|
+
logger_1.logger.verbose(`Failed to get Nx Cloud version.
|
31
31
|
${e}`);
|
32
32
|
return apiUrl;
|
33
33
|
}
|
@@ -46,7 +46,7 @@ async function createNxCloudOnboardingURL(onboardingSource, accessToken, usesGit
|
|
46
46
|
return `${apiUrl}/connect/${response.data}`;
|
47
47
|
}
|
48
48
|
catch (e) {
|
49
|
-
|
49
|
+
logger_1.logger.verbose(`Failed to shorten Nx Cloud URL.
|
50
50
|
${e}`);
|
51
51
|
return getURLifShortenFailed(usesGithub, githubSlug === 'github' ? null : githubSlug, apiUrl, source, accessToken);
|
52
52
|
}
|
@@ -96,7 +96,7 @@ async function getInstallationSupportsGitHub(apiUrl) {
|
|
96
96
|
}
|
97
97
|
catch (e) {
|
98
98
|
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
99
|
-
|
99
|
+
logger_1.logger.warn(`Failed to access system features. GitHub integration assumed to be disabled.
|
100
100
|
${e}`);
|
101
101
|
}
|
102
102
|
return false;
|
@@ -116,7 +116,7 @@ async function getNxCloudVersion(apiUrl) {
|
|
116
116
|
return version;
|
117
117
|
}
|
118
118
|
catch (e) {
|
119
|
-
|
119
|
+
logger_1.logger.verbose(`Failed to get version of Nx Cloud.
|
120
120
|
${e}`);
|
121
121
|
return null;
|
122
122
|
}
|
@@ -18,8 +18,8 @@ export declare function isDeletedFileChange(change: Change): change is DeletedFi
|
|
18
18
|
export declare function calculateFileChanges(files: string[], allWorkspaceFiles: FileData[], nxArgs?: NxArgs, readFileAtRevision?: (f: string, r: void | string) => string, ignore?: ReturnType<typeof ignore>): FileChange[];
|
19
19
|
export declare const TEN_MEGABYTES: number;
|
20
20
|
/**
|
21
|
-
* TODO(
|
22
|
-
* @deprecated To get projects use {@link retrieveProjectConfigurations} instead. This will be removed in
|
21
|
+
* TODO(v21): Remove this function
|
22
|
+
* @deprecated To get projects use {@link retrieveProjectConfigurations} instead. This will be removed in v21.
|
23
23
|
*/
|
24
24
|
export declare function readWorkspaceConfig(opts: {
|
25
25
|
format: 'angularCli' | 'nx';
|
@@ -101,8 +101,8 @@ function defaultReadFileAtRevision(file, revision) {
|
|
101
101
|
}
|
102
102
|
}
|
103
103
|
/**
|
104
|
-
* TODO(
|
105
|
-
* @deprecated To get projects use {@link retrieveProjectConfigurations} instead. This will be removed in
|
104
|
+
* TODO(v21): Remove this function
|
105
|
+
* @deprecated To get projects use {@link retrieveProjectConfigurations} instead. This will be removed in v21.
|
106
106
|
*/
|
107
107
|
function readWorkspaceConfig(opts) {
|
108
108
|
let configuration = null;
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { DefaultTasksRunnerOptions, RemoteCache } from './default-tasks-runner';
|
2
2
|
import { Task } from '../config/task-graph';
|
3
|
-
import { NxJsonConfiguration } from '../config/nx-json';
|
4
3
|
export type CachedResult = {
|
5
4
|
terminalOutput: string;
|
6
5
|
outputsPath: string;
|
@@ -11,7 +10,7 @@ export type TaskWithCachedResult = {
|
|
11
10
|
task: Task;
|
12
11
|
cachedResult: CachedResult;
|
13
12
|
};
|
14
|
-
export declare function getCache(
|
13
|
+
export declare function getCache(options: DefaultTasksRunnerOptions): DbCache | Cache;
|
15
14
|
export declare class DbCache {
|
16
15
|
private readonly options;
|
17
16
|
private cache;
|
@@ -19,14 +19,14 @@ const update_manager_1 = require("../nx-cloud/update-manager");
|
|
19
19
|
const get_cloud_options_1 = require("../nx-cloud/utilities/get-cloud-options");
|
20
20
|
const is_ci_1 = require("../utils/is-ci");
|
21
21
|
const output_1 = require("../utils/output");
|
22
|
-
function
|
22
|
+
// Do not change the order of these arguments as this function is used by nx cloud
|
23
|
+
function getCache(options) {
|
24
|
+
const nxJson = (0, nx_json_1.readNxJson)();
|
23
25
|
return process.env.NX_DISABLE_DB !== 'true' &&
|
24
26
|
(nxJson.enableDbCache === true || process.env.NX_DB_CACHE === 'true')
|
25
27
|
? new DbCache({
|
26
28
|
// Remove this in Nx 21
|
27
|
-
nxCloudRemoteCache: (0, nx_cloud_utils_1.isNxCloudUsed)(
|
28
|
-
? options.remoteCache
|
29
|
-
: null,
|
29
|
+
nxCloudRemoteCache: (0, nx_cloud_utils_1.isNxCloudUsed)(nxJson) ? options.remoteCache : null,
|
30
30
|
})
|
31
31
|
: new Cache(options);
|
32
32
|
}
|
@@ -18,9 +18,11 @@ export declare class ProcessTasks {
|
|
18
18
|
private processTasksForMultipleProjects;
|
19
19
|
private processTasksForSingleProject;
|
20
20
|
private processTasksForDependencies;
|
21
|
+
private createDummyTask;
|
21
22
|
createTask(id: string, project: ProjectGraphProjectNode, target: string, resolvedConfiguration: string | undefined, overrides: Object): Task;
|
22
23
|
resolveConfiguration(project: ProjectGraphProjectNode, target: string, configuration: string | undefined): string;
|
23
24
|
getId(project: string, target: string, configuration: string | undefined): string;
|
25
|
+
private filterDummyTasks;
|
24
26
|
}
|
25
27
|
export declare function createTaskGraph(projectGraph: ProjectGraph, extraTargetDependencies: TargetDependencies, projectNames: string[], targets: string[], configuration: string | undefined, overrides: Object, excludeTaskDependencies?: boolean): TaskGraph;
|
26
28
|
export declare function mapTargetDefaultsToDependencies(defaults: TargetDefaults | undefined): TargetDependencies;
|
@@ -6,6 +6,7 @@ exports.mapTargetDefaultsToDependencies = mapTargetDefaultsToDependencies;
|
|
6
6
|
const utils_1 = require("./utils");
|
7
7
|
const project_graph_utils_1 = require("../utils/project-graph-utils");
|
8
8
|
const output_1 = require("../utils/output");
|
9
|
+
const DUMMY_TASK_TARGET = '__nx_dummy_task__';
|
9
10
|
class ProcessTasks {
|
10
11
|
constructor(extraTargetDependencies, projectGraph) {
|
11
12
|
this.extraTargetDependencies = extraTargetDependencies;
|
@@ -52,6 +53,7 @@ class ProcessTasks {
|
|
52
53
|
this.dependencies[d] = this.dependencies[d].filter((dd) => !!initialTasks[dd]);
|
53
54
|
}
|
54
55
|
}
|
56
|
+
this.filterDummyTasks();
|
55
57
|
for (const projectName of Object.keys(this.dependencies)) {
|
56
58
|
if (this.dependencies[projectName].length > 1) {
|
57
59
|
this.dependencies[projectName] = [
|
@@ -113,6 +115,9 @@ class ProcessTasks {
|
|
113
115
|
}
|
114
116
|
}
|
115
117
|
processTasksForDependencies(projectUsedToDeriveDependencies, dependencyConfig, configuration, task, taskOverrides, overrides) {
|
118
|
+
if (!this.projectGraph.dependencies.hasOwnProperty(projectUsedToDeriveDependencies)) {
|
119
|
+
return;
|
120
|
+
}
|
116
121
|
for (const dep of this.projectGraph.dependencies[projectUsedToDeriveDependencies]) {
|
117
122
|
const depProject = this.projectGraph.nodes[dep.target];
|
118
123
|
// this is to handle external dependencies
|
@@ -132,10 +137,20 @@ class ProcessTasks {
|
|
132
137
|
}
|
133
138
|
}
|
134
139
|
else {
|
135
|
-
this.
|
140
|
+
const dummyId = this.getId(depProject.name, DUMMY_TASK_TARGET, undefined);
|
141
|
+
this.dependencies[task.id].push(dummyId);
|
142
|
+
this.dependencies[dummyId] = [];
|
143
|
+
const noopTask = this.createDummyTask(dummyId, task);
|
144
|
+
this.processTask(noopTask, depProject.name, configuration, overrides);
|
136
145
|
}
|
137
146
|
}
|
138
147
|
}
|
148
|
+
createDummyTask(id, task) {
|
149
|
+
return {
|
150
|
+
...task,
|
151
|
+
id,
|
152
|
+
};
|
153
|
+
}
|
139
154
|
createTask(id, project, target, resolvedConfiguration, overrides) {
|
140
155
|
if (!project.data.targets[target]) {
|
141
156
|
throw new Error(`Cannot find configuration for task ${project.name}:${target}`);
|
@@ -173,6 +188,25 @@ class ProcessTasks {
|
|
173
188
|
}
|
174
189
|
return id;
|
175
190
|
}
|
191
|
+
filterDummyTasks() {
|
192
|
+
for (const [key, deps] of Object.entries(this.dependencies)) {
|
193
|
+
const normalizedDeps = [];
|
194
|
+
for (const dep of deps) {
|
195
|
+
if (dep.endsWith(DUMMY_TASK_TARGET)) {
|
196
|
+
normalizedDeps.push(...this.dependencies[dep].filter((d) => !d.endsWith(DUMMY_TASK_TARGET)));
|
197
|
+
}
|
198
|
+
else {
|
199
|
+
normalizedDeps.push(dep);
|
200
|
+
}
|
201
|
+
}
|
202
|
+
this.dependencies[key] = normalizedDeps;
|
203
|
+
}
|
204
|
+
for (const key of Object.keys(this.dependencies)) {
|
205
|
+
if (key.endsWith(DUMMY_TASK_TARGET)) {
|
206
|
+
delete this.dependencies[key];
|
207
|
+
}
|
208
|
+
}
|
209
|
+
}
|
176
210
|
}
|
177
211
|
exports.ProcessTasks = ProcessTasks;
|
178
212
|
function createTaskGraph(projectGraph, extraTargetDependencies, projectNames, targets, configuration, overrides, excludeTaskDependencies = false) {
|
@@ -28,7 +28,7 @@ class TaskOrchestrator {
|
|
28
28
|
this.daemon = daemon;
|
29
29
|
this.outputStyle = outputStyle;
|
30
30
|
this.taskDetails = (0, hash_task_1.getTaskDetails)();
|
31
|
-
this.cache = (0, cache_1.getCache)(this.
|
31
|
+
this.cache = (0, cache_1.getCache)(this.options);
|
32
32
|
this.forkedProcessTaskRunner = new forked_process_task_runner_1.ForkedProcessTaskRunner(this.options);
|
33
33
|
this.tasksSchedule = new tasks_schedule_1.TasksSchedule(this.projectGraph, this.taskGraph, this.options);
|
34
34
|
// region internal state
|
package/src/utils/git-utils.js
CHANGED
@@ -8,7 +8,7 @@ exports.commitChanges = commitChanges;
|
|
8
8
|
exports.getLatestCommitSha = getLatestCommitSha;
|
9
9
|
const child_process_1 = require("child_process");
|
10
10
|
const path_1 = require("path");
|
11
|
-
const
|
11
|
+
const logger_1 = require("./logger");
|
12
12
|
function execAsync(command, execOptions) {
|
13
13
|
return new Promise((res, rej) => {
|
14
14
|
(0, child_process_1.exec)(command, execOptions, (err, stdout, stderr) => {
|
@@ -236,7 +236,7 @@ function commitChanges(commitMessage, directory) {
|
|
236
236
|
// We don't want to throw during create-nx-workspace
|
237
237
|
// because maybe there was an error when setting up git
|
238
238
|
// initially.
|
239
|
-
|
239
|
+
logger_1.logger.verbose(`Git may not be set up correctly for this new workspace.
|
240
240
|
${err}`);
|
241
241
|
}
|
242
242
|
else {
|
@@ -47,7 +47,7 @@ function listAlsoAvailableCorePlugins(installedPlugins) {
|
|
47
47
|
}
|
48
48
|
}
|
49
49
|
function listPowerpackPlugins() {
|
50
|
-
const powerpackLink = 'https://nx.dev/plugin-registry';
|
50
|
+
const powerpackLink = 'https://nx.dev/plugin-registry#powerpack';
|
51
51
|
output_1.output.log({
|
52
52
|
title: `Available Powerpack Plugins: ${powerpackLink}`,
|
53
53
|
});
|
@@ -1,48 +0,0 @@
|
|
1
|
-
import { NxJsonConfiguration } from '../config/nx-json';
|
2
|
-
import { FileData, ProjectFileMap, ProjectGraph } from '../config/project-graph';
|
3
|
-
import { Task, TaskGraph } from '../config/task-graph';
|
4
|
-
import { PartialHash, TaskHasherImpl } from './task-hasher';
|
5
|
-
export declare class NodeTaskHasherImpl implements TaskHasherImpl {
|
6
|
-
private readonly nxJson;
|
7
|
-
private readonly legacyRuntimeInputs;
|
8
|
-
private readonly legacyFilesetInputs;
|
9
|
-
private readonly projectFileMap;
|
10
|
-
private readonly allWorkspaceFiles;
|
11
|
-
private readonly projectGraph;
|
12
|
-
private readonly options;
|
13
|
-
private filesetHashes;
|
14
|
-
private runtimeHashes;
|
15
|
-
private externalDependencyHashes;
|
16
|
-
private allExternalDependenciesHash;
|
17
|
-
private projectRootMappings;
|
18
|
-
constructor(nxJson: NxJsonConfiguration, legacyRuntimeInputs: {
|
19
|
-
runtime: string;
|
20
|
-
}[], legacyFilesetInputs: {
|
21
|
-
fileset: string;
|
22
|
-
}[], projectFileMap: ProjectFileMap, allWorkspaceFiles: FileData[], projectGraph: ProjectGraph, options: {
|
23
|
-
selectivelyHashTsConfig: boolean;
|
24
|
-
});
|
25
|
-
hashTasks(tasks: Task[], taskGraph: TaskGraph, env: NodeJS.ProcessEnv): Promise<PartialHash[]>;
|
26
|
-
hashTask(task: Task, taskGraph: TaskGraph, env: NodeJS.ProcessEnv, visited?: string[]): Promise<PartialHash>;
|
27
|
-
private hashNamedInputForDependencies;
|
28
|
-
private hashSelfAndDepsInputs;
|
29
|
-
private combinePartialHashes;
|
30
|
-
private hashDepsInputs;
|
31
|
-
private hashDepsOutputs;
|
32
|
-
private hashDepOuputs;
|
33
|
-
private hashFiles;
|
34
|
-
private getExternalDependencyHash;
|
35
|
-
private hashSingleExternalDependency;
|
36
|
-
private hashExternalDependency;
|
37
|
-
private hashTarget;
|
38
|
-
private findExternalDependencyNodeName;
|
39
|
-
private hashSingleProjectInputs;
|
40
|
-
private hashProjectInputs;
|
41
|
-
private hashRootFilesets;
|
42
|
-
private hashProjectConfig;
|
43
|
-
private hashTsConfig;
|
44
|
-
private hashProjectFileset;
|
45
|
-
private hashRuntime;
|
46
|
-
private hashEnv;
|
47
|
-
private calculateExternalDependencyHashes;
|
48
|
-
}
|