nx 20.1.0-beta.2 → 20.1.0-beta.4

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "20.1.0-beta.2",
3
+ "version": "20.1.0-beta.4",
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": {
@@ -80,16 +80,16 @@
80
80
  }
81
81
  },
82
82
  "optionalDependencies": {
83
- "@nx/nx-darwin-x64": "20.1.0-beta.2",
84
- "@nx/nx-darwin-arm64": "20.1.0-beta.2",
85
- "@nx/nx-linux-x64-gnu": "20.1.0-beta.2",
86
- "@nx/nx-linux-x64-musl": "20.1.0-beta.2",
87
- "@nx/nx-win32-x64-msvc": "20.1.0-beta.2",
88
- "@nx/nx-linux-arm64-gnu": "20.1.0-beta.2",
89
- "@nx/nx-linux-arm64-musl": "20.1.0-beta.2",
90
- "@nx/nx-linux-arm-gnueabihf": "20.1.0-beta.2",
91
- "@nx/nx-win32-arm64-msvc": "20.1.0-beta.2",
92
- "@nx/nx-freebsd-x64": "20.1.0-beta.2"
83
+ "@nx/nx-darwin-x64": "20.1.0-beta.4",
84
+ "@nx/nx-darwin-arm64": "20.1.0-beta.4",
85
+ "@nx/nx-linux-x64-gnu": "20.1.0-beta.4",
86
+ "@nx/nx-linux-x64-musl": "20.1.0-beta.4",
87
+ "@nx/nx-win32-x64-msvc": "20.1.0-beta.4",
88
+ "@nx/nx-linux-arm64-gnu": "20.1.0-beta.4",
89
+ "@nx/nx-linux-arm64-musl": "20.1.0-beta.4",
90
+ "@nx/nx-linux-arm-gnueabihf": "20.1.0-beta.4",
91
+ "@nx/nx-win32-arm64-msvc": "20.1.0-beta.4",
92
+ "@nx/nx-freebsd-x64": "20.1.0-beta.4"
93
93
  },
94
94
  "nx-migrations": {
95
95
  "migrations": "./migrations.json",
@@ -160,9 +160,9 @@
160
160
  "x86_64-unknown-freebsd"
161
161
  ]
162
162
  },
163
+ "types": "./bin/nx.d.ts",
163
164
  "main": "./bin/nx.js",
164
165
  "type": "commonjs",
165
- "types": "./bin/nx.d.ts",
166
166
  "scripts": {
167
167
  "postinstall": "node ./bin/post-install"
168
168
  }
@@ -15,6 +15,7 @@ exports.getFirstGitCommit = getFirstGitCommit;
15
15
  * Special thanks to changelogen for the original inspiration for many of these utilities:
16
16
  * https://github.com/unjs/changelogen
17
17
  */
18
+ const node_path_1 = require("node:path");
18
19
  const utils_1 = require("../../../tasks-runner/utils");
19
20
  const workspace_root_1 = require("../../../utils/workspace-root");
20
21
  const exec_command_1 = require("./exec-command");
@@ -86,13 +87,19 @@ async function getGitDiff(from, to = 'HEAD') {
86
87
  // Use a unique enough separator that we can be relatively certain will not occur within the commit message itself
87
88
  const separator = '§§§';
88
89
  // https://git-scm.com/docs/pretty-formats
89
- const r = await (0, exec_command_1.execCommand)('git', [
90
+ const args = [
90
91
  '--no-pager',
91
92
  'log',
92
93
  range,
93
94
  `--pretty="----%n%s${separator}%h${separator}%an${separator}%ae%n%b"`,
94
95
  '--name-status',
95
- ]);
96
+ ];
97
+ // Support cases where the nx workspace root is located at a nested path within the git repo
98
+ const relativePath = await getGitRootRelativePath();
99
+ if (relativePath) {
100
+ args.push(`--relative=${relativePath}`);
101
+ }
102
+ const r = await (0, exec_command_1.execCommand)('git', args);
96
103
  return r
97
104
  .split('----\n')
98
105
  .splice(1)
@@ -405,3 +412,19 @@ async function getFirstGitCommit() {
405
412
  throw new Error(`Unable to find first commit in git history`);
406
413
  }
407
414
  }
415
+ async function getGitRoot() {
416
+ try {
417
+ return (await (0, exec_command_1.execCommand)('git', ['rev-parse', '--show-toplevel'])).trim();
418
+ }
419
+ catch (e) {
420
+ throw new Error('Unable to find git root');
421
+ }
422
+ }
423
+ let gitRootRelativePath;
424
+ async function getGitRootRelativePath() {
425
+ if (!gitRootRelativePath) {
426
+ const gitRoot = await getGitRoot();
427
+ gitRootRelativePath = (0, node_path_1.relative)(gitRoot, workspace_root_1.workspaceRoot);
428
+ }
429
+ return gitRootRelativePath;
430
+ }