nx 19.8.3 → 19.8.5

Sign up to get free protection for your applications and to get access to all the features.
package/.eslintrc.json CHANGED
@@ -9,8 +9,18 @@
9
9
  "no-restricted-imports": [
10
10
  "error",
11
11
  {
12
- "name": "fs-extra",
13
- "message": "Please use equivalent utilities from `node:fs` instead."
12
+ "paths": [
13
+ {
14
+ "name": "fs-extra",
15
+ "message": "Please use equivalent utilities from `node:fs` instead."
16
+ }
17
+ ],
18
+ "patterns": [
19
+ {
20
+ "group": ["**/devkit-exports"],
21
+ "message": "Do not import from devkit-exports from the nx package"
22
+ }
23
+ ]
14
24
  }
15
25
  ]
16
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "19.8.3",
3
+ "version": "19.8.5",
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": {
@@ -67,7 +67,7 @@
67
67
  "yargs-parser": "21.1.1",
68
68
  "node-machine-id": "1.1.12",
69
69
  "ora": "5.3.0",
70
- "@nrwl/tao": "19.8.3"
70
+ "@nrwl/tao": "19.8.5"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "@swc-node/register": "^1.8.0",
@@ -82,16 +82,16 @@
82
82
  }
83
83
  },
84
84
  "optionalDependencies": {
85
- "@nx/nx-darwin-x64": "19.8.3",
86
- "@nx/nx-darwin-arm64": "19.8.3",
87
- "@nx/nx-linux-x64-gnu": "19.8.3",
88
- "@nx/nx-linux-x64-musl": "19.8.3",
89
- "@nx/nx-win32-x64-msvc": "19.8.3",
90
- "@nx/nx-linux-arm64-gnu": "19.8.3",
91
- "@nx/nx-linux-arm64-musl": "19.8.3",
92
- "@nx/nx-linux-arm-gnueabihf": "19.8.3",
93
- "@nx/nx-win32-arm64-msvc": "19.8.3",
94
- "@nx/nx-freebsd-x64": "19.8.3"
85
+ "@nx/nx-darwin-x64": "19.8.5",
86
+ "@nx/nx-darwin-arm64": "19.8.5",
87
+ "@nx/nx-linux-x64-gnu": "19.8.5",
88
+ "@nx/nx-linux-x64-musl": "19.8.5",
89
+ "@nx/nx-win32-x64-msvc": "19.8.5",
90
+ "@nx/nx-linux-arm64-gnu": "19.8.5",
91
+ "@nx/nx-linux-arm64-musl": "19.8.5",
92
+ "@nx/nx-linux-arm-gnueabihf": "19.8.5",
93
+ "@nx/nx-win32-arm64-msvc": "19.8.5",
94
+ "@nx/nx-freebsd-x64": "19.8.5"
95
95
  },
