workspace-tools 0.26.1 → 0.26.2
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/git.d.ts +4 -2
- package/lib/git/git.js +15 -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": "Fri, 12 Aug 2022 01:57:23 GMT",
|
|
6
|
+
"tag": "workspace-tools_v0.26.2",
|
|
7
|
+
"version": "0.26.2",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "elcraig@microsoft.com",
|
|
12
|
+
"package": "workspace-tools",
|
|
13
|
+
"commit": "35fa36c25d7b1b2ef2de4d6318fa69af59b620ce",
|
|
14
|
+
"comment": "Add cleanup functions for addGitObserver"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Mon, 08 Aug 2022 22:44:02 GMT",
|
|
6
21
|
"tag": "workspace-tools_v0.26.1",
|
|
7
22
|
"version": "0.26.1",
|
|
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 Fri, 12 Aug 2022 01:57:23 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.26.2
|
|
8
|
+
|
|
9
|
+
Fri, 12 Aug 2022 01:57:23 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Add cleanup functions for addGitObserver (elcraig@microsoft.com)
|
|
14
|
+
|
|
7
15
|
## 0.26.1
|
|
8
16
|
|
|
9
|
-
Mon, 08 Aug 2022 22:
|
|
17
|
+
Mon, 08 Aug 2022 22:44:02 GMT
|
|
10
18
|
|
|
11
19
|
### Patches
|
|
12
20
|
|
package/lib/git/git.d.ts
CHANGED
|
@@ -13,9 +13,11 @@ export declare type GitProcessOutput = {
|
|
|
13
13
|
export declare type GitObserver = (args: string[], output: GitProcessOutput) => void;
|
|
14
14
|
/**
|
|
15
15
|
* Adds an observer for the git operations, e.g. for testing
|
|
16
|
-
* @
|
|
16
|
+
* @returns a function to remove the observer
|
|
17
17
|
*/
|
|
18
|
-
export declare function addGitObserver(observer: GitObserver): void;
|
|
18
|
+
export declare function addGitObserver(observer: GitObserver): () => void;
|
|
19
|
+
/** Clear all git observers */
|
|
20
|
+
export declare function clearGitObservers(): void;
|
|
19
21
|
/**
|
|
20
22
|
* Runs git command - use this for read-only commands
|
|
21
23
|
*/
|
package/lib/git/git.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Basic git wrappers
|
|
4
4
|
//
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.gitFailFast = exports.git = exports.addGitObserver = exports.GitError = void 0;
|
|
6
|
+
exports.gitFailFast = exports.git = exports.clearGitObservers = exports.addGitObserver = exports.GitError = void 0;
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
class GitError extends Error {
|
|
9
9
|
constructor(message, originalError) {
|
|
@@ -27,12 +27,25 @@ const observers = [];
|
|
|
27
27
|
let observing;
|
|
28
28
|
/**
|
|
29
29
|
* Adds an observer for the git operations, e.g. for testing
|
|
30
|
-
* @
|
|
30
|
+
* @returns a function to remove the observer
|
|
31
31
|
*/
|
|
32
32
|
function addGitObserver(observer) {
|
|
33
33
|
observers.push(observer);
|
|
34
|
+
return () => removeGitObserver(observer);
|
|
34
35
|
}
|
|
35
36
|
exports.addGitObserver = addGitObserver;
|
|
37
|
+
/** Clear all git observers */
|
|
38
|
+
function clearGitObservers() {
|
|
39
|
+
observers.splice(0, observers.length);
|
|
40
|
+
}
|
|
41
|
+
exports.clearGitObservers = clearGitObservers;
|
|
42
|
+
/** Remove a git observer */
|
|
43
|
+
function removeGitObserver(observer) {
|
|
44
|
+
const index = observers.indexOf(observer);
|
|
45
|
+
if (index > -1) {
|
|
46
|
+
observers.splice(index, 1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
36
49
|
/**
|
|
37
50
|
* Runs git command - use this for read-only commands
|
|
38
51
|
*/
|