nx 19.6.0 → 19.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. package/README.md +1 -1
  2. package/package.json +13 -13
  3. package/src/adapter/ngcli-adapter.js +2 -2
  4. package/src/command-line/add/add.js +1 -5
  5. package/src/command-line/add/command-object.js +1 -5
  6. package/src/command-line/affected/affected.js +0 -3
  7. package/src/command-line/exec/exec.js +0 -3
  8. package/src/command-line/generate/command-object.js +2 -5
  9. package/src/command-line/generate/generate.js +4 -8
  10. package/src/command-line/import/command-object.js +1 -1
  11. package/src/command-line/import/utils/prepare-source-repo.js +2 -2
  12. package/src/command-line/migrate/command-object.js +3 -2
  13. package/src/command-line/migrate/migrate.js +0 -3
  14. package/src/command-line/release/changelog.js +0 -3
  15. package/src/command-line/release/command-object.js +1 -5
  16. package/src/command-line/release/plan-check.js +0 -3
  17. package/src/command-line/release/plan.js +0 -3
  18. package/src/command-line/release/publish.js +0 -6
  19. package/src/command-line/release/release.js +0 -3
  20. package/src/command-line/release/version.js +0 -3
  21. package/src/command-line/repair/command-object.js +2 -4
  22. package/src/command-line/repair/repair.js +2 -6
  23. package/src/command-line/run/run-one.js +0 -3
  24. package/src/command-line/show/command-object.js +2 -2
  25. package/src/command-line/sync/command-object.js +3 -8
  26. package/src/command-line/sync/sync.js +1 -5
  27. package/src/command-line/watch/command-object.js +1 -1
  28. package/src/command-line/watch/watch.js +0 -3
  29. package/src/command-line/yargs-utils/shared-options.js +3 -3
  30. package/src/core/graph/main.js +1 -1
  31. package/src/native/assert-supported-platform.js +1 -1
  32. package/src/native/nx.wasm32-wasi.wasm +0 -0
  33. package/src/nx-cloud/utilities/url-shorten.d.ts +3 -0
  34. package/src/nx-cloud/utilities/url-shorten.js +4 -1
  35. package/src/plugins/js/package-json/create-package-json.d.ts +1 -0
  36. package/src/plugins/js/package-json/create-package-json.js +1 -1
  37. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +11 -6
  38. package/src/tasks-runner/cache.js +1 -1
  39. package/src/utils/git-utils.d.ts +3 -0
  40. package/src/utils/git-utils.js +4 -1
  41. package/src/utils/logger.js +1 -1
@@ -18,7 +18,7 @@ function assertSupportedPlatform() {
18
18
  `The Nx CLI could not find or load the native binary for your supported platform (${process.platform}-${process.arch}).`,
19
19
  'This likely means that optional dependencies were not installed correctly, or your system is missing some system dependencies.',
20
20
  ];
21
- if (process.env.NX_VERBOSE_LOGGING == 'true') {
21
+ if (process.env.NX_VERBOSE_LOGGING === 'true') {
22
22
  bodyLines.push('', 'Additional error information:', e.message);
23
23
  }
24
24
  }
Binary file
@@ -1,3 +1,6 @@
1
+ /**
2
+ * This is currently duplicated in Nx Console. Please let @MaxKless know if you make changes here.
3
+ */
1
4
  export declare function createNxCloudOnboardingURL(onboardingSource: string, accessToken?: string, usesGithub?: boolean, meta?: string): Promise<string>;
2
5
  export declare function repoUsesGithub(github?: boolean, githubSlug?: string, apiUrl?: string): Promise<boolean>;
3
6
  export declare function getURLifShortenFailed(usesGithub: boolean, githubSlug: string | null, apiUrl: string, source: string, accessToken?: string): string;
@@ -10,6 +10,9 @@ exports.compareCleanCloudVersions = compareCleanCloudVersions;
10
10
  const devkit_exports_1 = require("../../devkit-exports");
11
11
  const git_utils_1 = require("../../utils/git-utils");
12
12
  const get_cloud_options_1 = require("./get-cloud-options");
