workspace-tools 0.19.1 → 0.19.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 CHANGED
@@ -2,7 +2,22 @@
2
2
  "name": "workspace-tools",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 03 Jun 2022 16:57:02 GMT",
5
+ "date": "Thu, 23 Jun 2022 18:51:59 GMT",
6
+ "tag": "workspace-tools_v0.19.2",
7
+ "version": "0.19.2",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "elcraig@microsoft.com",
12
+ "package": "workspace-tools",
13
+ "comment": "Allow full spawnSync options for git methods",
14
+ "commit": "cf0a0d77be58988e411d0349c8a009642770696e"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Fri, 03 Jun 2022 16:57:07 GMT",
6
21
  "tag": "workspace-tools_v0.19.1",
7
22
  "version": "0.19.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 Fri, 03 Jun 2022 16:57:02 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 23 Jun 2022 18:51:59 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.19.2
8
+
9
+ Thu, 23 Jun 2022 18:51:59 GMT
10
+
11
+ ### Patches
12
+
13
+ - Allow full spawnSync options for git methods (elcraig@microsoft.com)
14
+
7
15
  ## 0.19.1
8
16
 
9
- Fri, 03 Jun 2022 16:57:02 GMT
17
+ Fri, 03 Jun 2022 16:57:07 GMT
10
18
 
11
19
  ### Patches
12
20
 
package/lib/git.d.ts CHANGED
@@ -1,8 +1,11 @@
1
+ /// <reference types="node" />
2
+ import { SpawnSyncOptions } from "child_process";
1
3
  declare type ProcessOutput = {
2
4
  stderr: string;
3
5
  stdout: string;
4
6
  success: boolean;
5
7
  };
8
+ /** Observes the git operations called from `git()` or `gitFailFast()` */
6
9
  declare type GitObserver = (args: string[], output: ProcessOutput) => void;
7
10
  /**
8
11
  * Adds an observer for the git operations, e.g. for testing
@@ -10,19 +13,13 @@ declare type GitObserver = (args: string[], output: ProcessOutput) => void;
10
13
  */
11
14
  export declare function addGitObserver(observer: GitObserver): void;
12
15
  /**
13
- * Runs git command - use this for read only commands
16
+ * Runs git command - use this for read-only commands
14
17
  */
15
- export declare function git(args: string[], options?: {
16
- cwd: string;
17
- maxBuffer?: number;
18
- }): ProcessOutput;
18
+ export declare function git(args: string[], options?: SpawnSyncOptions): ProcessOutput;
19
19
  /**
20
- * Runs git command - use this for commands that makes changes to the file system
20
+ * Runs git command - use this for commands that make changes to the filesystem
21
21
  */
22
- export declare function gitFailFast(args: string[], options?: {
23
- cwd: string;
24
- maxBuffer?: number;
25
- }): void;
22
+ export declare function gitFailFast(args: string[], options?: SpawnSyncOptions): void;
26
23
  export declare function getUntrackedChanges(cwd: string): string[];
27
24
  export declare function fetchRemote(remote: string, cwd: string): void;
28
25
  export declare function fetchRemoteBranch(remote: string, remoteBranch: string, cwd: string): void;
package/lib/git.js CHANGED
@@ -16,11 +16,11 @@ function gitError(message, e) {
16
16
  return new Error(message);
17
17
  }
18
18
  /**
19
- * A maxBuffer override globally for all git operations
20
- * Bumps up the default to 500MB as opposed to the 1MB
21
- * Override this value with "GIT_MAX_BUFFER" environment variable
19
+ * A global maxBuffer override for all git operations.
20
+ * Bumps up the default to 500MB instead of 1MB.
21
+ * Override this value with the `GIT_MAX_BUFFER` environment variable.
22
22
  */
23
- const MaxBufferOption = process.env.GIT_MAX_BUFFER ? parseInt(process.env.GIT_MAX_BUFFER) : 500 * 1024 * 1024;
23
+ const defaultMaxBuffer = process.env.GIT_MAX_BUFFER ? parseInt(process.env.GIT_MAX_BUFFER) : 500 * 1024 * 1024;
24
24
  const observers = [];
25
25
  let observing;
26
26
  /**
@@ -32,25 +32,15 @@ function addGitObserver(observer) {
32
32
  }
33
33
  exports.addGitObserver = addGitObserver;
34
34
  /**
35
- * Runs git command - use this for read only commands
35
+ * Runs git command - use this for read-only commands
36
36
  */
37
37
  function git(args, options) {
38
- const results = (0, child_process_1.spawnSync)("git", args, Object.assign({ maxBuffer: MaxBufferOption }, options));
39
- let output;
40
- if (results.status === 0) {
41
- output = {
42
- stderr: results.stderr.toString().trimRight(),
43
- stdout: results.stdout.toString().trimRight(),
44
- success: true,
45
- };
46
- }
47
- else {
48
- output = {
49
- stderr: results.stderr.toString().trimRight(),
50
- stdout: results.stdout.toString().trimRight(),
51
- success: false,
52
- };
53
- }
38
+ const results = (0, child_process_1.spawnSync)("git", args, Object.assign({ maxBuffer: defaultMaxBuffer }, options));
39
+ const output = {
40
+ stderr: results.stderr.toString().trimRight(),
41
+ stdout: results.stdout.toString().trimRight(),
42
+ success: results.status === 0
43
+ };
54
44
  // notify observers, flipping the observing bit to prevent infinite loops
55
45
  if (!observing) {
56
46
  observing = true;
@@ -63,7 +53,7 @@ function git(args, options) {
63
53
  }
64
54
  exports.git = git;
65
55
  /**
66
- * Runs git command - use this for commands that makes changes to the file system
56
+ * Runs git command - use this for commands that make changes to the filesystem
67
57
  */
68
58
  function gitFailFast(args, options) {
69
59
  const gitResult = git(args, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workspace-tools",
3
- "version": "0.19.1",
3
+ "version": "0.19.2",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",