build-strap 5.0.0-dev.72 → 5.0.0-dev.73
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/package.json +1 -1
- package/src/git.d.ts +2 -1
- package/src/git.js +5 -4
package/package.json
CHANGED
package/src/git.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SpawnOptions } from './cp.js';
|
|
2
|
-
export declare const git: (args: string[], opts?: SpawnOptions | undefined) => Promise<
|
|
2
|
+
export declare const git: (args: string[], opts?: SpawnOptions | undefined) => Promise<import("./cp.js").SpawnResult>;
|
|
3
|
+
export declare const gitOutput: (args: string[], opts?: SpawnOptions | undefined) => Promise<string>;
|
|
3
4
|
export declare function gitBranch(): Promise<string>;
|
|
4
5
|
export declare function gitRevId(): Promise<string>;
|
|
5
6
|
declare type GitInfo = {
|
package/src/git.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { spawn } from './cp.js';
|
|
2
2
|
import { userQuestion } from './prompt.js';
|
|
3
3
|
import { buildLog } from './run.js';
|
|
4
|
-
export const git = async (args, opts) =>
|
|
4
|
+
export const git = async (args, opts) => spawn('git', args, opts);
|
|
5
|
+
export const gitOutput = async (args, opts) => (await git(args, { captureOutput: true, ...opts })).stdout.trim();
|
|
5
6
|
export async function gitBranch() {
|
|
6
|
-
return (await
|
|
7
|
+
return (await gitOutput(['symbolic-ref', '--short', 'HEAD']))
|
|
7
8
|
.replace(/[_+/]/g, '-')
|
|
8
9
|
.trim();
|
|
9
10
|
}
|
|
10
11
|
export async function gitRevId() {
|
|
11
|
-
return (await
|
|
12
|
+
return (await gitOutput(['rev-parse', '--short=12', 'HEAD']))
|
|
12
13
|
.replace(/[+]/g, '')
|
|
13
14
|
.trim();
|
|
14
15
|
}
|
|
@@ -25,7 +26,7 @@ export async function gitInfo(noCache = false) {
|
|
|
25
26
|
export const ensureGitLfsInstalled = async () => {
|
|
26
27
|
await git(['lfs', 'install'], { stdio: 'inherit' });
|
|
27
28
|
};
|
|
28
|
-
export const gitConfigRead = async (key, global = true) =>
|
|
29
|
+
export const gitConfigRead = async (key, global = true) => gitOutput(['config', ...(global ? ['--global'] : []), key], {
|
|
29
30
|
rejectOnErrorCode: false,
|
|
30
31
|
});
|
|
31
32
|
export const gitConfigWrite = async (key, value, global = true) => {
|