96
96
  "nx-migrations": {
97
97
  "migrations": "./migrations.json",
@@ -103,8 +103,8 @@ async function initializePlugin(pkgName, options, nxJson) {
103
103
  if (options.__overrides_unparsed__.length) {
104
104
  args.push(...options.__overrides_unparsed__);
105
105
  }
106
- await (0, child_process_2.runNxAsync)(`g ${pkgName}:${initGenerator} ${args.join(' ')}`, {
107
- silent: !options.verbose,
106
+ (0, child_process_2.runNxSync)(`g ${pkgName}:${initGenerator} ${args.join(' ')}`, {
107
+ stdio: [0, 1, 2],
108
108
  });
109
109
  }
110
110
  catch (e) {
@@ -29,6 +29,7 @@ const command_object_23 = require("./login/command-object");
29
29
  const command_object_24 = require("./logout/command-object");
30
30
  const command_objects_1 = require("./deprecated/command-objects");
31
31
  const command_object_25 = require("./sync/command-object");
32
+ const output_1 = require("../utils/output");
32
33
  // Ensure that the output takes up the available width of the terminal.
33
34
  yargs.wrap(yargs.terminalWidth());
34
35
  exports.parserConfiguration = {
@@ -82,26 +83,46 @@ exports.commandsObject = yargs
82
83
  .command(command_object_23.yargsLoginCommand)
83
84
  .command(command_object_24.yargsLogoutCommand)
84
85
  .command(resolveConformanceCommandObject())
86
+ .command(resolveConformanceCheckCommandObject())
85
87
  .scriptName('nx')
86
88
  .help()
87
89
  // NOTE: we handle --version in nx.ts, this just tells yargs that the option exists
88
90
  // so that it shows up in help. The default yargs implementation of --version is not
89
91
  // hit, as the implementation in nx.ts is hit first and calls process.exit(0).
90
92
  .version();
93
+ function createMissingConformanceCommand(command) {
94
+ return {
95
+ command,
96
+ // Hide from --help output in the common case of not having the plugin installed
97
+ describe: false,
98
+ handler: () => {
99
+ output_1.output.error({
100
+ title: `${command} is not available`,
101
+ bodyLines: [
102
+ `In order to use the \`nx ${command}\` command you must have an active Powerpack license and the \`@nx/powerpack-conformance\` plugin installed.`,
103
+ '',
104
+ 'To learn more, visit https://nx.dev/features/powerpack/conformance',
105
+ ],
106
+ });
107
+ process.exit(1);
108
+ },
109
+ };
110
+ }
91
111
  function resolveConformanceCommandObject() {
92
112
  try {
93
113
  const { yargsConformanceCommand } = require('@nx/powerpack-conformance');
94
114
  return yargsConformanceCommand;
95
115
  }
96
- catch (e) {
97
- return {
98
- command: 'conformance',
99
- // Hide from --help output in the common case of not having the plugin installed
100
- describe: false,
101
- handler: () => {
102
- // TODO: Add messaging to help with learning more about powerpack and conformance
103
- process.exit(1);
104
- },
105
- };
116
+ catch {
117
+ return createMissingConformanceCommand('conformance');
118
+ }
119
+ }
120
+ function resolveConformanceCheckCommandObject() {
121
+ try {
122
+ const { yargsConformanceCheckCommand, } = require('@nx/powerpack-conformance');
123
+ return yargsConformanceCheckCommand;
124
+ }
125
+ catch {
126
+ return createMissingConformanceCommand('conformance:check');
106
127
  }
107
128
  }
@@ -5,8 +5,10 @@ exports.printAndFlushChanges = printAndFlushChanges;
5
5
  const chalk = require("chalk");
6
6
  const jest_diff_1 = require("jest-diff");
7
7
  const node_fs_1 = require("node:fs");
8
- const devkit_exports_1 = require("../../../devkit-exports");
9
8
  const tree_1 = require("../../../generators/tree");
9
+ const workspace_root_1 = require("../../../utils/workspace-root");
10
+ const path_1 = require("../../../utils/path");
11
+ const logger_1 = require("../../../utils/logger");
10
12
  // jest-diff does not export this constant
11
13
  const NO_DIFF_MESSAGE = 'Compared values have no visual difference.';
12
14
  function printDiff(before, after, contextLines = 1, noDiffMessage = NO_DIFF_MESSAGE) {
@@ -43,7 +45,7 @@ function printAndFlushChanges(tree, isDryRun, diffContextLines = 1, shouldPrintD
43
45
  }
44
46
  else if (f.type === 'UPDATE') {
45
47
  console.error(`${chalk.white('UPDATE')} ${f.path}${isDryRun ? chalk.keyword('orange')(' [dry-run]') : ''}`);
46
- const currentContentsOnDisk = (0, node_fs_1.readFileSync)((0, devkit_exports_1.joinPathFragments)(tree.root, f.path)).toString();
48
+ const currentContentsOnDisk = (0, node_fs_1.readFileSync)((0, path_1.joinPathFragments)(tree.root, f.path)).toString();
47
49
  printDiff(currentContentsOnDisk, f.content?.toString() || '', diffContextLines, noDiffMessage);
48
50
  }
49
51
  else if (f.type === 'DELETE') {
@@ -51,9 +53,9 @@ function printAndFlushChanges(tree, isDryRun, diffContextLines = 1, shouldPrintD
51
53
  }
52
54
  });
53
55
  if (!isDryRun) {
54
- (0, tree_1.flushChanges)(devkit_exports_1.workspaceRoot, changes);
56
+ (0, tree_1.flushChanges)(workspace_root_1.workspaceRoot, changes);
55
57
  }
56
58
  if (isDryRun && shouldPrintDryRunMessage) {
57
- devkit_exports_1.logger.warn(`\nNOTE: The "dryRun" flag means no changes were made.`);
59
+ logger_1.logger.warn(`\nNOTE: The "dryRun" flag means no changes were made.`);
58
60
  }
59
61
  }
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveNxJsonConfigErrorMessage = resolveNxJsonConfigErrorMessage;
4
4
  const node_fs_1 = require("node:fs");
5
5
  const node_path_1 = require("node:path");
6
- const devkit_exports_1 = require("../../../devkit-exports");
6
+ const path_1 = require("../../../utils/path");
7
+ const workspace_root_1 = require("../../../utils/workspace-root");
7
8
  async function resolveNxJsonConfigErrorMessage(propPath) {
8
- const errorLines = await getJsonConfigLinesForErrorMessage((0, node_fs_1.readFileSync)((0, devkit_exports_1.joinPathFragments)(devkit_exports_1.workspaceRoot, 'nx.json'), 'utf-8'), propPath);
9
- let nxJsonMessage = `The relevant config is defined here: ${(0, node_path_1.relative)(process.cwd(), (0, devkit_exports_1.joinPathFragments)(devkit_exports_1.workspaceRoot, 'nx.json'))}`;
9
+ const errorLines = await getJsonConfigLinesForErrorMessage((0, node_fs_1.readFileSync)((0, path_1.joinPathFragments)(workspace_root_1.workspaceRoot, 'nx.json'), 'utf-8'), propPath);
10
+ let nxJsonMessage = `The relevant config is defined here: ${(0, node_path_1.relative)(process.cwd(), (0, path_1.joinPathFragments)(workspace_root_1.workspaceRoot, 'nx.json'))}`;
10
11
  if (errorLines) {
11
12
  nxJsonMessage +=
12
13
  errorLines.startLine === errorLines.endLine
@@ -81,9 +81,9 @@ function withRunOptions(yargs) {
81
81
  default: false,
82
82
  })
83
83
  .option('skipSync', {
84
+ describe: 'Skips running the sync generators associated with the tasks.',
84
85
  type: 'boolean',
85
- // TODO(leo): add description and make it visible once it is stable
86
- hidden: true,
86
+ default: false,
87
87
  })
88
88
  .options('cloud', {
89
89
  type: 'boolean',
Binary file
@@ -42,6 +42,18 @@ function getNxInitDate() {
42
42
  return null;
43
43
  }
44
44
  }
45
+ async function createNxCloudWorkspaceV1(workspaceName, installationSource, nxInitDate) {
46
+ const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
47
+ const response = await require('axios').post(`${apiUrl}/nx-cloud/create-org-and-workspace`, {
48
+ workspaceName,
49
+ installationSource,
50
+ nxInitDate,
51
+ });
52
+ if (response.data.message) {
53
+ throw new Error(response.data.message);
54
+ }
55
+ return response.data;
56
+ }
45
57
  async function createNxCloudWorkspaceV2(workspaceName, installationSource, nxInitDate) {
46
58
  const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
47
59
  const response = await require('axios').post(`${apiUrl}/nx-cloud/v2/create-org-and-workspace`, {
@@ -69,6 +81,19 @@ async function printSuccessMessage(token, installationSource, usesGithub) {
69
81
  });
70
82
  return connectCloudUrl;
71
83
  }
84
+ function addNxCloudAccessTokenToNxJson(tree, token, directory = '') {
85
+ const nxJsonPath = (0, path_1.join)(directory, 'nx.json');
86
+ if (tree.exists(nxJsonPath)) {
87
+ (0, json_1.updateJson)(tree, (0, path_1.join)(directory, 'nx.json'), (nxJson) => {
88
+ const overrideUrl = process.env.NX_CLOUD_API || process.env.NRWL_API;
89
+ if (overrideUrl) {
90
+ nxJson.nxCloudUrl = overrideUrl;
91
+ }
92
+ nxJson.nxCloudAccessToken = token;
93
+ return nxJson;
94
+ });
95
+ }
96
+ }
72
97
  function addNxCloudIdToNxJson(tree, nxCloudId, directory = '') {
73
98
  const nxJsonPath = (0, path_1.join)(directory, 'nx.json');
74
99
  if (tree.exists(nxJsonPath)) {
@@ -89,6 +114,7 @@ async function connectToNxCloud(tree, schema, nxJson = (0, nx_json_1.readNxJson)
89
114
  return null;
90
115
  }
91
116
  const isGitHubDetected = schema.github ?? (await (0, url_shorten_1.repoUsesGithub)(schema.github));
117
+ let responseFromCreateNxCloudWorkspaceV1;
92
118
  let responseFromCreateNxCloudWorkspaceV2;
93
119
  /**
94
120
  * Do not create an Nx Cloud token if the user is using GitHub and
@@ -98,12 +124,34 @@ async function connectToNxCloud(tree, schema, nxJson = (0, nx_json_1.readNxJson)
98
124
  isGitHubDetected &&
99
125
  schema.installationSource === 'nx-connect')
100
126
  return null;
101
- responseFromCreateNxCloudWorkspaceV2 = await createNxCloudWorkspaceV2(getRootPackageName(tree), schema.installationSource, getNxInitDate());
102
- addNxCloudIdToNxJson(tree, responseFromCreateNxCloudWorkspaceV2?.nxCloudId, schema.directory);
103
- await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
104
- silent: schema.hideFormatLogs,
105
- });
106
- return responseFromCreateNxCloudWorkspaceV2.nxCloudId;
127
+ try {
128
+ responseFromCreateNxCloudWorkspaceV2 = await createNxCloudWorkspaceV2(getRootPackageName(tree), schema.installationSource, getNxInitDate());
129
+ }
130
+ catch (e) {
131
+ if (e.response?.status === 404) {
132
+ responseFromCreateNxCloudWorkspaceV1 = await createNxCloudWorkspaceV1(getRootPackageName(tree), schema.installationSource, getNxInitDate());
133
+ }
134
+ else {
135
+ throw e;
136
+ }
137
+ }
138
+ if (responseFromCreateNxCloudWorkspaceV2) {
139
+ addNxCloudIdToNxJson(tree, responseFromCreateNxCloudWorkspaceV2?.nxCloudId, schema.directory);
140
+ await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
141
+ silent: schema.hideFormatLogs,
142
+ });
143
+ return responseFromCreateNxCloudWorkspaceV2.nxCloudId;
144
+ }
145
+ else if (responseFromCreateNxCloudWorkspaceV1) {
146
+ addNxCloudAccessTokenToNxJson(tree, responseFromCreateNxCloudWorkspaceV1?.token, schema.directory);
147
+ await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
148
+ silent: schema.hideFormatLogs,
149
+ });
150
+ return responseFromCreateNxCloudWorkspaceV1.token;
151
+ }
152
+ else {
153
+ throw new Error('Could not create an Nx Cloud Workspace. Please try again.');
154
+ }
107
155
  }
108
156
  async function connectToNxCloudGenerator(tree, options) {
109
157
  await connectToNxCloud(tree, options);
@@ -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, devkit_exports_1.readNxJson)(tree);
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 devkit_exports_1 = require("../../devkit-exports");
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
- devkit_exports_1.logger.verbose(`Failed to get Nx Cloud version.
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
- devkit_exports_1.logger.verbose(`Failed to shorten Nx Cloud URL.
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
- devkit_exports_1.logger.warn(`Failed to access system features. GitHub integration assumed to be disabled.
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
- devkit_exports_1.logger.verbose(`Failed to get version of Nx Cloud.
119
+ logger_1.logger.verbose(`Failed to get version of Nx Cloud.
120
120
  ${e}`);
121
121
  return null;
122
122
  }
@@ -184,7 +184,7 @@ function mergeMetadata(sourceMap, sourceInformation, baseSourceMapPath, metadata
184
184
  }
185
185
  }
186
186
  else {
187
- result[metadataKey] = value;
187
+ result[metadataKey][key] = value[key];
188
188
  if (sourceMap) {
189
189
  sourceMap[`${baseSourceMapPath}.${metadataKey}`] =
190
190
  sourceInformation;
@@ -11,7 +11,8 @@ export type TaskWithCachedResult = {
11
11
  task: Task;
12
12
  cachedResult: CachedResult;
13
13
  };
14
- export declare function getCache(nxJson: NxJsonConfiguration, options: DefaultTasksRunnerOptions): DbCache | Cache;
14
+ export declare function dbCacheEnabled(nxJson?: NxJsonConfiguration): boolean;
15
+ export declare function getCache(options: DefaultTasksRunnerOptions): DbCache | Cache;
15
16
  export declare class DbCache {
16
17
  private readonly options;
17
18
  private cache;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Cache = exports.DbCache = void 0;
4
+ exports.dbCacheEnabled = dbCacheEnabled;
4
5
  exports.getCache = getCache;
5
6
  const workspace_root_1 = require("../utils/workspace-root");
6
7
  const path_1 = require("path");
@@ -19,14 +20,17 @@ const update_manager_1 = require("../nx-cloud/update-manager");
19
20
  const get_cloud_options_1 = require("../nx-cloud/utilities/get-cloud-options");
20
21
  const is_ci_1 = require("../utils/is-ci");
21
22
  const output_1 = require("../utils/output");
22
- function getCache(nxJson, options) {
23
- return process.env.NX_DISABLE_DB !== 'true' &&
24
- (nxJson.enableDbCache === true || process.env.NX_DB_CACHE === 'true')
23
+ function dbCacheEnabled(nxJson = (0, nx_json_1.readNxJson)()) {
24
+ return (process.env.NX_DISABLE_DB !== 'true' &&
25
+ (nxJson.enableDbCache === true || process.env.NX_DB_CACHE === 'true'));
26
+ }
27
+ // Do not change the order of these arguments as this function is used by nx cloud
28
+ function getCache(options) {
29
+ const nxJson = (0, nx_json_1.readNxJson)();
30
+ return dbCacheEnabled(nxJson)
25
31
  ? new DbCache({
26
32
  // Remove this in Nx 21
27
- nxCloudRemoteCache: (0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)())
28
- ? options.remoteCache
29
- : null,
33
+ nxCloudRemoteCache: (0, nx_cloud_utils_1.isNxCloudUsed)(nxJson) ? options.remoteCache : null,
30
34
  })
31
35
  : new Cache(options);
32
36
  }
@@ -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,10 +53,11 @@ class ProcessTasks {
52
53
  this.dependencies[d] = this.dependencies[d].filter((dd) => !!initialTasks[dd]);
53
54
  }
54
55
  }
55
- for (const projectName of Object.keys(this.dependencies)) {
56
- if (this.dependencies[projectName].length > 1) {
57
- this.dependencies[projectName] = [
58
- ...new Set(this.dependencies[projectName]).values(),
56
+ this.filterDummyTasks();
57
+ for (const taskId of Object.keys(this.dependencies)) {
58
+ if (this.dependencies[taskId].length > 0) {
59
+ this.dependencies[taskId] = [
60
+ ...new Set(this.dependencies[taskId].filter((d) => d !== taskId)).values(),
59
61
  ];
60
62
  }
61
63
  }
@@ -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.processTask(task, depProject.name, configuration, overrides);
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.nxJson, this.options);
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
@@ -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 devkit_exports_1 = require("../devkit-exports");
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
- devkit_exports_1.logger.verbose(`Git may not be set up correctly for this new workspace.
239
+ logger_1.logger.verbose(`Git may not be set up correctly for this new workspace.
240
240
  ${err}`);
241
241
  }
242
242
  else {