13
+ /**
14
+ * This is currently duplicated in Nx Console. Please let @MaxKless know if you make changes here.
15
+ */
13
16
  async function createNxCloudOnboardingURL(onboardingSource, accessToken, usesGithub, meta) {
14
17
  const githubSlug = (0, git_utils_1.getGithubSlugOrNull)();
15
18
  const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
@@ -92,7 +95,7 @@ async function getInstallationSupportsGitHub(apiUrl) {
92
95
  return !!response.data.isGithubIntegrationEnabled;
93
96
  }
94
97
  catch (e) {
95
- if (process.env.NX_VERBOSE_LOGGING) {
98
+ if (process.env.NX_VERBOSE_LOGGING === 'true') {
96
99
  devkit_exports_1.logger.warn(`Failed to access system features. GitHub integration assumed to be disabled.
97
100
  ${e}`);
98
101
  }
@@ -18,6 +18,7 @@ export declare function createPackageJson(projectName: string, graph: ProjectGra
18
18
  root?: string;
19
19
  isProduction?: boolean;
20
20
  helperDependencies?: string[];
21
+ skipPackageManager?: boolean;
21
22
  }, fileMap?: ProjectFileMap): PackageJson;
22
23
  export declare function findProjectsNpmDependencies(projectNode: ProjectGraphProjectNode, graph: ProjectGraph, target: string, rootPackageJson: PackageJson, options: {
23
24
  helperDependencies?: string[];
@@ -108,7 +108,7 @@ function createPackageJson(projectName, graph, options = {}, fileMap = null) {
108
108
  packageJson.dependencies &&= (0, object_sort_1.sortObjectByKeys)(packageJson.dependencies);
109
109
  packageJson.peerDependencies &&= (0, object_sort_1.sortObjectByKeys)(packageJson.peerDependencies);
110
110
  packageJson.peerDependenciesMeta &&= (0, object_sort_1.sortObjectByKeys)(packageJson.peerDependenciesMeta);
111
- if (rootPackageJson.packageManager) {
111
+ if (rootPackageJson.packageManager && !options.skipPackageManager) {
112
112
  if (packageJson.packageManager &&
113
113
  packageJson.packageManager !== rootPackageJson.packageManager) {
114
114
  output_1.output.warn({
@@ -140,15 +140,20 @@ class TargetProjectLocator {
140
140
  return externalNodeName;
141
141
  }
142
142
  const version = (0, semver_1.clean)(externalPackageJson.version);
143
- const npmProjectKey = `npm:${externalPackageJson.name}@${version}`;
144
- let matchingExternalNode = this.npmProjects[npmProjectKey];
143
+ let matchingExternalNode = this.npmProjects[`npm:${externalPackageJson.name}@${version}`];
145
144
  if (!matchingExternalNode) {
146
145
  // check if it's a package alias, where the resolved package key is used as the version
147
- const aliasNpmProjectKey = `npm:${packageName}@${npmProjectKey}`;
146
+ const aliasNpmProjectKey = `npm:${packageName}@npm:${externalPackageJson.name}@${version}`;
148
147
  matchingExternalNode = this.npmProjects[aliasNpmProjectKey];
149
- if (!matchingExternalNode) {
150
- return null;
151
- }
148
+ }
149
+ if (!matchingExternalNode) {
150
+ // Fallback to package name as key. This can happen if the version in project graph is not the same as in the resolved package.json.
151
+ // e.g. Version in project graph is a git remote, but the resolved version is semver.
152
+ matchingExternalNode =
153
+ this.npmProjects[`npm:${externalPackageJson.name}`];
154
+ }
155
+ if (!matchingExternalNode) {
156
+ return null;
152
157
  }
153
158
  this.npmResolutionCache.set(npmImportForProject, matchingExternalNode.name);
154
159
  return matchingExternalNode.name;
@@ -44,7 +44,7 @@ class Cache {
44
44
  this._currentMachineId = await (0, node_machine_id_1.machineId)();
45
45
  }
46
46
  catch (e) {
47
- if (process.env.NX_VERBOSE_LOGGING == 'true') {
47
+ if (process.env.NX_VERBOSE_LOGGING === 'true') {
48
48
  console.log(`Unable to get machineId. Error: ${e.message}`);
49
49
  }
50
50
  this._currentMachineId = '';
@@ -33,6 +33,9 @@ export declare class GitRepository {
33
33
  */
34
34
  export declare function updateRebaseFile(contents: string): string;
35
35
  export declare function fetchGitRemote(name: string, branch: string, execOptions: ExecSyncOptions): string | Buffer;
36
+ /**
37
+ * This is currently duplicated in Nx Console. Please let @MaxKless know if you make changes here.
38
+ */
36
39
  export declare function getGithubSlugOrNull(): string | null;
37
40
  export declare function extractUserAndRepoFromGitHubUrl(gitRemotes: string): string | null;
38
41
  export declare function commitChanges(commitMessage: string, directory?: string): string | null;
@@ -83,7 +83,7 @@ class GitRepository {
83
83
  return this.execAsync(`git checkout ${opts.new ? '-b ' : ' '}${branch}${opts.base ? ' ' + opts.base : ''}`);
84
84
  }
85
85
  async move(path, destination) {
86
- return this.execAsync(`git mv ${path} ${destination}`);
86
+ return this.execAsync(`git mv "${path}" "${destination}"`);
87
87
  }
88
88
  async push(ref, remoteName) {
89
89
  return this.execAsync(`git push -u -f ${remoteName} ${ref}`);
@@ -117,6 +117,9 @@ function updateRebaseFile(contents) {
117
117
  function fetchGitRemote(name, branch, execOptions) {
118
118
  return (0, child_process_1.execSync)(`git fetch ${name} ${branch} --depth 1`, execOptions);
119
119
  }
120
+ /**
121
+ * This is currently duplicated in Nx Console. Please let @MaxKless know if you make changes here.
122
+ */
120
123
  function getGithubSlugOrNull() {
121
124
  try {
122
125
  const gitRemote = (0, child_process_1.execSync)('git remote -v', {
@@ -36,7 +36,7 @@ exports.logger = {
36
36
  console.error(...s);
37
37
  },
38
38
  verbose: (...s) => {
39
- if (process.env.NX_VERBOSE_LOGGING) {
39
+ if (process.env.NX_VERBOSE_LOGGING === 'true') {
40
40
  console.log(...s);
41
41
  }
42
42
  },