workspace-tools 0.26.0 → 0.26.3

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 CHANGED
@@ -2,7 +2,80 @@
2
2
  "name": "workspace-tools",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 04 Aug 2022 21:47:41 GMT",
5
+ "date": "Fri, 12 Aug 2022 05:32:08 GMT",
6
+ "tag": "workspace-tools_v0.26.3",
7
+ "version": "0.26.3",
8
+ "comments": {
9
+ "none": [
10
+ {
11
+ "author": "email not defined",
12
+ "package": "workspace-tools",
13
+ "commit": "addac47344c01ba294f18bee28735c7133a00e82",
14
+ "comment": "Update devDependency beachball to v2.30.0"
15
+ }
16
+ ],
17
+ "patch": [
18
+ {
19
+ "author": "elcraig@microsoft.com",
20
+ "package": "workspace-tools",
21
+ "commit": "8fed2362e2531c996d800a8c2aba02ec97508aa2",
22
+ "comment": "Fix listAllTrackedFiles if there are no tracked files'"
23
+ }
24
+ ]
25
+ }
26
+ },
27
+ {
28
+ "date": "Fri, 12 Aug 2022 01:57:26 GMT",
29
+ "tag": "workspace-tools_v0.26.2",
30
+ "version": "0.26.2",
31
+ "comments": {
32
+ "patch": [
33
+ {
34
+ "author": "elcraig@microsoft.com",
35
+ "package": "workspace-tools",
36
+ "commit": "35fa36c25d7b1b2ef2de4d6318fa69af59b620ce",
37
+ "comment": "Add cleanup functions for addGitObserver"
38
+ }
39
+ ]
40
+ }
41
+ },
42
+ {
43
+ "date": "Mon, 08 Aug 2022 22:44:02 GMT",
44
+ "tag": "workspace-tools_v0.26.1",
45
+ "version": "0.26.1",
46
+ "comments": {
47
+ "patch": [
48
+ {
49
+ "author": "elcraig@microsoft.com",
50
+ "package": "workspace-tools",
51
+ "commit": "fa0d932a0a0ae63ebf16357b9a5ca42412405e95",
52
+ "comment": "Add missing type exports"
53
+ }
54
+ ],
55
+ "none": [
56
+ {
57
+ "author": "email not defined",
58
+ "package": "workspace-tools",
59
+ "commit": "05c206e967548245798da2f8b41ded7415e757e9",
60
+ "comment": "Update devDependency beachball to v2.26.1"
61
+ },
62
+ {
63
+ "author": "email not defined",
64
+ "package": "workspace-tools",
65
+ "commit": "9349737ca68eb1a10bc56c19911a08027fce9f48",
66
+ "comment": "Update devDependency gh-pages to v4"
67
+ },
68
+ {
69
+ "author": "email not defined",
70
+ "package": "workspace-tools",
71
+ "commit": "dbd019cf7c1cafb1b9a503461cc49acce936278f",
72
+ "comment": "Lock file maintenance"
73
+ }
74
+ ]
75
+ }
76
+ },
77
+ {
78
+ "date": "Thu, 04 Aug 2022 21:47:46 GMT",
6
79
  "tag": "workspace-tools_v0.26.0",
7
80
  "version": "0.26.0",
8
81
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,36 @@
1
1
  # Change Log - workspace-tools
2
2
 
3
- This log was last generated on Thu, 04 Aug 2022 21:47:41 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 12 Aug 2022 05:32:08 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.26.3
8
+
9
+ Fri, 12 Aug 2022 05:32:08 GMT
10
+
11
+ ### Patches
12
+
13
+ - Fix listAllTrackedFiles if there are no tracked files' (elcraig@microsoft.com)
14
+
15
+ ## 0.26.2
16
+
17
+ Fri, 12 Aug 2022 01:57:26 GMT
18
+
19
+ ### Patches
20
+
21
+ - Add cleanup functions for addGitObserver (elcraig@microsoft.com)
22
+
23
+ ## 0.26.1
24
+
25
+ Mon, 08 Aug 2022 22:44:02 GMT
26
+
27
+ ### Patches
28
+
29
+ - Add missing type exports (elcraig@microsoft.com)
30
+
7
31
  ## 0.26.0
8
32
 
9
- Thu, 04 Aug 2022 21:47:41 GMT
33
+ Thu, 04 Aug 2022 21:47:46 GMT
10
34
 
11
35
  ### Minor changes
12
36
 
package/lib/git/git.d.ts CHANGED
@@ -10,12 +10,14 @@ export declare type GitProcessOutput = {
10
10
  success: boolean;
11
11
  };
12
12
  /** Observes the git operations called from `git()` or `gitFailFast()` */
13
- declare type GitObserver = (args: string[], output: GitProcessOutput) => void;
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
- * @param observer
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
  */
@@ -26,4 +28,3 @@ export declare function git(args: string[], options?: SpawnSyncOptions): GitProc
26
28
  export declare function gitFailFast(args: string[], options?: SpawnSyncOptions & {
27
29
  noExitCode?: boolean;
28
30
  }): void;
29
- export {};
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
- * @param observer
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
  */
@@ -257,7 +257,7 @@ function getDefaultBranch(cwd) {
257
257
  exports.getDefaultBranch = getDefaultBranch;
258
258
  function listAllTrackedFiles(patterns, cwd) {
259
259
  const results = (0, git_1.git)(["ls-files", ...patterns], { cwd });
260
- return results.success ? results.stdout.split(/\n/) : [];
260
+ return results.success && results.stdout.trim() ? results.stdout.trim().split(/\n/) : [];
261
261
  }
262
262
  exports.listAllTrackedFiles = listAllTrackedFiles;
263
263
  function processGitOutput(output) {
package/lib/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from "./graph/index";
5
5
  export * from "./lockfile";
6
6
  export * from "./paths";
7
7
  export * from "./scope";
8
+ export * from "./types/PackageGraph";
8
9
  export * from "./types/PackageInfo";
9
10
  export * from "./types/WorkspaceInfo";
10
11
  export * from "./workspaces/findWorkspacePath";
package/lib/index.js CHANGED
@@ -17,6 +17,7 @@ __exportStar(require("./graph/index"), exports);
17
17
  __exportStar(require("./lockfile"), exports);
18
18
  __exportStar(require("./paths"), exports);
19
19
  __exportStar(require("./scope"), exports);
20
+ __exportStar(require("./types/PackageGraph"), exports);
20
21
  __exportStar(require("./types/PackageInfo"), exports);
21
22
  __exportStar(require("./types/WorkspaceInfo"), exports);
22
23
  __exportStar(require("./workspaces/findWorkspacePath"), exports);
@@ -8,7 +8,3 @@ export interface PackageGraph {
8
8
  packages: string[];
9
9
  dependencies: PackageDependency[];
10
10
  }
11
- /** Package graph visitor is called as it visits every package in dependency order */
12
- export interface PackageGraphVisitor {
13
- (pkg: string, dependencies: string[], dependents: string[]): void;
14
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workspace-tools",
3
- "version": "0.26.0",
3
+ "version": "0.26.3",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,7 +14,7 @@
14
14
  "scripts": {
15
15
  "build": "tsc",
16
16
  "build:docs": "typedoc src/index.ts",
17
- "release:docs": "typedoc src/index.ts && gh-pages -d docs",
17
+ "release:docs": "yarn build:docs && gh-pages -d docs",
18
18
  "change": "beachball change",
19
19
  "checkchange": "beachball check",
20
20
  "format": "prettier --write .",
@@ -40,9 +40,9 @@
40
40
  "@types/node": "14.18.23",
41
41
  "@types/tmp": "0.2.3",
42
42
  "@types/yarnpkg__lockfile": "1.1.5",
43
- "beachball": "2.26.0",
43
+ "beachball": "2.30.0",
44
44
  "fs-extra": "10.1.0",
45
- "gh-pages": "3.2.3",
45
+ "gh-pages": "4.0.0",
46
46
  "jest": "28.1.3",
47
47
  "prettier": "2.7.1",
48
48
  "tmp": "0.2.1",