@codemarc/blt 1.10.4 → 1.10.5
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/README.md +20 -1
- package/dist/commands/init/root.d.ts +10 -0
- package/dist/commands/init/root.d.ts.map +1 -0
- package/dist/commands/init/root.js +34 -0
- package/dist/commands/init/root.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +44 -4
- package/dist/commands/init.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -615,12 +615,31 @@ Snapshots default under `data-snapshots/` from the **current working directory**
|
|
|
615
615
|
|
|
616
616
|
## Init Commands
|
|
617
617
|
|
|
618
|
+
### `blt init root`
|
|
619
|
+
|
|
620
|
+
Clone the umbrella repository (`bltcore-com/blt`). Start here on a fresh machine.
|
|
621
|
+
|
|
622
|
+
```bash
|
|
623
|
+
blt init root -s
|
|
624
|
+
cd blt
|
|
625
|
+
blt init -w -s
|
|
626
|
+
./getblt.sh
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
**Options:**
|
|
630
|
+
|
|
631
|
+
- `-d, --directory <name>` — Clone directory name (default: `blt`)
|
|
632
|
+
- `-p, --parent <path>` — Parent directory (default: `.`)
|
|
633
|
+
- `-s, --ssh` — Use SSH URL instead of HTTPS
|
|
634
|
+
- `-g, --gh` — Use GitHub CLI (`gh repo clone`)
|
|
635
|
+
|
|
618
636
|
### `blt init [options]`
|
|
619
637
|
|
|
620
638
|
Create a shell script to fast-forward sync sibling BLT repositories. Run the generated script from the **umbrella repo root** (`bltcore-com/blt`), not from a parent directory.
|
|
621
639
|
|
|
622
640
|
```bash
|
|
623
|
-
|
|
641
|
+
blt init root -s
|
|
642
|
+
cd blt
|
|
624
643
|
blt init -w -s
|
|
625
644
|
blt init -b -s # bundle: single-root workspace
|
|
626
645
|
./getblt.sh
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Logger } from "@caporal/core";
|
|
2
|
+
export interface InitRootOptions {
|
|
3
|
+
directory: string;
|
|
4
|
+
parent: string;
|
|
5
|
+
ssh: boolean;
|
|
6
|
+
gh: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** Clone the umbrella BLT repository into parent/directory. */
|
|
9
|
+
export declare function cloneUmbrellaRoot(options: InitRootOptions, logger: Logger): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../../src/commands/init/root.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAO5C,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,EAAE,EAAE,OAAO,CAAC;CACb;AAgBD,+DAA+D;AAC/D,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAkCf"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
|
+
import { ensureGhReady, ghCloneTarget } from "../../lib/github";
|
|
5
|
+
import { getBundleRepository } from "../../lib/repositories";
|
|
6
|
+
function runOrExit(command, args, cwd, logger, label) {
|
|
7
|
+
const result = spawnSync(command, args, { cwd, stdio: "inherit" });
|
|
8
|
+
if (result.status !== 0) {
|
|
9
|
+
logger.error(`${label} failed`);
|
|
10
|
+
process.exit(result.status === null ? 1 : result.status);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** Clone the umbrella BLT repository into parent/directory. */
|
|
14
|
+
export async function cloneUmbrellaRoot(options, logger) {
|
|
15
|
+
const parent = resolve(options.parent);
|
|
16
|
+
const target = join(parent, options.directory);
|
|
17
|
+
if (existsSync(target)) {
|
|
18
|
+
logger.error(`Target already exists: ${target}`);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
const bundle = getBundleRepository();
|
|
22
|
+
if (options.gh) {
|
|
23
|
+
ensureGhReady(logger);
|
|
24
|
+
runOrExit("gh", ["repo", "clone", ghCloneTarget(bundle, options.ssh), options.directory], parent, logger, "gh repo clone");
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
const url = options.ssh ? bundle.sshUrl : bundle.url;
|
|
28
|
+
runOrExit("git", ["clone", url, options.directory], parent, logger, "git clone");
|
|
29
|
+
}
|
|
30
|
+
logger.info(`Cloned umbrella repo to ${target}`);
|
|
31
|
+
logger.info(`cd ${options.directory}`);
|
|
32
|
+
logger.info("Then run: blt init -w -s # or blt init -b -s");
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../../src/commands/init/root.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAS7D,SAAS,SAAS,CAChB,OAAe,EACf,IAAc,EACd,GAAW,EACX,MAAc,EACd,KAAa;IAEb,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IACnE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,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C,IAAI,CAAC,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IACvC,MAAM,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAI7C;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,OAAO,EAAE,OAAO,QA0GnD"}
|
package/dist/commands/init.js
CHANGED
|
@@ -1,8 +1,49 @@
|
|
|
1
1
|
import { generateInitScript } from "./init/script";
|
|
2
|
+
import { cloneUmbrellaRoot } from "./init/root";
|
|
2
3
|
/**
|
|
3
4
|
* Register init command with the CLI program
|
|
4
5
|
*/
|
|
5
6
|
export default function initCommand(program) {
|
|
7
|
+
const initRootHelpText = `
|
|
8
|
+
Clone the BLT umbrella repository (bltcore-com/blt)
|
|
9
|
+
|
|
10
|
+
Usage:
|
|
11
|
+
blt init root [options]
|
|
12
|
+
|
|
13
|
+
Equivalent to:
|
|
14
|
+
git clone git@github.com:bltcore-com/blt.git blt
|
|
15
|
+
cd blt
|
|
16
|
+
|
|
17
|
+
Then generate getblt.sh from inside the clone:
|
|
18
|
+
blt init -w -s
|
|
19
|
+
|
|
20
|
+
Example:
|
|
21
|
+
blt init root -s
|
|
22
|
+
cd blt
|
|
23
|
+
blt init -w -s
|
|
24
|
+
./getblt.sh
|
|
25
|
+
`;
|
|
26
|
+
program
|
|
27
|
+
.command("init root", "clone umbrella blt repo")
|
|
28
|
+
.help(initRootHelpText)
|
|
29
|
+
.option("-d, --directory <name>", "Directory name for the clone", {
|
|
30
|
+
default: "blt",
|
|
31
|
+
})
|
|
32
|
+
.option("-p, --parent <path>", "Parent directory to clone into", {
|
|
33
|
+
default: ".",
|
|
34
|
+
})
|
|
35
|
+
.option("-s, --ssh", "Use SSH URL instead of HTTPS", { default: false })
|
|
36
|
+
.option("-g, --gh", "Use GitHub CLI (gh repo clone) instead of git clone", {
|
|
37
|
+
default: false,
|
|
38
|
+
})
|
|
39
|
+
.action(async ({ options, logger }) => {
|
|
40
|
+
await cloneUmbrellaRoot({
|
|
41
|
+
directory: options.directory,
|
|
42
|
+
parent: options.parent,
|
|
43
|
+
ssh: options.ssh,
|
|
44
|
+
gh: options.gh,
|
|
45
|
+
}, logger);
|
|
46
|
+
});
|
|
6
47
|
const initHelpText = `
|
|
7
48
|
Initialize a BLT workspace by creating a script to clone/pull all projects
|
|
8
49
|
|
|
@@ -22,10 +63,9 @@ With -c, adds sqltools.connections from SUPABASE_* vars in .env (requires -w or
|
|
|
22
63
|
With -g, use GitHub CLI (gh repo clone) instead of git clone. Requires gh auth login.
|
|
23
64
|
|
|
24
65
|
Example:
|
|
25
|
-
blt init
|
|
26
|
-
blt
|
|
27
|
-
blt init -
|
|
28
|
-
blt init -g
|
|
66
|
+
blt init root -s
|
|
67
|
+
cd blt
|
|
68
|
+
blt init -w -s
|
|
29
69
|
./getblt.sh
|
|
30
70
|
|
|
31
71
|
Repository list: bundled src/lib/repositories.manifest.json, or override with
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,WA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