build-strap 5.0.0-dev.71 → 5.0.0-dev.72

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "build-strap",
3
- "version": "5.0.0-dev.71",
3
+ "version": "5.0.0-dev.72",
4
4
  "description": "Node scripts for building things",
5
5
  "license": "MIT",
6
6
  "authors": [
package/src/gh.d.ts CHANGED
@@ -1,7 +1,11 @@
1
1
  import { SpawnOptions } from './cp.js';
2
2
  export declare const gh: (args: string[], options?: SpawnOptions | undefined) => Promise<import("./cp.js").SpawnResult>;
3
3
  export declare const ghRepoClone: (repo: string, repoDir: string) => Promise<void>;
4
- export declare const ensureGhRepo: (repo: string, rootDir?: string) => Promise<void>;
4
+ export declare const ensureGhRepo: (repo: string, { rootDir, targetDir, targetName, }?: {
5
+ rootDir?: string | undefined;
6
+ targetDir?: string | undefined;
7
+ targetName?: string | undefined;
8
+ }) => Promise<void>;
5
9
  export declare const ensureGhAuthLogin: ({ host, scopes, }?: {
6
10
  host?: string | undefined;
7
11
  scopes?: string | undefined;
package/src/gh.js CHANGED
@@ -9,10 +9,11 @@ export const ghRepoClone = async (repo, repoDir) => {
9
9
  stdio: 'inherit',
10
10
  });
11
11
  };
12
- export const ensureGhRepo = async (repo, rootDir = '.') => {
13
- const repoDir = path.join(rootDir, repo);
12
+ export const ensureGhRepo = async (repo, { rootDir = '.', targetDir, targetName, } = {}) => {
13
+ const repoDir = targetDir ||
14
+ path.join(rootDir, targetName || repo.split('/').pop() || repo);
14
15
  if (!(await fs.pathExists(repoDir))) {
15
- buildLog(`${repo} not found, cloning...`);
16
+ buildLog(`${repo} not found, cloning into ${repoDir}...`);
16
17
  await ghRepoClone(repo, repoDir);
17
18
  }
18
19
  };