@geekmidas/cli 10.0.0-alpha.94 → 10.0.0-alpha.95
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/dist/{GoDaddyProvider-BRZUWD8z.mjs → GoDaddyProvider-BwW51hPm.mjs} +3 -3
- package/dist/{GoDaddyProvider-BRZUWD8z.mjs.map → GoDaddyProvider-BwW51hPm.mjs.map} +1 -1
- package/dist/{GoDaddyProvider-DzguxU_a.cjs → GoDaddyProvider-C_DgIkMv.cjs} +3 -3
- package/dist/{GoDaddyProvider-DzguxU_a.cjs.map → GoDaddyProvider-C_DgIkMv.cjs.map} +1 -1
- package/dist/{HostingerProvider-Cjh_2Ml6.mjs → HostingerProvider-BNpS9aRJ.mjs} +2 -2
- package/dist/{HostingerProvider-Cjh_2Ml6.mjs.map → HostingerProvider-BNpS9aRJ.mjs.map} +1 -1
- package/dist/{HostingerProvider-OdQmKXE3.cjs → HostingerProvider-DR1iws1P.cjs} +2 -2
- package/dist/{HostingerProvider-OdQmKXE3.cjs.map → HostingerProvider-DR1iws1P.cjs.map} +1 -1
- package/dist/{LegacyStateStore-D50dgUPc.cjs → LegacyStateStore-BawjE_5n.cjs} +3 -3
- package/dist/{LegacyStateStore-D50dgUPc.cjs.map → LegacyStateStore-BawjE_5n.cjs.map} +1 -1
- package/dist/{LegacyStateStore-BQZb6-j2.mjs → LegacyStateStore-D5DarNA2.mjs} +3 -3
- package/dist/{LegacyStateStore-BQZb6-j2.mjs.map → LegacyStateStore-D5DarNA2.mjs.map} +1 -1
- package/dist/{LocalStateStore-EFBUjuMX.cjs → LocalStateStore-D8fu5WiF.cjs} +2 -2
- package/dist/{LocalStateStore-EFBUjuMX.cjs.map → LocalStateStore-D8fu5WiF.cjs.map} +1 -1
- package/dist/{LocalStateStore-BSaS2535.mjs → LocalStateStore-YjIqlgAz.mjs} +2 -2
- package/dist/{LocalStateStore-BSaS2535.mjs.map → LocalStateStore-YjIqlgAz.mjs.map} +1 -1
- package/dist/{S3StateStore-CrFq4UZU.mjs → S3StateStore-CjTAVsWh.mjs} +2 -2
- package/dist/{S3StateStore-CrFq4UZU.mjs.map → S3StateStore-CjTAVsWh.mjs.map} +1 -1
- package/dist/{S3StateStore-C5mv8To3.cjs → S3StateStore-Cm-v2IPI.cjs} +2 -2
- package/dist/{S3StateStore-C5mv8To3.cjs.map → S3StateStore-Cm-v2IPI.cjs.map} +1 -1
- package/dist/{SSMStateStore-DuZCH7_v.cjs → SSMStateStore-BS4BiZCN.cjs} +2 -2
- package/dist/{SSMStateStore-DuZCH7_v.cjs.map → SSMStateStore-BS4BiZCN.cjs.map} +1 -1
- package/dist/{SSMStateStore-D3Z6mZnA.mjs → SSMStateStore-BhtM6jOh.mjs} +2 -2
- package/dist/{SSMStateStore-D3Z6mZnA.mjs.map → SSMStateStore-BhtM6jOh.mjs.map} +1 -1
- package/dist/{add-DsVDdvon.cjs → add-D-3IKT7W.cjs} +22 -51
- package/dist/add-D-3IKT7W.cjs.map +1 -0
- package/dist/{add-C85isXFl.mjs → add-ylx8dejw.mjs} +21 -50
- package/dist/add-ylx8dejw.mjs.map +1 -0
- package/dist/{bundler-BEgUKc4j.cjs → bundler-CI3elfZS.cjs} +5 -5
- package/dist/{bundler-BEgUKc4j.cjs.map → bundler-CI3elfZS.cjs.map} +1 -1
- package/dist/{bundler-BSHog8CH.mjs → bundler-ywR3C1B_.mjs} +5 -5
- package/dist/{bundler-BSHog8CH.mjs.map → bundler-ywR3C1B_.mjs.map} +1 -1
- package/dist/{cli-BsFenyaf.mjs → cli-BCSuCfQk.mjs} +4 -4
- package/dist/{cli-BsFenyaf.mjs.map → cli-BCSuCfQk.mjs.map} +1 -1
- package/dist/{cli-BvBdv660.cjs → cli-Dewt2T21.cjs} +4 -4
- package/dist/{cli-BvBdv660.cjs.map → cli-Dewt2T21.cjs.map} +1 -1
- package/dist/{compose-D2RFYd_f.mjs → compose-C4js1JDv.mjs} +42 -46
- package/dist/compose-C4js1JDv.mjs.map +1 -0
- package/dist/{compose-Cd09gW-n.cjs → compose-Dd0XphvF.cjs} +59 -63
- package/dist/compose-Dd0XphvF.cjs.map +1 -0
- package/dist/{config-Ngesg4O8.d.mts → config-4yirvxS8.d.cts} +4 -4
- package/dist/{config-DvHNMoOp.d.cts.map → config-4yirvxS8.d.cts.map} +1 -1
- package/dist/{config-DvHNMoOp.d.cts → config-C8NPCn1l.d.mts} +4 -4
- package/dist/{config-Ngesg4O8.d.mts.map → config-C8NPCn1l.d.mts.map} +1 -1
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- package/dist/{credentials-DpfnUvIR.mjs → credentials-B5N5yKk6.mjs} +4 -132
- package/dist/credentials-B5N5yKk6.mjs.map +1 -0
- package/dist/{credentials-D7XJypNd.cjs → credentials-Zqr3QQYB.cjs} +3 -173
- package/dist/credentials-Zqr3QQYB.cjs.map +1 -0
- package/dist/deploy/public.cjs +15 -14
- package/dist/deploy/public.cjs.map +1 -1
- package/dist/deploy/public.d.cts +5 -5
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +5 -5
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +10 -9
- package/dist/deploy/public.mjs.map +1 -1
- package/dist/{providers-sTj-BG0S.mjs → deploy-B0drCD6s.mjs} +898 -123
- package/dist/deploy-B0drCD6s.mjs.map +1 -0
- package/dist/{providers-BFeP_mYw.cjs → deploy-Bw1FjX_x.cjs} +939 -134
- package/dist/deploy-Bw1FjX_x.cjs.map +1 -0
- package/dist/{discover-CTzOSGUF.d.cts → discover-BtFofyQB.d.cts} +2 -2
- package/dist/{discover-CTzOSGUF.d.cts.map → discover-BtFofyQB.d.cts.map} +1 -1
- package/dist/{discover-CihAtaoj.d.mts → discover-D-MdXZgm.d.mts} +2 -2
- package/dist/{discover-CihAtaoj.d.mts.map → discover-D-MdXZgm.d.mts.map} +1 -1
- package/dist/dns-Bmk7P9c2.cjs +663 -0
- package/dist/dns-Bmk7P9c2.cjs.map +1 -0
- package/dist/dns-CyMIq6to.cjs +55 -0
- package/dist/dns-CyMIq6to.cjs.map +1 -0
- package/dist/dns-X3oqEV4C.mjs +44 -0
- package/dist/dns-X3oqEV4C.mjs.map +1 -0
- package/dist/dns-idXfyCay.mjs +610 -0
- package/dist/dns-idXfyCay.mjs.map +1 -0
- package/dist/{dokploy-D_aat2Xj.mjs → dokploy-CZYxXeMa.mjs} +2 -2
- package/dist/{dokploy-D_aat2Xj.mjs.map → dokploy-CZYxXeMa.mjs.map} +1 -1
- package/dist/{dokploy-CV7GcobZ.cjs → dokploy-DaT0mgLU.cjs} +2 -2
- package/dist/{dokploy-CV7GcobZ.cjs.map → dokploy-DaT0mgLU.cjs.map} +1 -1
- package/dist/{encryption-_4qKqtTx.mjs → encryption-D0ucY4O7.mjs} +2 -2
- package/dist/{encryption-_4qKqtTx.mjs.map → encryption-D0ucY4O7.mjs.map} +1 -1
- package/dist/{encryption-DFcivJaO.cjs → encryption-Dp0IvLVX.cjs} +2 -2
- package/dist/{encryption-DFcivJaO.cjs.map → encryption-Dp0IvLVX.cjs.map} +1 -1
- package/dist/{engine-DPMHThkg.mjs → engine-BcuhnyQO.mjs} +13 -31
- package/dist/{engine-DPMHThkg.mjs.map → engine-BcuhnyQO.mjs.map} +1 -1
- package/dist/{engine-Bv-LZpmj.cjs → engine-WY6j_kvA.cjs} +17 -35
- package/dist/engine-WY6j_kvA.cjs.map +1 -0
- package/dist/{github-xsDT19im.mjs → github-DUGA57du.mjs} +4 -2
- package/dist/{github-xsDT19im.mjs.map → github-DUGA57du.mjs.map} +1 -1
- package/dist/{github-Br42NMrW.cjs → github-DgmW83OP.cjs} +8 -6
- package/dist/{github-Br42NMrW.cjs.map → github-DgmW83OP.cjs.map} +1 -1
- package/dist/{index-CwLvFqtH.d.cts → index-5eL8rM6H.d.mts} +2 -2
- package/dist/{index-BlpcClwM.d.mts.map → index-5eL8rM6H.d.mts.map} +1 -1
- package/dist/{index-BlpcClwM.d.mts → index-Dz-gyjm_.d.cts} +2 -2
- package/dist/{index-CwLvFqtH.d.cts.map → index-Dz-gyjm_.d.cts.map} +1 -1
- package/dist/index.cjs +53 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +51 -50
- package/dist/index.mjs.map +1 -1
- package/dist/{local-B7Zv1NoA.mjs → local-BwC2v2Y8.mjs} +2 -2
- package/dist/{local-B7Zv1NoA.mjs.map → local-BwC2v2Y8.mjs.map} +1 -1
- package/dist/{local-OPC9BCZt.cjs → local-DNhnkugT.cjs} +3 -3
- package/dist/{local-OPC9BCZt.cjs.map → local-DNhnkugT.cjs.map} +1 -1
- package/dist/{migrate-SkWJotn5.cjs → migrate-BBcG1dhS.cjs} +2 -2
- package/dist/{migrate-SkWJotn5.cjs.map → migrate-BBcG1dhS.cjs.map} +1 -1
- package/dist/{migrate-DhvFPGLi.mjs → migrate-CZ-v5WV0.mjs} +2 -2
- package/dist/{migrate-DhvFPGLi.mjs.map → migrate-CZ-v5WV0.mjs.map} +1 -1
- package/dist/{migrate-B7evHv7O.mjs → migrate-D6PlNv2o.mjs} +2 -2
- package/dist/{migrate-B7evHv7O.mjs.map → migrate-D6PlNv2o.mjs.map} +1 -1
- package/dist/{migrate-D5jUz20_.cjs → migrate-afgRL3Hg.cjs} +2 -2
- package/dist/{migrate-D5jUz20_.cjs.map → migrate-afgRL3Hg.cjs.map} +1 -1
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/reconcile/public.d.cts +2 -2
- package/dist/reconcile/public.d.mts +2 -2
- package/dist/{resolve-CFEOtRsl.cjs → resolve-CFb4Navi.cjs} +4 -4
- package/dist/{resolve-CFEOtRsl.cjs.map → resolve-CFb4Navi.cjs.map} +1 -1
- package/dist/{resolve-Dyd1S2wn.mjs → resolve-DakDhr6Z.mjs} +4 -4
- package/dist/{resolve-Dyd1S2wn.mjs.map → resolve-DakDhr6Z.mjs.map} +1 -1
- package/dist/{rollback-D720SFhV.cjs → rollback-B-1dPP0m.cjs} +7 -8
- package/dist/{rollback-D720SFhV.cjs.map → rollback-B-1dPP0m.cjs.map} +1 -1
- package/dist/{rollback-NroNbGC0.mjs → rollback-B1TIpjdE.mjs} +6 -7
- package/dist/{rollback-NroNbGC0.mjs.map → rollback-B1TIpjdE.mjs.map} +1 -1
- package/dist/run-BJLIerMM.mjs +133 -0
- package/dist/run-BJLIerMM.mjs.map +1 -0
- package/dist/run-fVZ-rLnc.cjs +174 -0
- package/dist/run-fVZ-rLnc.cjs.map +1 -0
- package/dist/{runtime-VktAo_8B.d.cts → runtime-DUQdM-mW.d.cts} +2 -2
- package/dist/{runtime-BRCq6dQ7.d.mts.map → runtime-DUQdM-mW.d.cts.map} +1 -1
- package/dist/{runtime-BRCq6dQ7.d.mts → runtime-Vr6mleo2.d.mts} +2 -2
- package/dist/{runtime-VktAo_8B.d.cts.map → runtime-Vr6mleo2.d.mts.map} +1 -1
- package/dist/{sandbox-D1gd0iDz.d.cts → sandbox-BbJmh2rI.d.cts} +2 -2
- package/dist/{sandbox-D1gd0iDz.d.cts.map → sandbox-BbJmh2rI.d.cts.map} +1 -1
- package/dist/{sandbox-zHnRLCj0.d.mts → sandbox-DGOsMPMf.d.mts} +2 -2
- package/dist/{sandbox-zHnRLCj0.d.mts.map → sandbox-DGOsMPMf.d.mts.map} +1 -1
- package/dist/{secrets-DAvi_O9g.cjs → secrets-CPM0Qffe.cjs} +2 -2
- package/dist/{secrets-DAvi_O9g.cjs.map → secrets-CPM0Qffe.cjs.map} +1 -1
- package/dist/{secrets-CwLauUB_.mjs → secrets-oI9ClAPR.mjs} +2 -2
- package/dist/{secrets-CwLauUB_.mjs.map → secrets-oI9ClAPR.mjs.map} +1 -1
- package/dist/{seeds-BCg8X36S.cjs → seeds-CnXkgKUv.cjs} +192 -945
- package/dist/seeds-CnXkgKUv.cjs.map +1 -0
- package/dist/{seeds-CTxTZa-R.mjs → seeds-CoKkrSny.mjs} +156 -825
- package/dist/seeds-CoKkrSny.mjs.map +1 -0
- package/dist/{sniffer-DCcuzHz_.mjs → sniffer-CFRzIrby.mjs} +7 -7
- package/dist/{sniffer-DCcuzHz_.mjs.map → sniffer-CFRzIrby.mjs.map} +1 -1
- package/dist/{sniffer-C0z3NB2A.cjs → sniffer-vbiQ2Isn.cjs} +7 -7
- package/dist/{sniffer-C0z3NB2A.cjs.map → sniffer-vbiQ2Isn.cjs.map} +1 -1
- package/dist/{sst-DRDSDwOk.mjs → sst-CGdjHn2A.mjs} +4 -3
- package/dist/{sst-DRDSDwOk.mjs.map → sst-CGdjHn2A.mjs.map} +1 -1
- package/dist/{sst-DKNH243z.cjs → sst-DGuHDxVU.cjs} +5 -4
- package/dist/{sst-DKNH243z.cjs.map → sst-DGuHDxVU.cjs.map} +1 -1
- package/dist/{stack-B3fPDTBg.cjs → stack-1g57OfOw.cjs} +13 -51
- package/dist/stack-1g57OfOw.cjs.map +1 -0
- package/dist/{stack-NrdH5ngX.mjs → stack-B7O975TR.mjs} +13 -51
- package/dist/stack-B7O975TR.mjs.map +1 -0
- package/dist/{stages-veC4TcQe.mjs → stages-Bt4OggMm.mjs} +3 -2
- package/dist/{stages-veC4TcQe.mjs.map → stages-Bt4OggMm.mjs.map} +1 -1
- package/dist/{stages-CkqP1N4S.cjs → stages-BujUB4we.cjs} +4 -3
- package/dist/{stages-CkqP1N4S.cjs.map → stages-BujUB4we.cjs.map} +1 -1
- package/dist/target/public.cjs +1 -1
- package/dist/target/public.d.cts +2 -2
- package/dist/target/public.d.mts +2 -2
- package/dist/target/public.mjs +1 -1
- package/dist/{terminal-CkUYuAPd.cjs → terminal-CPHuH4S1.cjs} +2 -2
- package/dist/{terminal-CkUYuAPd.cjs.map → terminal-CPHuH4S1.cjs.map} +1 -1
- package/dist/{terminal-DAHs2Zko.mjs → terminal-iNmAXXjs.mjs} +2 -2
- package/dist/{terminal-DAHs2Zko.mjs.map → terminal-iNmAXXjs.mjs.map} +1 -1
- package/dist/{types-DMoaFrjg.d.mts → types-bkqVscdN.d.mts} +12 -3
- package/dist/types-bkqVscdN.d.mts.map +1 -0
- package/dist/{types-DXyaSmqu.d.cts → types-dipJRmKV.d.cts} +12 -3
- package/dist/types-dipJRmKV.d.cts.map +1 -0
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/package.json +15 -15
- package/dist/add-C85isXFl.mjs.map +0 -1
- package/dist/add-DsVDdvon.cjs.map +0 -1
- package/dist/compose-Cd09gW-n.cjs.map +0 -1
- package/dist/compose-D2RFYd_f.mjs.map +0 -1
- package/dist/credentials-D7XJypNd.cjs.map +0 -1
- package/dist/credentials-DpfnUvIR.mjs.map +0 -1
- package/dist/deploy-C911Akkn.cjs +0 -670
- package/dist/deploy-C911Akkn.cjs.map +0 -1
- package/dist/deploy-CeJ5D0xn.mjs +0 -641
- package/dist/deploy-CeJ5D0xn.mjs.map +0 -1
- package/dist/engine-Bv-LZpmj.cjs.map +0 -1
- package/dist/providers-BFeP_mYw.cjs.map +0 -1
- package/dist/providers-sTj-BG0S.mjs.map +0 -1
- package/dist/seeds-BCg8X36S.cjs.map +0 -1
- package/dist/seeds-CTxTZa-R.mjs.map +0 -1
- package/dist/stack-B3fPDTBg.cjs.map +0 -1
- package/dist/stack-NrdH5ngX.mjs.map +0 -1
- package/dist/types-DMoaFrjg.d.mts.map +0 -1
- package/dist/types-DXyaSmqu.d.cts.map +0 -1
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
let node_path = require("node:path");
|
|
2
|
+
let node_os = require("node:os");
|
|
3
|
+
let node_child_process = require("node:child_process");
|
|
4
|
+
//#region src/home.ts
|
|
5
|
+
/**
|
|
6
|
+
* Where the CLI keeps what belongs to a person rather than a project: stage
|
|
7
|
+
* keys and stored provider credentials.
|
|
8
|
+
*
|
|
9
|
+
* `GKM_HOME` names it, so a CI job, a shared build runner or a test can give
|
|
10
|
+
* every run its own instead of reaching into whoever's home directory the
|
|
11
|
+
* process happens to have. Unset, it is `~/.gkm`, where it has always been.
|
|
12
|
+
*/
|
|
13
|
+
/** The environment variable that moves the CLI's home. */
|
|
14
|
+
const GKM_HOME_ENV = "GKM_HOME";
|
|
15
|
+
/** The CLI's home: `GKM_HOME` if set, else `~/.gkm`. */
|
|
16
|
+
function gkmHome(env = process.env) {
|
|
17
|
+
const configured = env[GKM_HOME_ENV];
|
|
18
|
+
return configured ? (0, node_path.resolve)(configured) : (0, node_path.join)((0, node_os.homedir)(), ".gkm");
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/run.ts
|
|
22
|
+
/**
|
|
23
|
+
* Start a program with an argument array, never a shell string.
|
|
24
|
+
*
|
|
25
|
+
* `gkm build`, `gkm docker` and `gkm deploy` pass values that come from the
|
|
26
|
+
* workspace — image refs, tags, build args, package names — to `docker` and
|
|
27
|
+
* `turbo`. Joined into a string and handed to a shell, a package named
|
|
28
|
+
* `x;curl …|sh` or a tag holding `$(…)` became part of the command line, which
|
|
29
|
+
* matters most where the CLI builds a repository it didn't write: a CI job for a
|
|
30
|
+
* fork, a shared build runner. Here every value reaches the program as one
|
|
31
|
+
* `argv` element, whatever it contains.
|
|
32
|
+
*/
|
|
33
|
+
/** Long enough for a cold image build; short enough that a hung one ends. */
|
|
34
|
+
const DEFAULT_TIMEOUT_MS = 18e5;
|
|
35
|
+
/** How long a timed-out child has to exit on SIGTERM before it is killed. */
|
|
36
|
+
const KILL_GRACE_MS = 5e3;
|
|
37
|
+
/** The command line as a person would read it — for messages, never to run. */
|
|
38
|
+
function display(command, args) {
|
|
39
|
+
return [command, ...args].join(" ");
|
|
40
|
+
}
|
|
41
|
+
/** The program ran and exited unsuccessfully; its own output said why. */
|
|
42
|
+
var CommandFailed = class extends Error {
|
|
43
|
+
command;
|
|
44
|
+
args;
|
|
45
|
+
exitCode;
|
|
46
|
+
signal;
|
|
47
|
+
constructor(command, args, exitCode, signal) {
|
|
48
|
+
super(`\`${display(command, args)}\` ${exitCode === null ? `was stopped by ${signal ?? "a signal"}` : `exited with code ${exitCode}`}. Its output above says why; run it by hand to see it again.`);
|
|
49
|
+
this.command = command;
|
|
50
|
+
this.args = args;
|
|
51
|
+
this.exitCode = exitCode;
|
|
52
|
+
this.signal = signal;
|
|
53
|
+
this.name = "CommandFailed";
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
/** The program ran past its timeout and was killed. */
|
|
57
|
+
var CommandTimedOut = class extends Error {
|
|
58
|
+
command;
|
|
59
|
+
args;
|
|
60
|
+
timeoutMs;
|
|
61
|
+
constructor(command, args, timeoutMs) {
|
|
62
|
+
super(`\`${display(command, args)}\` was still running after ${Math.round(timeoutMs / 1e3)}s and was stopped. Check what it was waiting on — a registry, the Docker daemon, a prompt — and run it again.`);
|
|
63
|
+
this.command = command;
|
|
64
|
+
this.args = args;
|
|
65
|
+
this.timeoutMs = timeoutMs;
|
|
66
|
+
this.name = "CommandTimedOut";
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Run `command` with `args`, resolving when it exits 0.
|
|
71
|
+
*
|
|
72
|
+
* Rejects with {@link CommandFailed} on any other exit, {@link CommandTimedOut}
|
|
73
|
+
* once `timeoutMs` passes (after the child is gone), and with the spawn error
|
|
74
|
+
* itself when the program cannot be started at all — `ENOENT` already names it.
|
|
75
|
+
*/
|
|
76
|
+
async function run(command, args, options = {}) {
|
|
77
|
+
await spawnChild(command, args, options, false);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* {@link run}, resolving with what the program wrote to stdout — for a value
|
|
81
|
+
* the CLI reads back, such as the digest `docker inspect` reports. stderr still
|
|
82
|
+
* reaches the terminal, so a failure explains itself the same way.
|
|
83
|
+
*/
|
|
84
|
+
function runOutput(command, args, options = {}) {
|
|
85
|
+
return spawnChild(command, args, options, true);
|
|
86
|
+
}
|
|
87
|
+
function spawnChild(command, args, options, capture) {
|
|
88
|
+
const { timeoutMs = DEFAULT_TIMEOUT_MS, ...spawnOptions } = options;
|
|
89
|
+
return new Promise((resolve, reject) => {
|
|
90
|
+
const child = (0, node_child_process.spawn)(command, [...args], {
|
|
91
|
+
stdio: "inherit",
|
|
92
|
+
...spawnOptions,
|
|
93
|
+
...capture ? { stdio: [
|
|
94
|
+
"ignore",
|
|
95
|
+
"pipe",
|
|
96
|
+
"inherit"
|
|
97
|
+
] } : {},
|
|
98
|
+
shell: false
|
|
99
|
+
});
|
|
100
|
+
let stdout = "";
|
|
101
|
+
child.stdout?.on("data", (chunk) => {
|
|
102
|
+
stdout += chunk.toString();
|
|
103
|
+
});
|
|
104
|
+
let timedOut = false;
|
|
105
|
+
let killer;
|
|
106
|
+
const timer = setTimeout(() => {
|
|
107
|
+
timedOut = true;
|
|
108
|
+
child.kill("SIGTERM");
|
|
109
|
+
killer = setTimeout(() => child.kill("SIGKILL"), KILL_GRACE_MS);
|
|
110
|
+
killer.unref?.();
|
|
111
|
+
}, timeoutMs);
|
|
112
|
+
timer.unref?.();
|
|
113
|
+
const settle = () => {
|
|
114
|
+
clearTimeout(timer);
|
|
115
|
+
if (killer) clearTimeout(killer);
|
|
116
|
+
};
|
|
117
|
+
child.on("error", (error) => {
|
|
118
|
+
settle();
|
|
119
|
+
reject(spawnOptions.signal?.aborted ? spawnOptions.signal.reason : error);
|
|
120
|
+
});
|
|
121
|
+
child.on("close", (code, signal) => {
|
|
122
|
+
settle();
|
|
123
|
+
if (spawnOptions.signal?.aborted) reject(spawnOptions.signal.reason);
|
|
124
|
+
else if (timedOut) reject(new CommandTimedOut(command, args, timeoutMs));
|
|
125
|
+
else if (code === 0) resolve(stdout);
|
|
126
|
+
else reject(new CommandFailed(command, args, code, signal));
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
Object.defineProperty(exports, "CommandFailed", {
|
|
132
|
+
enumerable: true,
|
|
133
|
+
get: function() {
|
|
134
|
+
return CommandFailed;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
Object.defineProperty(exports, "CommandTimedOut", {
|
|
138
|
+
enumerable: true,
|
|
139
|
+
get: function() {
|
|
140
|
+
return CommandTimedOut;
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
Object.defineProperty(exports, "DEFAULT_TIMEOUT_MS", {
|
|
144
|
+
enumerable: true,
|
|
145
|
+
get: function() {
|
|
146
|
+
return DEFAULT_TIMEOUT_MS;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
Object.defineProperty(exports, "GKM_HOME_ENV", {
|
|
150
|
+
enumerable: true,
|
|
151
|
+
get: function() {
|
|
152
|
+
return GKM_HOME_ENV;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
Object.defineProperty(exports, "gkmHome", {
|
|
156
|
+
enumerable: true,
|
|
157
|
+
get: function() {
|
|
158
|
+
return gkmHome;
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
Object.defineProperty(exports, "run", {
|
|
162
|
+
enumerable: true,
|
|
163
|
+
get: function() {
|
|
164
|
+
return run;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
Object.defineProperty(exports, "runOutput", {
|
|
168
|
+
enumerable: true,
|
|
169
|
+
get: function() {
|
|
170
|
+
return runOutput;
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
//# sourceMappingURL=run-fVZ-rLnc.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-fVZ-rLnc.cjs","names":["resolve","join","homedir","spawn"],"sources":["../src/home.ts","../src/run.ts"],"sourcesContent":["/**\n * Where the CLI keeps what belongs to a person rather than a project: stage\n * keys and stored provider credentials.\n *\n * `GKM_HOME` names it, so a CI job, a shared build runner or a test can give\n * every run its own instead of reaching into whoever's home directory the\n * process happens to have. Unset, it is `~/.gkm`, where it has always been.\n */\n\nimport { homedir } from 'node:os';\nimport { join, resolve } from 'node:path';\n\n/** The environment variable that moves the CLI's home. */\nexport const GKM_HOME_ENV = 'GKM_HOME';\n\n/** The CLI's home: `GKM_HOME` if set, else `~/.gkm`. */\nexport function gkmHome(env: NodeJS.ProcessEnv = process.env): string {\n\tconst configured = env[GKM_HOME_ENV];\n\treturn configured ? resolve(configured) : join(homedir(), '.gkm');\n}\n","/**\n * Start a program with an argument array, never a shell string.\n *\n * `gkm build`, `gkm docker` and `gkm deploy` pass values that come from the\n * workspace — image refs, tags, build args, package names — to `docker` and\n * `turbo`. Joined into a string and handed to a shell, a package named\n * `x;curl …|sh` or a tag holding `$(…)` became part of the command line, which\n * matters most where the CLI builds a repository it didn't write: a CI job for a\n * fork, a shared build runner. Here every value reaches the program as one\n * `argv` element, whatever it contains.\n */\n\nimport { type SpawnOptions, spawn } from 'node:child_process';\n\n/** Long enough for a cold image build; short enough that a hung one ends. */\nexport const DEFAULT_TIMEOUT_MS = 30 * 60_000;\n\n/** How long a timed-out child has to exit on SIGTERM before it is killed. */\nconst KILL_GRACE_MS = 5_000;\n\nexport interface RunOptions {\n\tcwd?: string;\n\tenv?: NodeJS.ProcessEnv;\n\tstdio?: SpawnOptions['stdio'];\n\t/** Kill the child after this long. Defaults to {@link DEFAULT_TIMEOUT_MS}. */\n\ttimeoutMs?: number;\n\t/**\n\t * Kills the child when aborted, and rejects with the signal's reason — the\n\t * same as a stopped deploy's other calls.\n\t */\n\tsignal?: AbortSignal;\n}\n\n/** The command line as a person would read it — for messages, never to run. */\nfunction display(command: string, args: readonly string[]): string {\n\treturn [command, ...args].join(' ');\n}\n\n/** The program ran and exited unsuccessfully; its own output said why. */\nexport class CommandFailed extends Error {\n\tconstructor(\n\t\treadonly command: string,\n\t\treadonly args: readonly string[],\n\t\treadonly exitCode: number | null,\n\t\treadonly signal: NodeJS.Signals | null,\n\t) {\n\t\tsuper(\n\t\t\t`\\`${display(command, args)}\\` ${exitCode === null ? `was stopped by ${signal ?? 'a signal'}` : `exited with code ${exitCode}`}. Its output above says why; run it by hand to see it again.`,\n\t\t);\n\t\tthis.name = 'CommandFailed';\n\t}\n}\n\n/** The program ran past its timeout and was killed. */\nexport class CommandTimedOut extends Error {\n\tconstructor(\n\t\treadonly command: string,\n\t\treadonly args: readonly string[],\n\t\treadonly timeoutMs: number,\n\t) {\n\t\tsuper(\n\t\t\t`\\`${display(command, args)}\\` was still running after ${Math.round(timeoutMs / 1000)}s and was stopped. Check what it was waiting on — a registry, the Docker daemon, a prompt — and run it again.`,\n\t\t);\n\t\tthis.name = 'CommandTimedOut';\n\t}\n}\n\n/**\n * Run `command` with `args`, resolving when it exits 0.\n *\n * Rejects with {@link CommandFailed} on any other exit, {@link CommandTimedOut}\n * once `timeoutMs` passes (after the child is gone), and with the spawn error\n * itself when the program cannot be started at all — `ENOENT` already names it.\n */\nexport async function run(\n\tcommand: string,\n\targs: readonly string[],\n\toptions: RunOptions = {},\n): Promise<void> {\n\tawait spawnChild(command, args, options, false);\n}\n\n/**\n * {@link run}, resolving with what the program wrote to stdout — for a value\n * the CLI reads back, such as the digest `docker inspect` reports. stderr still\n * reaches the terminal, so a failure explains itself the same way.\n */\nexport function runOutput(\n\tcommand: string,\n\targs: readonly string[],\n\toptions: Omit<RunOptions, 'stdio'> = {},\n): Promise<string> {\n\treturn spawnChild(command, args, options, true);\n}\n\nfunction spawnChild(\n\tcommand: string,\n\targs: readonly string[],\n\toptions: RunOptions,\n\tcapture: boolean,\n): Promise<string> {\n\tconst { timeoutMs = DEFAULT_TIMEOUT_MS, ...spawnOptions } = options;\n\n\treturn new Promise<string>((resolve, reject) => {\n\t\tconst child = spawn(command, [...args], {\n\t\t\tstdio: 'inherit',\n\t\t\t...spawnOptions,\n\t\t\t...(capture ? { stdio: ['ignore', 'pipe', 'inherit'] } : {}),\n\t\t\tshell: false,\n\t\t});\n\n\t\tlet stdout = '';\n\t\tchild.stdout?.on('data', (chunk: Buffer) => {\n\t\t\tstdout += chunk.toString();\n\t\t});\n\n\t\tlet timedOut = false;\n\t\tlet killer: NodeJS.Timeout | undefined;\n\t\tconst timer = setTimeout(() => {\n\t\t\ttimedOut = true;\n\t\t\tchild.kill('SIGTERM');\n\t\t\t// A child that ignores SIGTERM would hold the deploy open forever.\n\t\t\tkiller = setTimeout(() => child.kill('SIGKILL'), KILL_GRACE_MS);\n\t\t\tkiller.unref?.();\n\t\t}, timeoutMs);\n\t\ttimer.unref?.();\n\n\t\tconst settle = () => {\n\t\t\tclearTimeout(timer);\n\t\t\tif (killer) clearTimeout(killer);\n\t\t};\n\n\t\tchild.on('error', (error) => {\n\t\t\tsettle();\n\t\t\t// Node reports an abort as its own `AbortError`; the caller asked\n\t\t\t// with a reason, and that is what it should get back.\n\t\t\treject(spawnOptions.signal?.aborted ? spawnOptions.signal.reason : error);\n\t\t});\n\n\t\tchild.on('close', (code: number | null, signal: NodeJS.Signals | null) => {\n\t\t\tsettle();\n\t\t\tif (spawnOptions.signal?.aborted) reject(spawnOptions.signal.reason);\n\t\t\telse if (timedOut) reject(new CommandTimedOut(command, args, timeoutMs));\n\t\t\telse if (code === 0) resolve(stdout);\n\t\t\telse reject(new CommandFailed(command, args, code, signal));\n\t\t});\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAa,eAAe;;AAG5B,SAAgB,QAAQ,MAAyB,QAAQ,KAAa;CACrE,MAAM,aAAa,IAAI;CACvB,OAAO,cAAA,GAAaA,UAAAA,QAAAA,CAAQ,UAAU,KAAA,GAAIC,UAAAA,KAAAA,EAAAA,GAAKC,QAAAA,QAAAA,CAAQ,GAAG,MAAM;AACjE;;;;;;;;;;;;;;;ACJA,MAAa,qBAAqB;;AAGlC,MAAM,gBAAgB;;AAgBtB,SAAS,QAAQ,SAAiB,MAAiC;CAClE,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,KAAK,GAAG;AACnC;;AAGA,IAAa,gBAAb,cAAmC,MAAM;CAE9B;CACA;CACA;CACA;CAJV,YACC,SACA,MACA,UACA,QACC;EACD,MACC,KAAK,QAAQ,SAAS,IAAI,EAAE,KAAK,aAAa,OAAO,kBAAkB,UAAU,eAAe,oBAAoB,WAAW,6DAChI;EAPS,KAAA,UAAA;EACA,KAAA,OAAA;EACA,KAAA,WAAA;EACA,KAAA,SAAA;EAKT,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,kBAAb,cAAqC,MAAM;CAEhC;CACA;CACA;CAHV,YACC,SACA,MACA,WACC;EACD,MACC,KAAK,QAAQ,SAAS,IAAI,EAAE,6BAA6B,KAAK,MAAM,YAAY,GAAI,EAAE,8GACvF;EANS,KAAA,UAAA;EACA,KAAA,OAAA;EACA,KAAA,YAAA;EAKT,KAAK,OAAO;CACb;AACD;;;;;;;;AASA,eAAsB,IACrB,SACA,MACA,UAAsB,CAAC,GACP;CAChB,MAAM,WAAW,SAAS,MAAM,SAAS,KAAK;AAC/C;;;;;;AAOA,SAAgB,UACf,SACA,MACA,UAAqC,CAAC,GACpB;CAClB,OAAO,WAAW,SAAS,MAAM,SAAS,IAAI;AAC/C;AAEA,SAAS,WACR,SACA,MACA,SACA,SACkB;CAClB,MAAM,EAAE,YAAY,oBAAoB,GAAG,iBAAiB;CAE5D,OAAO,IAAI,SAAiB,SAAS,WAAW;EAC/C,MAAM,SAAA,GAAQC,mBAAAA,MAAAA,CAAM,SAAS,CAAC,GAAG,IAAI,GAAG;GACvC,OAAO;GACP,GAAG;GACH,GAAI,UAAU,EAAE,OAAO;IAAC;IAAU;IAAQ;GAAS,EAAE,IAAI,CAAC;GAC1D,OAAO;EACR,CAAC;EAED,IAAI,SAAS;EACb,MAAM,QAAQ,GAAG,SAAS,UAAkB;GAC3C,UAAU,MAAM,SAAS;EAC1B,CAAC;EAED,IAAI,WAAW;EACf,IAAI;EACJ,MAAM,QAAQ,iBAAiB;GAC9B,WAAW;GACX,MAAM,KAAK,SAAS;GAEpB,SAAS,iBAAiB,MAAM,KAAK,SAAS,GAAG,aAAa;GAC9D,OAAO,QAAQ;EAChB,GAAG,SAAS;EACZ,MAAM,QAAQ;EAEd,MAAM,eAAe;GACpB,aAAa,KAAK;GAClB,IAAI,QAAQ,aAAa,MAAM;EAChC;EAEA,MAAM,GAAG,UAAU,UAAU;GAC5B,OAAO;GAGP,OAAO,aAAa,QAAQ,UAAU,aAAa,OAAO,SAAS,KAAK;EACzE,CAAC;EAED,MAAM,GAAG,UAAU,MAAqB,WAAkC;GACzE,OAAO;GACP,IAAI,aAAa,QAAQ,SAAS,OAAO,aAAa,OAAO,MAAM;QAC9D,IAAI,UAAU,OAAO,IAAI,gBAAgB,SAAS,MAAM,SAAS,CAAC;QAClE,IAAI,SAAS,GAAG,QAAQ,MAAM;QAC9B,OAAO,IAAI,cAAc,SAAS,MAAM,MAAM,MAAM,CAAC;EAC3D,CAAC;CACF,CAAC;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { K as DeployRuntime, et as TargetOptionsIssue, jt as GkmError } from "./types-
|
|
1
|
+
import { K as DeployRuntime, et as TargetOptionsIssue, jt as GkmError } from "./types-dipJRmKV.cjs";
|
|
2
2
|
//#region src/target/builtins.d.ts
|
|
3
3
|
/** A target name that is neither built in nor in `deploy.targets`. */
|
|
4
4
|
declare class UnknownDeployTarget extends GkmError {
|
|
@@ -79,4 +79,4 @@ declare class TargetRuntimeUndeclared extends GkmError {
|
|
|
79
79
|
}
|
|
80
80
|
//#endregion
|
|
81
81
|
export { TargetRuntimeMismatch as a, DeployTargetNotYetSupported as c, TargetPackageInvalid as i, UnknownDeployTarget as l, InvalidTargetOptions as n, ProviderRemoved as o, TargetEntryInvalid as r, TargetPackageNotFound as s, TargetRuntimeUndeclared as t };
|
|
82
|
-
//# sourceMappingURL=runtime-
|
|
82
|
+
//# sourceMappingURL=runtime-DUQdM-mW.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-
|
|
1
|
+
{"version":3,"file":"runtime-DUQdM-mW.d.cts","names":[],"sources":["../src/target/builtins.ts","../src/target/package.ts","../src/target/provider.ts","../src/target/resolve.ts","../src/target/runtime.ts"],"mappings":";;;cAgEa,4BAA4B;WAE9B;;WAEA;EAHV,YACU,gBAEA;;EAAA;;;cAUE,oCAAoC;WAEtC;;WAEA;EAHV,YACU,gBAEA;;EAAA;;;;;cCrDE,8BAA8B;WAEhC;WACA;WACA;EAHV,YACU,gBACA,qBACA;;;;;cCZE,wBAAwB;WAE1B;;WAEA;EAHV,YACU,kBAEA;;EAAA;;;;;cCoCE,6BAA6B;WAE/B;WACA;EAFV,YACU,gBACA;;;cAUE,2BAA2B;WAClB;EAArB,YAAqB;;;cAST,8BAA8B;WAEhC;WACA;WACA,UAAU;WACV,QAAQ;EAJlB,YACU,gBACA,qBACA,UAAU,eACV,QAAQ;;;cAUN,6BAA6B;WAE/B;WACA,iBAAiB;EAF3B,YACU,gBACA,iBAAiB;;;;;cC1Ef,gCAAgC;WAElC;WACA;;WAEA;EAJV,YACU,gBACA,qBAEA;;EAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { K as DeployRuntime, et as TargetOptionsIssue, jt as GkmError } from "./types-
|
|
1
|
+
import { K as DeployRuntime, et as TargetOptionsIssue, jt as GkmError } from "./types-bkqVscdN.mjs";
|
|
2
2
|
//#region src/target/builtins.d.ts
|
|
3
3
|
/** A target name that is neither built in nor in `deploy.targets`. */
|
|
4
4
|
declare class UnknownDeployTarget extends GkmError {
|
|
@@ -79,4 +79,4 @@ declare class TargetRuntimeUndeclared extends GkmError {
|
|
|
79
79
|
}
|
|
80
80
|
//#endregion
|
|
81
81
|
export { TargetRuntimeMismatch as a, DeployTargetNotYetSupported as c, TargetPackageInvalid as i, UnknownDeployTarget as l, InvalidTargetOptions as n, ProviderRemoved as o, TargetEntryInvalid as r, TargetPackageNotFound as s, TargetRuntimeUndeclared as t };
|
|
82
|
-
//# sourceMappingURL=runtime-
|
|
82
|
+
//# sourceMappingURL=runtime-Vr6mleo2.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-
|
|
1
|
+
{"version":3,"file":"runtime-Vr6mleo2.d.mts","names":[],"sources":["../src/target/builtins.ts","../src/target/package.ts","../src/target/provider.ts","../src/target/resolve.ts","../src/target/runtime.ts"],"mappings":";;;cAgEa,4BAA4B;WAE9B;;WAEA;EAHV,YACU,gBAEA;;EAAA;;;cAUE,oCAAoC;WAEtC;;WAEA;EAHV,YACU,gBAEA;;EAAA;;;;;cCrDE,8BAA8B;WAEhC;WACA;WACA;EAHV,YACU,gBACA,qBACA;;;;;cCZE,wBAAwB;WAE1B;;WAEA;EAHV,YACU,kBAEA;;EAAA;;;;;cCoCE,6BAA6B;WAE/B;WACA;EAFV,YACU,gBACA;;;cAUE,2BAA2B;WAClB;EAArB,YAAqB;;;cAST,8BAA8B;WAEhC;WACA;WACA,UAAU;WACV,QAAQ;EAJlB,YACU,gBACA,qBACA,UAAU,eACV,QAAQ;;;cAUN,6BAA6B;WAE/B;WACA,iBAAiB;EAF3B,YACU,gBACA,iBAAiB;;;;;cC1Ef,gCAAgC;WAElC;WACA;;WAEA;EAJV,YACU,gBACA,qBAEA;;EAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jt as GkmError } from "./types-
|
|
1
|
+
import { jt as GkmError } from "./types-dipJRmKV.cjs";
|
|
2
2
|
//#region src/sandbox/sandbox.d.ts
|
|
3
3
|
/** Where a command's output goes. */
|
|
4
4
|
type SandboxOutput = 'capture' | 'inherit' | 'stderr' | 'ignore';
|
|
@@ -101,4 +101,4 @@ declare class SecretNameInvalid extends GkmError {
|
|
|
101
101
|
}
|
|
102
102
|
//#endregion
|
|
103
103
|
export { SandboxOutput as a, confineCwd as c, SandboxExecOptions as i, Sandbox as n, SandboxResult as o, SandboxCwdEscape as r, SecretNameInvalid as s, SECRETS_DIR_ENV as t };
|
|
104
|
-
//# sourceMappingURL=sandbox-
|
|
104
|
+
//# sourceMappingURL=sandbox-BbJmh2rI.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-
|
|
1
|
+
{"version":3,"file":"sandbox-BbJmh2rI.d.cts","names":[],"sources":["../src/sandbox/sandbox.ts"],"mappings":";;;KA8BY;UAEK;;;;;;EAMhB;;;;;EAKA,KAAK,SAAS;;;;;;EAMd;;;;;;;EAOA,UAAU,SAAS;;;;;;EAMnB,SAAS;;EAET,SAAS;;;UAIO;EAChB;EACA;;EAEA;;EAEA;;;;;;;;;;;UAYgB;;WAEP;;;;;;;;;;;;;WAaA;;;;;WAKA,KAAK,SAAS;EACvB,KACC,iBACA,yBACA,SAAS,qBACP,QAAQ;;;cAIC;;cAGA,yBAAyB;WAE3B;WACA;EAFV,YACU,aACA;;;;;;;;;;iBAwBK,WAAW,cAAc;;cAU5B,0BAA0B;WACjB;EAArB,YAAqB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jt as GkmError } from "./types-
|
|
1
|
+
import { jt as GkmError } from "./types-bkqVscdN.mjs";
|
|
2
2
|
//#region src/sandbox/sandbox.d.ts
|
|
3
3
|
/** Where a command's output goes. */
|
|
4
4
|
type SandboxOutput = 'capture' | 'inherit' | 'stderr' | 'ignore';
|
|
@@ -101,4 +101,4 @@ declare class SecretNameInvalid extends GkmError {
|
|
|
101
101
|
}
|
|
102
102
|
//#endregion
|
|
103
103
|
export { SandboxOutput as a, confineCwd as c, SandboxExecOptions as i, Sandbox as n, SandboxResult as o, SandboxCwdEscape as r, SecretNameInvalid as s, SECRETS_DIR_ENV as t };
|
|
104
|
-
//# sourceMappingURL=sandbox-
|
|
104
|
+
//# sourceMappingURL=sandbox-DGOsMPMf.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-
|
|
1
|
+
{"version":3,"file":"sandbox-DGOsMPMf.d.mts","names":[],"sources":["../src/sandbox/sandbox.ts"],"mappings":";;;KA8BY;UAEK;;;;;;EAMhB;;;;;EAKA,KAAK,SAAS;;;;;;EAMd;;;;;;;EAOA,UAAU,SAAS;;;;;;EAMnB,SAAS;;EAET,SAAS;;;UAIO;EAChB;EACA;;EAEA;;EAEA;;;;;;;;;;;UAYgB;;WAEP;;;;;;;;;;;;;WAaA;;;;;WAKA,KAAK,SAAS;EACvB,KACC,iBACA,yBACA,SAAS,qBACP,QAAQ;;;cAIC;;cAGA,yBAAyB;WAE3B;WACA;EAFV,YACU,aACA;;;;;;;;;;iBAwBK,WAAW,cAAc;;cAU5B,0BAA0B;WACjB;EAArB,YAAqB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
2
2
|
const require_workspace = require("./workspace-cSyi5nb1.cjs");
|
|
3
|
-
const require_seeds = require("./seeds-
|
|
3
|
+
const require_seeds = require("./seeds-CnXkgKUv.cjs");
|
|
4
4
|
//#region src/compose/secrets.ts
|
|
5
5
|
var secrets_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({ deployedStackSecrets: () => deployedStackSecrets });
|
|
6
6
|
function deployedStackSecrets(workspace, stage, stored, manifest) {
|
|
@@ -44,4 +44,4 @@ Object.defineProperty(exports, "secrets_exports", {
|
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
//# sourceMappingURL=secrets-
|
|
47
|
+
//# sourceMappingURL=secrets-CPM0Qffe.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secrets-
|
|
1
|
+
{"version":3,"file":"secrets-CPM0Qffe.cjs","names":["withGeneratedSecrets","initStageSecrets","resolveStageTelemetry","usesTelemetry","withLogsPassword","runsRedis","withRedisPassword"],"sources":["../src/compose/secrets.ts"],"sourcesContent":["/**\n * What a deployed stage's stack generates once and keeps: its seed, each\n * `secret` construct's value, the log UI's root password where its telemetry\n * is self-hosted, and the stack's Redis password where a cache lives in it.\n *\n * Pure: the compose target writes the result back to the stage's store, and\n * `gkm deploy --resources-only` composes the stack with it to read its hosts,\n * writing nothing.\n */\n\nimport type { ConstructManifest } from '@geekmidas/manifest';\nimport {\n\ttype GeneratedSecrets,\n\twithGeneratedSecrets,\n} from '../deploy/generated.js';\nimport { initStageSecrets } from '../secrets/storage.js';\nimport type { StageSecrets } from '../secrets/types.js';\nimport { resolveStageTelemetry } from '../telemetry/config';\nimport { usesTelemetry } from '../telemetry/edges';\nimport type { NormalizedWorkspace } from '../workspace/types.js';\nimport { withLogsPassword } from './logs';\nimport { runsRedis, withRedisPassword } from './redis';\n\nexport function deployedStackSecrets(\n\tworkspace: NormalizedWorkspace,\n\tstage: string,\n\tstored: StageSecrets | null,\n\tmanifest: ConstructManifest,\n): GeneratedSecrets {\n\tconst withSeed = withGeneratedSecrets(\n\t\tstored ?? initStageSecrets(stage),\n\t\tmanifest,\n\t);\n\t// The log UI's root password, generated once like the seed, where the\n\t// stage's telemetry is self-hosted and the stage set none.\n\tconst telemetry = resolveStageTelemetry({\n\t\t...(workspace.deploy?.telemetry\n\t\t\t? { telemetry: workspace.deploy.telemetry }\n\t\t\t: {}),\n\t\tstage,\n\t\tlocal: false,\n\t\ttarget: 'compose',\n\t\truntime: 'server',\n\t\tselfHosted: true,\n\t\tused: usesTelemetry(manifest),\n\t});\n\tconst withLogs =\n\t\ttelemetry?.provider === 'self-hosted'\n\t\t\t? withLogsPassword(withSeed.secrets)\n\t\t\t: { secrets: withSeed.secrets, generated: [] };\n\t// The stack's Redis password, the same way, where a cache lives in it.\n\tconst withRedis = runsRedis(manifest, withLogs.secrets.custom ?? {})\n\t\t? withRedisPassword(withLogs.secrets)\n\t\t: { secrets: withLogs.secrets, generated: [] };\n\treturn {\n\t\tsecrets: withRedis.secrets,\n\t\tgenerated: [\n\t\t\t...withSeed.generated,\n\t\t\t...withLogs.generated,\n\t\t\t...withRedis.generated,\n\t\t],\n\t};\n}\n"],"mappings":";;;;;AAuBA,SAAgB,qBACf,WACA,OACA,QACA,UACmB;CACnB,MAAM,WAAWA,cAAAA,qBAChB,UAAUC,cAAAA,iBAAiB,KAAK,GAChC,QACD;CAcA,MAAM,WAXYC,kBAAAA,sBAAsB;EACvC,GAAI,UAAU,QAAQ,YACnB,EAAE,WAAW,UAAU,OAAO,UAAU,IACxC,CAAC;EACJ;EACA,OAAO;EACP,QAAQ;EACR,SAAS;EACT,YAAY;EACZ,MAAMC,cAAAA,cAAc,QAAQ;CAC7B,CAES,CAAC,EAAE,aAAa,gBACrBC,cAAAA,iBAAiB,SAAS,OAAO,IACjC;EAAE,SAAS,SAAS;EAAS,WAAW,CAAC;CAAE;CAE/C,MAAM,YAAYC,cAAAA,UAAU,UAAU,SAAS,QAAQ,UAAU,CAAC,CAAC,IAChEC,cAAAA,kBAAkB,SAAS,OAAO,IAClC;EAAE,SAAS,SAAS;EAAS,WAAW,CAAC;CAAE;CAC9C,OAAO;EACN,SAAS,UAAU;EACnB,WAAW;GACV,GAAG,SAAS;GACZ,GAAG,SAAS;GACZ,GAAG,UAAU;EACd;CACD;AACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
2
|
import { L as resolveStageTelemetry } from "./workspace-DWK1PTXP.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { St as withRedisPassword, Wn as initStageSecrets, bt as runsRedis, er as withLogsPassword, fn as usesTelemetry, gt as withGeneratedSecrets } from "./seeds-CoKkrSny.mjs";
|
|
4
4
|
//#region src/compose/secrets.ts
|
|
5
5
|
var secrets_exports = /* @__PURE__ */ __exportAll({ deployedStackSecrets: () => deployedStackSecrets });
|
|
6
6
|
function deployedStackSecrets(workspace, stage, stored, manifest) {
|
|
@@ -33,4 +33,4 @@ function deployedStackSecrets(workspace, stage, stored, manifest) {
|
|
|
33
33
|
//#endregion
|
|
34
34
|
export { secrets_exports as n, deployedStackSecrets as t };
|
|
35
35
|
|
|
36
|
-
//# sourceMappingURL=secrets-
|
|
36
|
+
//# sourceMappingURL=secrets-oI9ClAPR.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secrets-
|
|
1
|
+
{"version":3,"file":"secrets-oI9ClAPR.mjs","names":[],"sources":["../src/compose/secrets.ts"],"sourcesContent":["/**\n * What a deployed stage's stack generates once and keeps: its seed, each\n * `secret` construct's value, the log UI's root password where its telemetry\n * is self-hosted, and the stack's Redis password where a cache lives in it.\n *\n * Pure: the compose target writes the result back to the stage's store, and\n * `gkm deploy --resources-only` composes the stack with it to read its hosts,\n * writing nothing.\n */\n\nimport type { ConstructManifest } from '@geekmidas/manifest';\nimport {\n\ttype GeneratedSecrets,\n\twithGeneratedSecrets,\n} from '../deploy/generated.js';\nimport { initStageSecrets } from '../secrets/storage.js';\nimport type { StageSecrets } from '../secrets/types.js';\nimport { resolveStageTelemetry } from '../telemetry/config';\nimport { usesTelemetry } from '../telemetry/edges';\nimport type { NormalizedWorkspace } from '../workspace/types.js';\nimport { withLogsPassword } from './logs';\nimport { runsRedis, withRedisPassword } from './redis';\n\nexport function deployedStackSecrets(\n\tworkspace: NormalizedWorkspace,\n\tstage: string,\n\tstored: StageSecrets | null,\n\tmanifest: ConstructManifest,\n): GeneratedSecrets {\n\tconst withSeed = withGeneratedSecrets(\n\t\tstored ?? initStageSecrets(stage),\n\t\tmanifest,\n\t);\n\t// The log UI's root password, generated once like the seed, where the\n\t// stage's telemetry is self-hosted and the stage set none.\n\tconst telemetry = resolveStageTelemetry({\n\t\t...(workspace.deploy?.telemetry\n\t\t\t? { telemetry: workspace.deploy.telemetry }\n\t\t\t: {}),\n\t\tstage,\n\t\tlocal: false,\n\t\ttarget: 'compose',\n\t\truntime: 'server',\n\t\tselfHosted: true,\n\t\tused: usesTelemetry(manifest),\n\t});\n\tconst withLogs =\n\t\ttelemetry?.provider === 'self-hosted'\n\t\t\t? withLogsPassword(withSeed.secrets)\n\t\t\t: { secrets: withSeed.secrets, generated: [] };\n\t// The stack's Redis password, the same way, where a cache lives in it.\n\tconst withRedis = runsRedis(manifest, withLogs.secrets.custom ?? {})\n\t\t? withRedisPassword(withLogs.secrets)\n\t\t: { secrets: withLogs.secrets, generated: [] };\n\treturn {\n\t\tsecrets: withRedis.secrets,\n\t\tgenerated: [\n\t\t\t...withSeed.generated,\n\t\t\t...withLogs.generated,\n\t\t\t...withRedis.generated,\n\t\t],\n\t};\n}\n"],"mappings":";;;;;AAuBA,SAAgB,qBACf,WACA,OACA,QACA,UACmB;CACnB,MAAM,WAAW,qBAChB,UAAU,iBAAiB,KAAK,GAChC,QACD;CAcA,MAAM,WAXY,sBAAsB;EACvC,GAAI,UAAU,QAAQ,YACnB,EAAE,WAAW,UAAU,OAAO,UAAU,IACxC,CAAC;EACJ;EACA,OAAO;EACP,QAAQ;EACR,SAAS;EACT,YAAY;EACZ,MAAM,cAAc,QAAQ;CAC7B,CAES,CAAC,EAAE,aAAa,gBACrB,iBAAiB,SAAS,OAAO,IACjC;EAAE,SAAS,SAAS;EAAS,WAAW,CAAC;CAAE;CAE/C,MAAM,YAAY,UAAU,UAAU,SAAS,QAAQ,UAAU,CAAC,CAAC,IAChE,kBAAkB,SAAS,OAAO,IAClC;EAAE,SAAS,SAAS;EAAS,WAAW,CAAC;CAAE;CAC9C,OAAO;EACN,SAAS,UAAU;EACnB,WAAW;GACV,GAAG,SAAS;GACZ,GAAG,SAAS;GACZ,GAAG,UAAU;EACd;CACD;AACD"}
|