workspace-tools 0.24.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +16 -1
- package/CHANGELOG.md +10 -2
- package/lib/git/getDefaultRemote.js +0 -3
- package/lib/paths.d.ts +4 -3
- package/lib/paths.js +8 -2
- package/package.json +1 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,22 @@
|
|
|
2
2
|
"name": "workspace-tools",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Thu, 21 Jul 2022 21:11:05 GMT",
|
|
6
|
+
"tag": "workspace-tools_v0.25.0",
|
|
7
|
+
"version": "0.25.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "dlannoye@microsoft.com",
|
|
12
|
+
"package": "workspace-tools",
|
|
13
|
+
"comment": "BREAKING CHANGE: Improve detection of git root and throw if not found",
|
|
14
|
+
"commit": "00be591c06d9c14eba7f2b76cb8aac5f0246fdec"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Wed, 20 Jul 2022 22:31:31 GMT",
|
|
6
21
|
"tag": "workspace-tools_v0.24.0",
|
|
7
22
|
"version": "0.24.0",
|
|
8
23
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
# Change Log - workspace-tools
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 21 Jul 2022 21:11:05 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.25.0
|
|
8
|
+
|
|
9
|
+
Thu, 21 Jul 2022 21:11:05 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- BREAKING CHANGE: Improve detection of git root and throw if not found (dlannoye@microsoft.com)
|
|
14
|
+
|
|
7
15
|
## 0.24.0
|
|
8
16
|
|
|
9
|
-
Wed, 20 Jul 2022 22:31:
|
|
17
|
+
Wed, 20 Jul 2022 22:31:31 GMT
|
|
10
18
|
|
|
11
19
|
### Minor changes
|
|
12
20
|
|
|
@@ -20,9 +20,6 @@ function getDefaultRemote(cwdOrOptions) {
|
|
|
20
20
|
log(message);
|
|
21
21
|
};
|
|
22
22
|
const gitRoot = (0, paths_1.findGitRoot)(cwd);
|
|
23
|
-
if (!gitRoot) {
|
|
24
|
-
throw new Error(`Directory "${cwd}" does not appear to be in a git repository`);
|
|
25
|
-
}
|
|
26
23
|
let packageJson = {};
|
|
27
24
|
const packageJsonPath = path_1.default.join(gitRoot, "package.json");
|
|
28
25
|
try {
|
package/lib/paths.d.ts
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export declare function searchUp(pathName: string, cwd: string): string | null;
|
|
5
5
|
/**
|
|
6
|
-
* Starting from `cwd`,
|
|
6
|
+
* Starting from `cwd`, uses `git rev-parse --show-toplevel` to find the root of the git repo.
|
|
7
|
+
* Throws if `cwd` is not in a Git repository.
|
|
7
8
|
*/
|
|
8
|
-
export declare function findGitRoot(cwd: string): string
|
|
9
|
+
export declare function findGitRoot(cwd: string): string;
|
|
9
10
|
/**
|
|
10
11
|
* Starting from `cwd`, searches up the directory hierarchy for `package.json`.
|
|
11
12
|
*/
|
|
@@ -14,5 +15,5 @@ export declare function findPackageRoot(cwd: string): string | null;
|
|
|
14
15
|
* Starting from `cwd`, searches up the directory hierarchy for the workspace root,
|
|
15
16
|
* falling back to the git root if no workspace is detected.
|
|
16
17
|
*/
|
|
17
|
-
export declare function findProjectRoot(cwd: string): string
|
|
18
|
+
export declare function findProjectRoot(cwd: string): string;
|
|
18
19
|
export declare function isChildOf(child: string, parent: string): boolean;
|
package/lib/paths.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.isChildOf = exports.findProjectRoot = exports.findPackageRoot = exports.
|
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const getWorkspaceRoot_1 = require("./workspaces/getWorkspaceRoot");
|
|
10
|
+
const git_1 = require("./git");
|
|
10
11
|
/**
|
|
11
12
|
* Starting from `cwd`, searches up the directory hierarchy for `pathName`.
|
|
12
13
|
*/
|
|
@@ -27,10 +28,15 @@ function searchUp(pathName, cwd) {
|
|
|
27
28
|
}
|
|
28
29
|
exports.searchUp = searchUp;
|
|
29
30
|
/**
|
|
30
|
-
* Starting from `cwd`,
|
|
31
|
+
* Starting from `cwd`, uses `git rev-parse --show-toplevel` to find the root of the git repo.
|
|
32
|
+
* Throws if `cwd` is not in a Git repository.
|
|
31
33
|
*/
|
|
32
34
|
function findGitRoot(cwd) {
|
|
33
|
-
|
|
35
|
+
const output = (0, git_1.git)(["rev-parse", "--show-toplevel"], { cwd });
|
|
36
|
+
if (!output.success) {
|
|
37
|
+
throw new Error(`Directory "${cwd}" is not in a git repository`);
|
|
38
|
+
}
|
|
39
|
+
return path_1.default.normalize(output.stdout);
|
|
34
40
|
}
|
|
35
41
|
exports.findGitRoot = findGitRoot;
|
|
36
42
|
/**
|