@geekmidas/cli 10.0.0-alpha.62 → 10.0.0-alpha.64
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 +2 -0
- package/dist/{HostingerProvider-DyD1Hin8.cjs → HostingerProvider-Bx2lHHvu.cjs} +3 -3
- package/dist/{HostingerProvider-DyD1Hin8.cjs.map → HostingerProvider-Bx2lHHvu.cjs.map} +1 -1
- package/dist/{HostingerProvider-B92qH4dC.mjs → HostingerProvider-Cd4aS5Kj.mjs} +2 -2
- package/dist/{HostingerProvider-B92qH4dC.mjs.map → HostingerProvider-Cd4aS5Kj.mjs.map} +1 -1
- package/dist/{LegacyStateStore-UHJEBLdn.cjs → LegacyStateStore-C2abV49N.cjs} +2 -2
- package/dist/{LegacyStateStore-UHJEBLdn.cjs.map → LegacyStateStore-C2abV49N.cjs.map} +1 -1
- package/dist/{LegacyStateStore-A8d2GdT7.mjs → LegacyStateStore-DIgkGaUP.mjs} +2 -2
- package/dist/{LegacyStateStore-A8d2GdT7.mjs.map → LegacyStateStore-DIgkGaUP.mjs.map} +1 -1
- package/dist/{LocalStateStore-B51rnfgn.mjs → LocalStateStore-Cy1ZBW7U.mjs} +2 -2
- package/dist/{LocalStateStore-B51rnfgn.mjs.map → LocalStateStore-Cy1ZBW7U.mjs.map} +1 -1
- package/dist/{LocalStateStore-COW3Ldwa.cjs → LocalStateStore-DiJqKyPy.cjs} +2 -2
- package/dist/{LocalStateStore-COW3Ldwa.cjs.map → LocalStateStore-DiJqKyPy.cjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-BSrgw7B0.cjs → OpenApiTsGenerator-BWuDRHe9.cjs} +2 -2
- package/dist/{OpenApiTsGenerator-BSrgw7B0.cjs.map → OpenApiTsGenerator-BWuDRHe9.cjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-q5B0z8Xg.mjs → OpenApiTsGenerator-C6v-IeHt.mjs} +2 -2
- package/dist/{OpenApiTsGenerator-q5B0z8Xg.mjs.map → OpenApiTsGenerator-C6v-IeHt.mjs.map} +1 -1
- package/dist/{S3StateStore-CJewPhgz.mjs → S3StateStore-D3x6ivBL.mjs} +2 -2
- package/dist/{S3StateStore-CJewPhgz.mjs.map → S3StateStore-D3x6ivBL.mjs.map} +1 -1
- package/dist/{S3StateStore-WUJGdRNL.cjs → S3StateStore-Ds0V1Lgm.cjs} +2 -2
- package/dist/{S3StateStore-WUJGdRNL.cjs.map → S3StateStore-Ds0V1Lgm.cjs.map} +1 -1
- package/dist/{SSMStateStore-Zejt42V8.cjs → SSMStateStore-CLipvx47.cjs} +2 -2
- package/dist/{SSMStateStore-Zejt42V8.cjs.map → SSMStateStore-CLipvx47.cjs.map} +1 -1
- package/dist/{SSMStateStore-iK5UKp9d.mjs → SSMStateStore-DfF174xQ.mjs} +2 -2
- package/dist/{SSMStateStore-iK5UKp9d.mjs.map → SSMStateStore-DfF174xQ.mjs.map} +1 -1
- package/dist/{bundler-CfH9frOS.cjs → bundler-C8uJf324.cjs} +4 -4
- package/dist/{bundler-CfH9frOS.cjs.map → bundler-C8uJf324.cjs.map} +1 -1
- package/dist/{bundler-DN5r4x5b.mjs → bundler-DYgm9xsd.mjs} +3 -3
- package/dist/{bundler-DN5r4x5b.mjs.map → bundler-DYgm9xsd.mjs.map} +1 -1
- package/dist/{cli-DYwxmfsW.mjs → cli-Bogz-zEj.mjs} +5 -4
- package/dist/{cli-DYwxmfsW.mjs.map → cli-Bogz-zEj.mjs.map} +1 -1
- package/dist/{cli-DOAUp80L.cjs → cli-D3jofJ6j.cjs} +7 -6
- package/dist/{cli-DOAUp80L.cjs.map → cli-D3jofJ6j.cjs.map} +1 -1
- package/dist/config-Be-4_I6H.d.cts +256 -0
- package/dist/config-Be-4_I6H.d.cts.map +1 -0
- package/dist/config-DqNRiQOp.d.mts +256 -0
- package/dist/config-DqNRiQOp.d.mts.map +1 -0
- package/dist/config.cjs +416 -13
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +4 -211
- package/dist/config.d.mts +4 -211
- package/dist/config.mjs +402 -3
- package/dist/config.mjs.map +1 -0
- package/dist/credentials-B70vmLcm.cjs +125 -0
- package/dist/credentials-B70vmLcm.cjs.map +1 -0
- package/dist/credentials-s0wMeZBU.mjs +108 -0
- package/dist/credentials-s0wMeZBU.mjs.map +1 -0
- package/dist/{define-CHBIEc5j.mjs → define-CYs0PEfZ.mjs} +2 -3
- package/dist/define-CYs0PEfZ.mjs.map +1 -0
- package/dist/{define-Cv_QvDrg.cjs → define-zUsP72ym.cjs} +2 -3
- package/dist/define-zUsP72ym.cjs.map +1 -0
- package/dist/deploy/public.cjs +166 -14
- package/dist/deploy/public.cjs.map +1 -0
- package/dist/deploy/public.d.cts +224 -3
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +224 -3
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +141 -10
- package/dist/deploy/public.mjs.map +1 -0
- package/dist/deploy/sniffer-envparser-worker.cjs +54 -0
- package/dist/deploy/sniffer-envparser-worker.cjs.map +1 -0
- package/dist/deploy/sniffer-envparser-worker.d.cts +1 -0
- package/dist/deploy/sniffer-envparser-worker.d.mts +1 -0
- package/dist/deploy/sniffer-envparser-worker.mjs +55 -0
- package/dist/deploy/sniffer-envparser-worker.mjs.map +1 -0
- package/dist/{deploy-DSaCYvcO.cjs → deploy-55rJkdKz.cjs} +17 -14
- package/dist/{deploy-DSaCYvcO.cjs.map → deploy-55rJkdKz.cjs.map} +1 -1
- package/dist/{deploy-Cg9fae7a.mjs → deploy-Dc2LBJaK.mjs} +13 -10
- package/dist/deploy-Dc2LBJaK.mjs.map +1 -0
- package/dist/{deploy-B7jvUORo.mjs → deploy-ZRXIPp1c.mjs} +11 -8
- package/dist/{deploy-B7jvUORo.mjs.map → deploy-ZRXIPp1c.mjs.map} +1 -1
- package/dist/{deploy-D8Qr-Xto.cjs → deploy-yUcR2OlW.cjs} +15 -12
- package/dist/deploy-yUcR2OlW.cjs.map +1 -0
- package/dist/derive-B4vDpzgP.mjs +150 -0
- package/dist/derive-B4vDpzgP.mjs.map +1 -0
- package/dist/derive-DAbo49sm.cjs +161 -0
- package/dist/derive-DAbo49sm.cjs.map +1 -0
- package/dist/discover-B6yPpvRV.d.mts +99 -0
- package/dist/discover-B6yPpvRV.d.mts.map +1 -0
- package/dist/discover-B_IkPukx.d.cts +99 -0
- package/dist/discover-B_IkPukx.d.cts.map +1 -0
- package/dist/{discover-Bc-4eA_p.cjs → discover-DHdECueV.cjs} +280 -1
- package/dist/discover-DHdECueV.cjs.map +1 -0
- package/dist/{discover-FrYvzkeC.mjs → discover-LMrqsWSU.mjs} +246 -3
- package/dist/discover-LMrqsWSU.mjs.map +1 -0
- package/dist/{dokploy-CD9PY-3D.mjs → dokploy-CepdXuMl.mjs} +3 -3
- package/dist/{dokploy-CD9PY-3D.mjs.map → dokploy-CepdXuMl.mjs.map} +1 -1
- package/dist/{dokploy-Ey2foJLv.cjs → dokploy-D1d37rvM.cjs} +3 -3
- package/dist/{dokploy-Ey2foJLv.cjs.map → dokploy-D1d37rvM.cjs.map} +1 -1
- package/dist/{encryption-ChBk3hTj.cjs → encryption-C9X98u2F.cjs} +5 -5
- package/dist/{encryption-ChBk3hTj.cjs.map → encryption-C9X98u2F.cjs.map} +1 -1
- package/dist/{encryption-CVwvGbsL.mjs → encryption-CKHjMpCr.mjs} +5 -5
- package/dist/{encryption-CVwvGbsL.mjs.map → encryption-CKHjMpCr.mjs.map} +1 -1
- package/dist/fakes-C9RiT6XG.mjs.map +1 -1
- package/dist/fakes-zW-jNAbQ.cjs.map +1 -1
- package/dist/{github-BCB3_LBX.mjs → github-D-byNI7T.mjs} +4 -4
- package/dist/{github-BCB3_LBX.mjs.map → github-D-byNI7T.mjs.map} +1 -1
- package/dist/{github-OUgPDlqg.cjs → github-Dd3tMa1u.cjs} +4 -4
- package/dist/{github-OUgPDlqg.cjs.map → github-Dd3tMa1u.cjs.map} +1 -1
- package/dist/{index-BtXDZQuF.d.cts → index-CJ2qsSpp.d.mts} +2 -2
- package/dist/{index-BtXDZQuF.d.cts.map → index-CJ2qsSpp.d.mts.map} +1 -1
- package/dist/{index-DrKzpHl-.d.mts → index-CfE9Y885.d.cts} +2 -2
- package/dist/{index-DrKzpHl-.d.mts.map → index-CfE9Y885.d.cts.map} +1 -1
- package/dist/index.cjs +111 -239
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +82 -210
- package/dist/index.mjs.map +1 -1
- package/dist/local-C7wnrcYK.cjs +586 -0
- package/dist/local-C7wnrcYK.cjs.map +1 -0
- package/dist/local-Cd8ZYQG3.mjs +473 -0
- package/dist/local-Cd8ZYQG3.mjs.map +1 -0
- package/dist/{migrate-BoHMqdCu.mjs → migrate-B4gngTLe.mjs} +6 -6
- package/dist/{migrate-BoHMqdCu.mjs.map → migrate-B4gngTLe.mjs.map} +1 -1
- package/dist/{migrate-dnaFMvOm.cjs → migrate-tx9-P9uz.cjs} +6 -6
- package/dist/{migrate-dnaFMvOm.cjs.map → migrate-tx9-P9uz.cjs.map} +1 -1
- package/dist/openapi.cjs +3 -3
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.mjs +3 -3
- package/dist/{ready-DQIy21W5.mjs → ready-bQfu9GES.mjs} +3 -3
- package/dist/{ready-DQIy21W5.mjs.map → ready-bQfu9GES.mjs.map} +1 -1
- package/dist/{ready-XlNx-Gbo.cjs → ready-brEhh68f.cjs} +3 -3
- package/dist/{ready-XlNx-Gbo.cjs.map → ready-brEhh68f.cjs.map} +1 -1
- package/dist/reconcile/public.cjs +1 -1
- package/dist/reconcile/public.d.cts +4 -77
- package/dist/reconcile/public.d.cts.map +1 -1
- package/dist/reconcile/public.d.mts +4 -77
- package/dist/reconcile/public.d.mts.map +1 -1
- package/dist/reconcile/public.mjs +1 -1
- package/dist/{resolve-wbv66HjD.cjs → resolve-BXsNQjMR.cjs} +9 -6
- package/dist/resolve-BXsNQjMR.cjs.map +1 -0
- package/dist/{resolve-CFCIkm7m.mjs → resolve-DZ2IJ0qY.mjs} +9 -6
- package/dist/resolve-DZ2IJ0qY.mjs.map +1 -0
- package/dist/{runtime-CMwtq0AL.cjs → runtime-BGNDrHzh.cjs} +2 -2
- package/dist/{runtime-CMwtq0AL.cjs.map → runtime-BGNDrHzh.cjs.map} +1 -1
- package/dist/{runtime-Dn_n-29S.d.cts → runtime-CJEYK4Gz.d.mts} +2 -2
- package/dist/{runtime-CXPlkZzs.d.mts.map → runtime-CJEYK4Gz.d.mts.map} +1 -1
- package/dist/{runtime-CXPlkZzs.d.mts → runtime-Cjq1jlVX.d.cts} +2 -2
- package/dist/{runtime-Dn_n-29S.d.cts.map → runtime-Cjq1jlVX.d.cts.map} +1 -1
- package/dist/{runtime-DbakJS8u.mjs → runtime-Cmn-FeYO.mjs} +2 -2
- package/dist/{runtime-DbakJS8u.mjs.map → runtime-Cmn-FeYO.mjs.map} +1 -1
- package/dist/sandbox/config-worker.cjs +43 -0
- package/dist/sandbox/config-worker.cjs.map +1 -0
- package/dist/sandbox/config-worker.d.cts +1 -0
- package/dist/sandbox/config-worker.d.mts +1 -0
- package/dist/sandbox/config-worker.mjs +44 -0
- package/dist/sandbox/config-worker.mjs.map +1 -0
- package/dist/sandbox/discover-worker.cjs +44 -0
- package/dist/sandbox/discover-worker.cjs.map +1 -0
- package/dist/sandbox/discover-worker.d.cts +1 -0
- package/dist/sandbox/discover-worker.d.mts +1 -0
- package/dist/sandbox/discover-worker.mjs +45 -0
- package/dist/sandbox/discover-worker.mjs.map +1 -0
- package/dist/sandbox-CL--ZDui.cjs +164 -0
- package/dist/sandbox-CL--ZDui.cjs.map +1 -0
- package/dist/sandbox-Dm247NGx.mjs +117 -0
- package/dist/sandbox-Dm247NGx.mjs.map +1 -0
- package/dist/sandbox-M8UnLhXE.d.cts +126 -0
- package/dist/sandbox-M8UnLhXE.d.cts.map +1 -0
- package/dist/sandbox-M8UnLhXE.d.mts +126 -0
- package/dist/sandbox-M8UnLhXE.d.mts.map +1 -0
- package/dist/{workspace-BFe57es7.mjs → schemas-Ckm_aBnF.cjs} +71 -982
- package/dist/schemas-Ckm_aBnF.cjs.map +1 -0
- package/dist/{workspace-B6zQO6RY.cjs → schemas-D2LCF689.mjs} +2 -1168
- package/dist/schemas-D2LCF689.mjs.map +1 -0
- package/dist/{sniffer-DHE2Nafd.mjs → sniffer-49KPbDgq.mjs} +131 -444
- package/dist/sniffer-49KPbDgq.mjs.map +1 -0
- package/dist/{sniffer-BsfPa-GA.cjs → sniffer-ByhbEW5A.cjs} +145 -512
- package/dist/sniffer-ByhbEW5A.cjs.map +1 -0
- package/dist/sst-BdALKEas.cjs +453 -0
- package/dist/sst-BdALKEas.cjs.map +1 -0
- package/dist/sst-Cper040I.mjs +430 -0
- package/dist/sst-Cper040I.mjs.map +1 -0
- package/dist/{store-BS8A7NcA.mjs → store-BaaonhkJ.mjs} +2 -2
- package/dist/{store-BS8A7NcA.mjs.map → store-BaaonhkJ.mjs.map} +1 -1
- package/dist/{store-KvNQwYaB.cjs → store-D_2ByRtW.cjs} +4 -4
- package/dist/{store-KvNQwYaB.cjs.map → store-D_2ByRtW.cjs.map} +1 -1
- package/dist/target/public.cjs +3 -3
- package/dist/target/public.d.cts +3 -3
- package/dist/target/public.d.mts +3 -3
- package/dist/target/public.mjs +3 -3
- package/dist/{terminal-6oL0vANs.cjs → terminal-Bdv--jhY.cjs} +16 -111
- package/dist/terminal-Bdv--jhY.cjs.map +1 -0
- package/dist/{terminal-ByZNjuig.mjs → terminal-D7Ntz6WE.mjs} +13 -90
- package/dist/terminal-D7Ntz6WE.mjs.map +1 -0
- package/dist/{types-DIA7Li-J.d.cts → types-B_bEQvb9.d.mts} +42 -7
- package/dist/types-B_bEQvb9.d.mts.map +1 -0
- package/dist/{types-CfLKGfC_.d.mts → types-DkrDOMxw.d.cts} +43 -6
- package/dist/types-DkrDOMxw.d.cts.map +1 -0
- package/dist/utils-D2Nk1Nv2.cjs +205 -0
- package/dist/utils-D2Nk1Nv2.cjs.map +1 -0
- package/dist/utils-D_fxUqvU.mjs +156 -0
- package/dist/utils-D_fxUqvU.mjs.map +1 -0
- package/dist/vitest.cjs +2 -2
- package/dist/vitest.mjs +2 -2
- package/dist/workerRuntime-BXfhbe13.cjs +108 -0
- package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
- package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
- package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
- package/dist/workspace/index.cjs +1 -1
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/dist/workspace/index.mjs +1 -1
- package/dist/workspace-BwgWJK7h.cjs +1196 -0
- package/dist/workspace-BwgWJK7h.cjs.map +1 -0
- package/dist/workspace-Bwit4q9O.mjs +1024 -0
- package/dist/workspace-Bwit4q9O.mjs.map +1 -0
- package/package.json +13 -13
- package/dist/config-BYh9S0cZ.cjs +0 -534
- package/dist/config-BYh9S0cZ.cjs.map +0 -1
- package/dist/config-Bf4-bROQ.mjs +0 -457
- package/dist/config-Bf4-bROQ.mjs.map +0 -1
- package/dist/config.d.cts.map +0 -1
- package/dist/config.d.mts.map +0 -1
- package/dist/define-CHBIEc5j.mjs.map +0 -1
- package/dist/define-Cv_QvDrg.cjs.map +0 -1
- package/dist/deploy-Cg9fae7a.mjs.map +0 -1
- package/dist/deploy-D8Qr-Xto.cjs.map +0 -1
- package/dist/discover-Bc-4eA_p.cjs.map +0 -1
- package/dist/discover-FrYvzkeC.mjs.map +0 -1
- package/dist/home-DOzBaWaL.cjs +0 -33
- package/dist/home-DOzBaWaL.cjs.map +0 -1
- package/dist/home-GI7pJl1M.mjs +0 -22
- package/dist/home-GI7pJl1M.mjs.map +0 -1
- package/dist/resolve-CFCIkm7m.mjs.map +0 -1
- package/dist/resolve-wbv66HjD.cjs.map +0 -1
- package/dist/sniffer-BsfPa-GA.cjs.map +0 -1
- package/dist/sniffer-DHE2Nafd.mjs.map +0 -1
- package/dist/terminal-6oL0vANs.cjs.map +0 -1
- package/dist/terminal-ByZNjuig.mjs.map +0 -1
- package/dist/types-CfLKGfC_.d.mts.map +0 -1
- package/dist/types-DIA7Li-J.d.cts.map +0 -1
- package/dist/workspace-B6zQO6RY.cjs.map +0 -1
- package/dist/workspace-BFe57es7.mjs.map +0 -1
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import { n as __require, t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { _ as storeHostingerToken, g as storeDokployCredentials, h as removeDokployCredentials, l as getCredentialsPath, s as run$1, t as LocalSandbox, u as getDokployCredentials } from "./local-Cd8ZYQG3.mjs";
|
|
3
|
+
import { d as output, r as discover, s as nodeWithTsx } from "./discover-LMrqsWSU.mjs";
|
|
4
|
+
import { i as activeSandbox } from "./sandbox-Dm247NGx.mjs";
|
|
5
|
+
import { t as appKey } from "./derive-B4vDpzgP.mjs";
|
|
6
|
+
import { E as TEST_STAGE, p as getPublicEnvPrefix, t as allConstructGlobs } from "./workspace-Bwit4q9O.mjs";
|
|
7
|
+
import { ConfigNotFound, NotInAnApp, loadConfig, loadWorkspaceAppInfo, loadWorkspaceConfig } from "./config.mjs";
|
|
6
8
|
import { i as toEmbeddableSecrets } from "./storage-BzaUxmqe.mjs";
|
|
7
|
-
import { i as FileSecretsStore, n as secretsStoreFor } from "./store-
|
|
8
|
-
import { r as runtimeOf } from "./runtime-
|
|
9
|
+
import { i as FileSecretsStore, n as secretsStoreFor } from "./store-BaaonhkJ.mjs";
|
|
10
|
+
import { r as runtimeOf } from "./runtime-Cmn-FeYO.mjs";
|
|
9
11
|
import { i as DEFAULT_STORAGE, n as DEFAULT_CACHE, r as DEFAULT_EVENTS$1, t as readFakes } from "./fakes-C9RiT6XG.mjs";
|
|
10
|
-
import { createRequire } from "node:module";
|
|
11
12
|
import { basename, dirname, join, parse, resolve } from "node:path";
|
|
12
13
|
import { stdin, stdout } from "node:process";
|
|
13
14
|
import * as readline from "node:readline/promises";
|
|
14
|
-
import { copyFileSync, existsSync,
|
|
15
|
+
import { copyFileSync, existsSync, readFileSync, unlinkSync } from "node:fs";
|
|
15
16
|
import { mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
|
|
16
17
|
import { hostname, networkInterfaces, userInfo } from "node:os";
|
|
17
18
|
import { promisify } from "node:util";
|
|
18
19
|
import { DEFAULT_POSTGRES_VERSION, cacheTable, cookieDomain, dependenciesOf, dependentsOf, externalApiUrl, kebabCase, mobileOrigins, provideKey, providedKeyFor, provisionOrder, publicEnvFor, schemeBase } from "@geekmidas/manifest";
|
|
20
|
+
import { fileURLToPath } from "node:url";
|
|
19
21
|
import { execFile, spawn } from "node:child_process";
|
|
20
22
|
import { createServer } from "node:net";
|
|
21
23
|
import { config } from "dotenv";
|
|
22
24
|
import { createCipheriv, createHash, randomBytes, randomUUID } from "node:crypto";
|
|
23
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
24
25
|
import { formatKeyring, generateKeyring } from "@geekmidas/constructs/encryption";
|
|
25
26
|
import { ownerRole, readerRole, roleStatements } from "@geekmidas/db/pg/roles";
|
|
26
27
|
import * as snsUrl from "@geekmidas/events/sns/url";
|
|
@@ -106,128 +107,6 @@ async function prompt(message, options) {
|
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
109
|
//#endregion
|
|
109
|
-
//#region src/auth/credentials.ts
|
|
110
|
-
/**
|
|
111
|
-
* Get the path to the credentials directory
|
|
112
|
-
*/
|
|
113
|
-
function getCredentialsDir(options) {
|
|
114
|
-
if (options?.home) return options.home;
|
|
115
|
-
return options?.root ? join(options.root, ".gkm") : gkmHome();
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Get the path to the credentials file
|
|
119
|
-
*/
|
|
120
|
-
function getCredentialsPath(options) {
|
|
121
|
-
return join(getCredentialsDir(options), "credentials.json");
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Ensure the credentials directory exists
|
|
125
|
-
*/
|
|
126
|
-
function ensureCredentialsDir(options) {
|
|
127
|
-
const dir = getCredentialsDir(options);
|
|
128
|
-
if (!existsSync(dir)) mkdirSync(dir, {
|
|
129
|
-
recursive: true,
|
|
130
|
-
mode: 448
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Read stored credentials from disk
|
|
135
|
-
*/
|
|
136
|
-
async function readCredentials(options) {
|
|
137
|
-
const path = getCredentialsPath(options);
|
|
138
|
-
if (!existsSync(path)) return {};
|
|
139
|
-
try {
|
|
140
|
-
const content = await readFile(path, "utf-8");
|
|
141
|
-
return JSON.parse(content);
|
|
142
|
-
} catch {
|
|
143
|
-
return {};
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Write credentials to disk
|
|
148
|
-
*/
|
|
149
|
-
async function writeCredentials(credentials, options) {
|
|
150
|
-
ensureCredentialsDir(options);
|
|
151
|
-
const path = getCredentialsPath(options);
|
|
152
|
-
await writeFile(path, JSON.stringify(credentials, null, 2), { mode: 384 });
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Store Dokploy credentials
|
|
156
|
-
*/
|
|
157
|
-
async function storeDokployCredentials(token, endpoint, options) {
|
|
158
|
-
const credentials = await readCredentials(options);
|
|
159
|
-
credentials.dokploy = {
|
|
160
|
-
token,
|
|
161
|
-
endpoint,
|
|
162
|
-
storedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
163
|
-
};
|
|
164
|
-
await writeCredentials(credentials, options);
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Get stored Dokploy credentials
|
|
168
|
-
*/
|
|
169
|
-
async function getDokployCredentials(options) {
|
|
170
|
-
const credentials = await readCredentials(options);
|
|
171
|
-
const token = process.env.DOKPLOY_API_TOKEN ?? credentials.dokploy?.token;
|
|
172
|
-
const endpoint = process.env.DOKPLOY_ENDPOINT ?? credentials.dokploy?.endpoint;
|
|
173
|
-
if (!token || !endpoint) return null;
|
|
174
|
-
return {
|
|
175
|
-
token,
|
|
176
|
-
endpoint: endpoint.replace(/\/$/, ""),
|
|
177
|
-
...credentials.dokploy?.registryId ? { registryId: credentials.dokploy.registryId } : {}
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Remove Dokploy credentials
|
|
182
|
-
*/
|
|
183
|
-
async function removeDokployCredentials(options) {
|
|
184
|
-
const credentials = await readCredentials(options);
|
|
185
|
-
if (!credentials.dokploy) return false;
|
|
186
|
-
delete credentials.dokploy;
|
|
187
|
-
await writeCredentials(credentials, options);
|
|
188
|
-
return true;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Get Dokploy API token, checking stored credentials first, then environment
|
|
192
|
-
*/
|
|
193
|
-
async function getDokployToken(options) {
|
|
194
|
-
const envToken = process.env.DOKPLOY_API_TOKEN;
|
|
195
|
-
if (envToken) return envToken;
|
|
196
|
-
const stored = await getDokployCredentials(options);
|
|
197
|
-
if (stored) return stored.token;
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Get Dokploy registry ID from stored credentials
|
|
202
|
-
*/
|
|
203
|
-
async function getDokployRegistryId(options) {
|
|
204
|
-
return (await getDokployCredentials(options))?.registryId ?? void 0;
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Store Hostinger API token
|
|
208
|
-
*
|
|
209
|
-
* @param token - API token from hpanel.hostinger.com/profile/api
|
|
210
|
-
*/
|
|
211
|
-
async function storeHostingerToken(token, options) {
|
|
212
|
-
const credentials = await readCredentials(options);
|
|
213
|
-
credentials.hostinger = {
|
|
214
|
-
token,
|
|
215
|
-
storedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
216
|
-
};
|
|
217
|
-
await writeCredentials(credentials, options);
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Get stored Hostinger API token
|
|
221
|
-
*
|
|
222
|
-
* Checks environment variable first (HOSTINGER_API_TOKEN),
|
|
223
|
-
* then falls back to stored credentials.
|
|
224
|
-
*/
|
|
225
|
-
async function getHostingerToken(options) {
|
|
226
|
-
const envToken = process.env.HOSTINGER_API_TOKEN;
|
|
227
|
-
if (envToken) return envToken;
|
|
228
|
-
return (await readCredentials(options)).hostinger?.token ?? null;
|
|
229
|
-
}
|
|
230
|
-
//#endregion
|
|
231
110
|
//#region src/auth/index.ts
|
|
232
111
|
const logger$2 = console;
|
|
233
112
|
/**
|
|
@@ -585,45 +464,6 @@ function normalizeRoutes(routes) {
|
|
|
585
464
|
return Array.isArray(routes) ? routes : [routes];
|
|
586
465
|
}
|
|
587
466
|
//#endregion
|
|
588
|
-
//#region src/owningTsconfigJsx.ts
|
|
589
|
-
const REGISTER = "owning-tsconfig-jsx-register.mjs";
|
|
590
|
-
/** The CLI's `bin/` was not found above the module looking for it. */
|
|
591
|
-
var OwningTsconfigJsxHookMissing = class extends Error {
|
|
592
|
-
from;
|
|
593
|
-
constructor(from) {
|
|
594
|
-
super(`Could not find bin/${REGISTER} in any directory above '${from}'. It ships with @geekmidas/cli beside bin/gkm.mjs; reinstall the package if it is missing.`);
|
|
595
|
-
this.from = from;
|
|
596
|
-
this.name = "OwningTsconfigJsxHookMissing";
|
|
597
|
-
}
|
|
598
|
-
};
|
|
599
|
-
/**
|
|
600
|
-
* The CLI's `bin/owning-tsconfig-jsx-register.mjs`, as a file URL. Searched
|
|
601
|
-
* upward because this module runs from `src/` in the repo and from a chunk in
|
|
602
|
-
* `dist/` once built, and `bin/` sits beside both.
|
|
603
|
-
*/
|
|
604
|
-
function registerUrl() {
|
|
605
|
-
const from = dirname(fileURLToPath(import.meta.url));
|
|
606
|
-
for (let dir = from;; dir = dirname(dir)) {
|
|
607
|
-
const candidate = join(dir, "bin", REGISTER);
|
|
608
|
-
if (existsSync(candidate)) return pathToFileURL(candidate).href;
|
|
609
|
-
if (dirname(dir) === dir) throw new OwningTsconfigJsxHookMissing(from);
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
/**
|
|
613
|
-
* `NODE_OPTIONS` for a process that runs app code through tsx, with the hook
|
|
614
|
-
* that compiles each `.tsx` with its own tsconfig's JSX settings (see
|
|
615
|
-
* `bin/owning-tsconfig-jsx.mjs`) put in front of every other `--import`, so it
|
|
616
|
-
* is registered before tsx and reads the source on tsx's behalf.
|
|
617
|
-
*
|
|
618
|
-
* `bin/gkm.mjs` already starts the CLI this way, and its children inherit it;
|
|
619
|
-
* this is for those that set `NODE_OPTIONS` themselves, or whose CLI was
|
|
620
|
-
* started with tsx already imported.
|
|
621
|
-
*/
|
|
622
|
-
function withOwningTsconfigJsx(nodeOptions = "") {
|
|
623
|
-
if (nodeOptions.includes(REGISTER)) return nodeOptions;
|
|
624
|
-
return [`--import=${registerUrl()}`, nodeOptions].filter(Boolean).join(" ");
|
|
625
|
-
}
|
|
626
|
-
//#endregion
|
|
627
467
|
//#region src/reconcile/containers.ts
|
|
628
468
|
/**
|
|
629
469
|
* What gkm knows about each container it can derive.
|
|
@@ -2470,7 +2310,7 @@ var UnassignedPort = class extends Error {
|
|
|
2470
2310
|
* Every call is scoped to the generated compose file. Nothing here can touch a
|
|
2471
2311
|
* container this project did not generate.
|
|
2472
2312
|
*/
|
|
2473
|
-
const run
|
|
2313
|
+
const run = promisify(execFile);
|
|
2474
2314
|
/**
|
|
2475
2315
|
* The generated file, then the project's own if it has one.
|
|
2476
2316
|
*
|
|
@@ -2513,7 +2353,7 @@ function shown(args, services) {
|
|
|
2513
2353
|
const dockerCli = {
|
|
2514
2354
|
async publishedPort(composePath, service, inside) {
|
|
2515
2355
|
try {
|
|
2516
|
-
const { stdout } = await run
|
|
2356
|
+
const { stdout } = await run("docker", [
|
|
2517
2357
|
"compose",
|
|
2518
2358
|
...composeFiles(composePath),
|
|
2519
2359
|
"port",
|
|
@@ -2538,11 +2378,11 @@ const dockerCli = {
|
|
|
2538
2378
|
...services
|
|
2539
2379
|
];
|
|
2540
2380
|
if (options.show) return shown(args, services);
|
|
2541
|
-
await run
|
|
2381
|
+
await run("docker", args);
|
|
2542
2382
|
},
|
|
2543
2383
|
async copyOut(composePath, service, from, to) {
|
|
2544
2384
|
await mkdir(dirname(to), { recursive: true });
|
|
2545
|
-
await run
|
|
2385
|
+
await run("docker", [
|
|
2546
2386
|
"compose",
|
|
2547
2387
|
...composeFiles(composePath),
|
|
2548
2388
|
"cp",
|
|
@@ -2551,7 +2391,7 @@ const dockerCli = {
|
|
|
2551
2391
|
]);
|
|
2552
2392
|
},
|
|
2553
2393
|
async reload(composePath, service) {
|
|
2554
|
-
await run
|
|
2394
|
+
await run("docker", [
|
|
2555
2395
|
"compose",
|
|
2556
2396
|
...composeFiles(composePath),
|
|
2557
2397
|
"exec",
|
|
@@ -2566,7 +2406,7 @@ const dockerCli = {
|
|
|
2566
2406
|
async healthy(composePath, services) {
|
|
2567
2407
|
if (services.length === 0) return true;
|
|
2568
2408
|
try {
|
|
2569
|
-
const { stdout } = await run
|
|
2409
|
+
const { stdout } = await run("docker", [
|
|
2570
2410
|
"compose",
|
|
2571
2411
|
...composeFiles(composePath),
|
|
2572
2412
|
"ps",
|
|
@@ -3518,116 +3358,6 @@ function localAddress(port) {
|
|
|
3518
3358
|
return `http://localhost:${port}`;
|
|
3519
3359
|
}
|
|
3520
3360
|
//#endregion
|
|
3521
|
-
//#region src/run.ts
|
|
3522
|
-
/**
|
|
3523
|
-
* Start a program with an argument array, never a shell string.
|
|
3524
|
-
*
|
|
3525
|
-
* `gkm build`, `gkm docker` and `gkm deploy` pass values that come from the
|
|
3526
|
-
* workspace — image refs, tags, build args, package names — to `docker` and
|
|
3527
|
-
* `turbo`. Joined into a string and handed to a shell, a package named
|
|
3528
|
-
* `x;curl …|sh` or a tag holding `$(…)` became part of the command line, which
|
|
3529
|
-
* matters most where the CLI builds a repository it didn't write: a CI job for a
|
|
3530
|
-
* fork, a shared build runner. Here every value reaches the program as one
|
|
3531
|
-
* `argv` element, whatever it contains.
|
|
3532
|
-
*/
|
|
3533
|
-
/** Long enough for a cold image build; short enough that a hung one ends. */
|
|
3534
|
-
const DEFAULT_TIMEOUT_MS = 18e5;
|
|
3535
|
-
/** How long a timed-out child has to exit on SIGTERM before it is killed. */
|
|
3536
|
-
const KILL_GRACE_MS = 5e3;
|
|
3537
|
-
/** The command line as a person would read it — for messages, never to run. */
|
|
3538
|
-
function display(command, args) {
|
|
3539
|
-
return [command, ...args].join(" ");
|
|
3540
|
-
}
|
|
3541
|
-
/** The program ran and exited unsuccessfully; its own output said why. */
|
|
3542
|
-
var CommandFailed = class extends Error {
|
|
3543
|
-
command;
|
|
3544
|
-
args;
|
|
3545
|
-
exitCode;
|
|
3546
|
-
signal;
|
|
3547
|
-
constructor(command, args, exitCode, signal) {
|
|
3548
|
-
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.`);
|
|
3549
|
-
this.command = command;
|
|
3550
|
-
this.args = args;
|
|
3551
|
-
this.exitCode = exitCode;
|
|
3552
|
-
this.signal = signal;
|
|
3553
|
-
this.name = "CommandFailed";
|
|
3554
|
-
}
|
|
3555
|
-
};
|
|
3556
|
-
/** The program ran past its timeout and was killed. */
|
|
3557
|
-
var CommandTimedOut = class extends Error {
|
|
3558
|
-
command;
|
|
3559
|
-
args;
|
|
3560
|
-
timeoutMs;
|
|
3561
|
-
constructor(command, args, timeoutMs) {
|
|
3562
|
-
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.`);
|
|
3563
|
-
this.command = command;
|
|
3564
|
-
this.args = args;
|
|
3565
|
-
this.timeoutMs = timeoutMs;
|
|
3566
|
-
this.name = "CommandTimedOut";
|
|
3567
|
-
}
|
|
3568
|
-
};
|
|
3569
|
-
/**
|
|
3570
|
-
* Run `command` with `args`, resolving when it exits 0.
|
|
3571
|
-
*
|
|
3572
|
-
* Rejects with {@link CommandFailed} on any other exit, {@link CommandTimedOut}
|
|
3573
|
-
* once `timeoutMs` passes (after the child is gone), and with the spawn error
|
|
3574
|
-
* itself when the program cannot be started at all — `ENOENT` already names it.
|
|
3575
|
-
*/
|
|
3576
|
-
async function run(command, args, options = {}) {
|
|
3577
|
-
await spawnChild(command, args, options, false);
|
|
3578
|
-
}
|
|
3579
|
-
/**
|
|
3580
|
-
* {@link run}, resolving with what the program wrote to stdout — for a value
|
|
3581
|
-
* the CLI reads back, such as the digest `docker inspect` reports. stderr still
|
|
3582
|
-
* reaches the terminal, so a failure explains itself the same way.
|
|
3583
|
-
*/
|
|
3584
|
-
function runOutput(command, args, options = {}) {
|
|
3585
|
-
return spawnChild(command, args, options, true);
|
|
3586
|
-
}
|
|
3587
|
-
function spawnChild(command, args, options, capture) {
|
|
3588
|
-
const { timeoutMs = DEFAULT_TIMEOUT_MS, ...spawnOptions } = options;
|
|
3589
|
-
return new Promise((resolve, reject) => {
|
|
3590
|
-
const child = spawn(command, [...args], {
|
|
3591
|
-
stdio: "inherit",
|
|
3592
|
-
...spawnOptions,
|
|
3593
|
-
...capture ? { stdio: [
|
|
3594
|
-
"ignore",
|
|
3595
|
-
"pipe",
|
|
3596
|
-
"inherit"
|
|
3597
|
-
] } : {},
|
|
3598
|
-
shell: false
|
|
3599
|
-
});
|
|
3600
|
-
let stdout = "";
|
|
3601
|
-
child.stdout?.on("data", (chunk) => {
|
|
3602
|
-
stdout += chunk.toString();
|
|
3603
|
-
});
|
|
3604
|
-
let timedOut = false;
|
|
3605
|
-
let killer;
|
|
3606
|
-
const timer = setTimeout(() => {
|
|
3607
|
-
timedOut = true;
|
|
3608
|
-
child.kill("SIGTERM");
|
|
3609
|
-
killer = setTimeout(() => child.kill("SIGKILL"), KILL_GRACE_MS);
|
|
3610
|
-
killer.unref?.();
|
|
3611
|
-
}, timeoutMs);
|
|
3612
|
-
timer.unref?.();
|
|
3613
|
-
const settle = () => {
|
|
3614
|
-
clearTimeout(timer);
|
|
3615
|
-
if (killer) clearTimeout(killer);
|
|
3616
|
-
};
|
|
3617
|
-
child.on("error", (error) => {
|
|
3618
|
-
settle();
|
|
3619
|
-
reject(spawnOptions.signal?.aborted ? spawnOptions.signal.reason : error);
|
|
3620
|
-
});
|
|
3621
|
-
child.on("close", (code, signal) => {
|
|
3622
|
-
settle();
|
|
3623
|
-
if (spawnOptions.signal?.aborted) reject(spawnOptions.signal.reason);
|
|
3624
|
-
else if (timedOut) reject(new CommandTimedOut(command, args, timeoutMs));
|
|
3625
|
-
else if (code === 0) resolve(stdout);
|
|
3626
|
-
else reject(new CommandFailed(command, args, code, signal));
|
|
3627
|
-
});
|
|
3628
|
-
});
|
|
3629
|
-
}
|
|
3630
|
-
//#endregion
|
|
3631
3361
|
//#region src/secrets/encryption.ts
|
|
3632
3362
|
var encryption_exports = /* @__PURE__ */ __exportAll({
|
|
3633
3363
|
encryptSecrets: () => encryptSecrets,
|
|
@@ -4052,17 +3782,17 @@ function isStateStore(value) {
|
|
|
4052
3782
|
async function createStateStore(options) {
|
|
4053
3783
|
const { config, workspaceRoot, workspaceName } = options;
|
|
4054
3784
|
if (!config || config.provider === "local") {
|
|
4055
|
-
const { LocalStateStore } = await import("./LocalStateStore-
|
|
3785
|
+
const { LocalStateStore } = await import("./LocalStateStore-Cy1ZBW7U.mjs").then((n) => n.n);
|
|
4056
3786
|
return new LocalStateStore(workspaceRoot);
|
|
4057
3787
|
}
|
|
4058
3788
|
if (isStateStore(config.provider)) return config.provider;
|
|
4059
3789
|
if (isStateProvider(config.provider)) {
|
|
4060
|
-
const { LegacyStateStore } = await import("./LegacyStateStore-
|
|
3790
|
+
const { LegacyStateStore } = await import("./LegacyStateStore-DIgkGaUP.mjs");
|
|
4061
3791
|
return new LegacyStateStore(config.provider, { warn: options.warn });
|
|
4062
3792
|
}
|
|
4063
3793
|
if (config.provider === "ssm") {
|
|
4064
3794
|
if (!workspaceName) throw new StateStoreNeedsWorkspaceName("ssm");
|
|
4065
|
-
const { SSMStateStore } = await import("./SSMStateStore-
|
|
3795
|
+
const { SSMStateStore } = await import("./SSMStateStore-DfF174xQ.mjs");
|
|
4066
3796
|
const ssm = config;
|
|
4067
3797
|
return SSMStateStore.create({
|
|
4068
3798
|
workspaceName,
|
|
@@ -4072,7 +3802,7 @@ async function createStateStore(options) {
|
|
|
4072
3802
|
}
|
|
4073
3803
|
if (config.provider === "s3") {
|
|
4074
3804
|
if (!workspaceName) throw new StateStoreNeedsWorkspaceName("s3");
|
|
4075
|
-
const { S3StateStore } = await import("./S3StateStore-
|
|
3805
|
+
const { S3StateStore } = await import("./S3StateStore-D3x6ivBL.mjs");
|
|
4076
3806
|
const s3 = config;
|
|
4077
3807
|
return S3StateStore.create({
|
|
4078
3808
|
workspaceName,
|
|
@@ -5250,7 +4980,7 @@ async function buildDockerImage(imageName, options, cwd) {
|
|
|
5250
4980
|
logger.log(`\n🐳 Building Docker image: ${fullImageName}`);
|
|
5251
4981
|
const cleanup = ensureLockfile(cwd);
|
|
5252
4982
|
try {
|
|
5253
|
-
await run("docker", [
|
|
4983
|
+
await run$1("docker", [
|
|
5254
4984
|
"build",
|
|
5255
4985
|
"--file=.gkm/docker/Dockerfile",
|
|
5256
4986
|
`--tag=${fullImageName}`,
|
|
@@ -5279,7 +5009,7 @@ async function pushDockerImage(imageName, options, cwd) {
|
|
|
5279
5009
|
const fullImageName = validateImageRef(`${registry}/${imageName}:${tag}`);
|
|
5280
5010
|
logger.log(`\n🚀 Pushing Docker image: ${fullImageName}`);
|
|
5281
5011
|
try {
|
|
5282
|
-
await run("docker", ["push", fullImageName], { cwd });
|
|
5012
|
+
await run$1("docker", ["push", fullImageName], { cwd });
|
|
5283
5013
|
logger.log(`✅ Docker image pushed: ${fullImageName}`);
|
|
5284
5014
|
} catch (error) {
|
|
5285
5015
|
throw new DockerPushFailed(fullImageName, error);
|
|
@@ -6221,13 +5951,6 @@ var DokployApi = class {
|
|
|
6221
5951
|
const __filename = fileURLToPath(import.meta.url);
|
|
6222
5952
|
const __dirname = dirname(__filename);
|
|
6223
5953
|
/**
|
|
6224
|
-
* Resolve the tsx package path from the CLI package's dependencies.
|
|
6225
|
-
* This ensures tsx is available regardless of whether the target project has it installed.
|
|
6226
|
-
*/
|
|
6227
|
-
function resolveTsxPath() {
|
|
6228
|
-
return createRequire(import.meta.url).resolve("tsx");
|
|
6229
|
-
}
|
|
6230
|
-
/**
|
|
6231
5954
|
* Resolve the path to a sniffer helper file.
|
|
6232
5955
|
* Handles both dev (.ts with tsx) and production (.mjs from dist).
|
|
6233
5956
|
*
|
|
@@ -6246,6 +5969,39 @@ function resolveSnifferFile(baseName) {
|
|
|
6246
5969
|
return tsPath;
|
|
6247
5970
|
}
|
|
6248
5971
|
/**
|
|
5972
|
+
* Run a sniffer worker in the sandbox, with the sandbox's environment and
|
|
5973
|
+
* nothing of the deploy's: the deploy's Dokploy token, registry login and AWS
|
|
5974
|
+
* keys stay where they are. A worker that outlives the timeout is killed, and
|
|
5975
|
+
* comes back as the error the caller reports.
|
|
5976
|
+
*/
|
|
5977
|
+
async function runSniffer(run, workspacePath, cwd, nodeArgs) {
|
|
5978
|
+
const sandbox = run.sandbox ?? activeSandbox() ?? new LocalSandbox({ root: resolve(workspacePath) });
|
|
5979
|
+
try {
|
|
5980
|
+
const result = await sandbox.exec("node", nodeArgs, {
|
|
5981
|
+
cwd,
|
|
5982
|
+
env: { ...sandbox.env },
|
|
5983
|
+
timeoutMs: run.timeoutMs ?? 3e4,
|
|
5984
|
+
output: "capture"
|
|
5985
|
+
});
|
|
5986
|
+
return {
|
|
5987
|
+
stdout: result.stdout,
|
|
5988
|
+
stderr: result.stderr,
|
|
5989
|
+
code: result.exitCode
|
|
5990
|
+
};
|
|
5991
|
+
} catch (error) {
|
|
5992
|
+
return { error: error instanceof Error ? error : new Error(String(error)) };
|
|
5993
|
+
}
|
|
5994
|
+
}
|
|
5995
|
+
/** The worker's JSON answer: the last object on stdout naming `envVars`. */
|
|
5996
|
+
function snifferAnswer(stdout) {
|
|
5997
|
+
try {
|
|
5998
|
+
const jsonMatch = stdout.match(/\{[^{}]*"envVars"[^{}]*\}[^{]*$/);
|
|
5999
|
+
return jsonMatch ? JSON.parse(jsonMatch[0]) : void 0;
|
|
6000
|
+
} catch {
|
|
6001
|
+
return;
|
|
6002
|
+
}
|
|
6003
|
+
}
|
|
6004
|
+
/**
|
|
6249
6005
|
* Get required environment variables for an app.
|
|
6250
6006
|
*
|
|
6251
6007
|
* Detection strategy (in order):
|
|
@@ -6267,6 +6023,10 @@ function resolveSnifferFile(baseName) {
|
|
|
6267
6023
|
*/
|
|
6268
6024
|
async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
|
|
6269
6025
|
const { logWarnings = true, markOptional = false } = options;
|
|
6026
|
+
const run = {
|
|
6027
|
+
...options.sandbox ? { sandbox: options.sandbox } : {},
|
|
6028
|
+
...options.timeoutMs ? { timeoutMs: options.timeoutMs } : {}
|
|
6029
|
+
};
|
|
6270
6030
|
if (app.type === "web" || app.type === "mobile") {
|
|
6271
6031
|
const publicPrefix = getPublicEnvPrefix(app.framework);
|
|
6272
6032
|
const depVars = publicPrefix ? (app.dependencies ?? []).map((dep) => `${publicPrefix}${dep.toUpperCase()}_URL`) : [];
|
|
@@ -6277,7 +6037,7 @@ async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
|
|
|
6277
6037
|
if (app.config.client) configPaths.push(app.config.client);
|
|
6278
6038
|
if (app.config.server) configPaths.push(app.config.server);
|
|
6279
6039
|
for (const configPath of configPaths) {
|
|
6280
|
-
const result = await sniffEntryFile(configPath, app.path, workspacePath);
|
|
6040
|
+
const result = await sniffEntryFile(configPath, app.path, workspacePath, run);
|
|
6281
6041
|
if (logWarnings && result.error) output.warn(`[sniffer] ${appName}: Config file "${configPath}" threw error during sniffing (env vars still captured): ${result.error.message}`);
|
|
6282
6042
|
sniffedVars.push(...result.envVars);
|
|
6283
6043
|
sniffedOptional.push(...result.optionalEnvVars);
|
|
@@ -6296,7 +6056,7 @@ async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
|
|
|
6296
6056
|
};
|
|
6297
6057
|
}
|
|
6298
6058
|
if (app.entry) {
|
|
6299
|
-
const result = await sniffEntryFile(app.entry, app.path, workspacePath);
|
|
6059
|
+
const result = await sniffEntryFile(app.entry, app.path, workspacePath, run);
|
|
6300
6060
|
if (logWarnings && result.error) output.warn(`[sniffer] ${appName}: Entry file threw error during sniffing (env vars still captured): ${result.error.message}`);
|
|
6301
6061
|
return {
|
|
6302
6062
|
appName,
|
|
@@ -6305,7 +6065,7 @@ async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
|
|
|
6305
6065
|
};
|
|
6306
6066
|
}
|
|
6307
6067
|
if (app.routes) {
|
|
6308
|
-
const result = await sniffRouteFiles(normalizeRoutes(app.routes), app.path, workspacePath);
|
|
6068
|
+
const result = await sniffRouteFiles(normalizeRoutes(app.routes), app.path, workspacePath, run);
|
|
6309
6069
|
if (logWarnings && result.error) output.warn(`[sniffer] ${appName}: Route sniffing threw error (env vars still captured): ${result.error.message}`);
|
|
6310
6070
|
return {
|
|
6311
6071
|
appName,
|
|
@@ -6314,7 +6074,7 @@ async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
|
|
|
6314
6074
|
};
|
|
6315
6075
|
}
|
|
6316
6076
|
if (app.envParser) {
|
|
6317
|
-
const result = await sniffEnvParser(app.envParser, app.path, workspacePath);
|
|
6077
|
+
const result = await sniffEnvParser(app.envParser, app.path, workspacePath, run);
|
|
6318
6078
|
if (logWarnings) {
|
|
6319
6079
|
if (result.error) output.warn(`[sniffer] ${appName}: envParser threw error during sniffing (env vars still captured): ${result.error.message}`);
|
|
6320
6080
|
if (result.unhandledRejections.length > 0) output.warn(`[sniffer] ${appName}: Fire-and-forget rejections during sniffing (suppressed): ${result.unhandledRejections.map((e) => e.message).join(", ")}`);
|
|
@@ -6359,63 +6119,27 @@ function applyMarkOptional(envVars, optionalEnvVars, markOptional) {
|
|
|
6359
6119
|
* @param workspacePath - Absolute path to workspace root
|
|
6360
6120
|
* @returns EntrySniffResult with env vars and optional error
|
|
6361
6121
|
*/
|
|
6362
|
-
async function sniffEntryFile(entryPath, appPath, workspacePath) {
|
|
6122
|
+
async function sniffEntryFile(entryPath, appPath, workspacePath, run = {}) {
|
|
6363
6123
|
const fullEntryPath = resolve(workspacePath, appPath, entryPath);
|
|
6364
6124
|
const loaderPath = resolveSnifferFile("sniffer-loader");
|
|
6365
6125
|
const workerPath = resolveSnifferFile("sniffer-worker");
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
});
|
|
6384
|
-
let stdout = "";
|
|
6385
|
-
let stderr = "";
|
|
6386
|
-
child.stdout.on("data", (data) => {
|
|
6387
|
-
stdout += data.toString();
|
|
6388
|
-
});
|
|
6389
|
-
child.stderr.on("data", (data) => {
|
|
6390
|
-
stderr += data.toString();
|
|
6391
|
-
});
|
|
6392
|
-
child.on("close", (code) => {
|
|
6393
|
-
try {
|
|
6394
|
-
const jsonMatch = stdout.match(/\{[^{}]*"envVars"[^{}]*\}[^{]*$/);
|
|
6395
|
-
if (jsonMatch) {
|
|
6396
|
-
const result = JSON.parse(jsonMatch[0]);
|
|
6397
|
-
resolvePromise({
|
|
6398
|
-
envVars: result.envVars || [],
|
|
6399
|
-
optionalEnvVars: result.optionalEnvVars || [],
|
|
6400
|
-
error: result.error ? new Error(result.error) : void 0
|
|
6401
|
-
});
|
|
6402
|
-
return;
|
|
6403
|
-
}
|
|
6404
|
-
} catch {}
|
|
6405
|
-
resolvePromise({
|
|
6406
|
-
envVars: [],
|
|
6407
|
-
optionalEnvVars: [],
|
|
6408
|
-
error: /* @__PURE__ */ new Error(`Failed to sniff entry file (exit code ${code}): ${stderr || stdout || "No output"}`)
|
|
6409
|
-
});
|
|
6410
|
-
});
|
|
6411
|
-
child.on("error", (err) => {
|
|
6412
|
-
resolvePromise({
|
|
6413
|
-
envVars: [],
|
|
6414
|
-
optionalEnvVars: [],
|
|
6415
|
-
error: err
|
|
6416
|
-
});
|
|
6417
|
-
});
|
|
6418
|
-
});
|
|
6126
|
+
const ran = await runSniffer(run, workspacePath, resolve(workspacePath, appPath), nodeWithTsx(workerPath, [fullEntryPath], [loaderPath]));
|
|
6127
|
+
if ("error" in ran) return {
|
|
6128
|
+
envVars: [],
|
|
6129
|
+
optionalEnvVars: [],
|
|
6130
|
+
error: ran.error
|
|
6131
|
+
};
|
|
6132
|
+
const answer = snifferAnswer(ran.stdout);
|
|
6133
|
+
if (answer) return {
|
|
6134
|
+
envVars: answer.envVars || [],
|
|
6135
|
+
optionalEnvVars: answer.optionalEnvVars || [],
|
|
6136
|
+
error: answer.error ? new Error(answer.error) : void 0
|
|
6137
|
+
};
|
|
6138
|
+
return {
|
|
6139
|
+
envVars: [],
|
|
6140
|
+
optionalEnvVars: [],
|
|
6141
|
+
error: /* @__PURE__ */ new Error(`Failed to sniff entry file (exit code ${ran.code}): ${ran.stderr || ran.stdout || "No output"}`)
|
|
6142
|
+
};
|
|
6419
6143
|
}
|
|
6420
6144
|
/**
|
|
6421
6145
|
* Sniff route files by loading constructs and calling getEnvironment().
|
|
@@ -6431,116 +6155,79 @@ async function sniffEntryFile(entryPath, appPath, workspacePath) {
|
|
|
6431
6155
|
* @param workspacePath - Absolute path to workspace root
|
|
6432
6156
|
* @returns EntrySniffResult with env vars and optional error
|
|
6433
6157
|
*/
|
|
6434
|
-
async function sniffRouteFiles(routes, appPath, workspacePath) {
|
|
6158
|
+
async function sniffRouteFiles(routes, appPath, workspacePath, run = {}) {
|
|
6435
6159
|
const fullAppPath = resolve(workspacePath, appPath);
|
|
6436
6160
|
const workerPath = resolveSnifferFile("sniffer-routes-worker");
|
|
6437
|
-
const tsxPath = resolveTsxPath();
|
|
6438
6161
|
const pattern = (Array.isArray(routes) ? routes : [routes])[0];
|
|
6439
6162
|
if (!pattern) return {
|
|
6440
6163
|
envVars: [],
|
|
6441
6164
|
optionalEnvVars: [],
|
|
6442
6165
|
error: /* @__PURE__ */ new Error("No route patterns provided")
|
|
6443
6166
|
};
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
child.stdout.on("data", (data) => {
|
|
6463
|
-
stdout += data.toString();
|
|
6464
|
-
});
|
|
6465
|
-
child.stderr.on("data", (data) => {
|
|
6466
|
-
stderr += data.toString();
|
|
6467
|
-
});
|
|
6468
|
-
child.on("close", (code) => {
|
|
6469
|
-
if (stderr) stderr.split("\n").filter((line) => line.trim()).forEach((line) => output.warn(line));
|
|
6470
|
-
try {
|
|
6471
|
-
const jsonMatch = stdout.match(/\{[^{}]*"envVars"[^{}]*\}[^{]*$/);
|
|
6472
|
-
if (jsonMatch) {
|
|
6473
|
-
const result = JSON.parse(jsonMatch[0]);
|
|
6474
|
-
resolvePromise({
|
|
6475
|
-
envVars: result.envVars || [],
|
|
6476
|
-
optionalEnvVars: result.optionalEnvVars || [],
|
|
6477
|
-
error: result.error ? new Error(result.error) : void 0
|
|
6478
|
-
});
|
|
6479
|
-
return;
|
|
6480
|
-
}
|
|
6481
|
-
} catch {}
|
|
6482
|
-
resolvePromise({
|
|
6483
|
-
envVars: [],
|
|
6484
|
-
optionalEnvVars: [],
|
|
6485
|
-
error: /* @__PURE__ */ new Error(`Failed to sniff route files (exit code ${code}): ${stderr || stdout || "No output"}`)
|
|
6486
|
-
});
|
|
6487
|
-
});
|
|
6488
|
-
child.on("error", (err) => {
|
|
6489
|
-
resolvePromise({
|
|
6490
|
-
envVars: [],
|
|
6491
|
-
optionalEnvVars: [],
|
|
6492
|
-
error: err
|
|
6493
|
-
});
|
|
6494
|
-
});
|
|
6495
|
-
});
|
|
6167
|
+
const ran = await runSniffer(run, workspacePath, fullAppPath, nodeWithTsx(workerPath, [fullAppPath, pattern]));
|
|
6168
|
+
if ("error" in ran) return {
|
|
6169
|
+
envVars: [],
|
|
6170
|
+
optionalEnvVars: [],
|
|
6171
|
+
error: ran.error
|
|
6172
|
+
};
|
|
6173
|
+
if (ran.stderr) ran.stderr.split("\n").filter((line) => line.trim()).forEach((line) => output.warn(line));
|
|
6174
|
+
const answer = snifferAnswer(ran.stdout);
|
|
6175
|
+
if (answer) return {
|
|
6176
|
+
envVars: answer.envVars || [],
|
|
6177
|
+
optionalEnvVars: answer.optionalEnvVars || [],
|
|
6178
|
+
error: answer.error ? new Error(answer.error) : void 0
|
|
6179
|
+
};
|
|
6180
|
+
return {
|
|
6181
|
+
envVars: [],
|
|
6182
|
+
optionalEnvVars: [],
|
|
6183
|
+
error: /* @__PURE__ */ new Error(`Failed to sniff route files (exit code ${ran.code}): ${ran.stderr || ran.stdout || "No output"}`)
|
|
6184
|
+
};
|
|
6496
6185
|
}
|
|
6497
6186
|
/**
|
|
6498
6187
|
* Run the SnifferEnvironmentParser on an envParser module to detect
|
|
6499
6188
|
* which environment variables it accesses.
|
|
6500
6189
|
*
|
|
6501
|
-
*
|
|
6502
|
-
* the
|
|
6190
|
+
* In a subprocess, like the entry and route sniffers: the module is the
|
|
6191
|
+
* project's code, and it was imported into the deploy itself before — with
|
|
6192
|
+
* every credential the deploy held in reach. Fire-and-forget rejections are
|
|
6193
|
+
* collected there with the shared `sniffWithFireAndForget`.
|
|
6503
6194
|
*
|
|
6504
6195
|
* @param envParserPath - The envParser config (e.g., './src/config/env#envParser')
|
|
6505
6196
|
* @param appPath - The app's path relative to workspace
|
|
6506
6197
|
* @param workspacePath - Absolute path to workspace root
|
|
6507
6198
|
* @returns SniffResult with env vars and any errors encountered
|
|
6508
6199
|
*/
|
|
6509
|
-
async function sniffEnvParser(envParserPath, appPath, workspacePath) {
|
|
6200
|
+
async function sniffEnvParser(envParserPath, appPath, workspacePath, run = {}) {
|
|
6510
6201
|
const [modulePath, exportName = "default"] = envParserPath.split("#");
|
|
6511
6202
|
if (!modulePath) return {
|
|
6512
6203
|
envVars: [],
|
|
6513
6204
|
optionalEnvVars: [],
|
|
6514
6205
|
unhandledRejections: []
|
|
6515
6206
|
};
|
|
6516
|
-
const
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
}
|
|
6539
|
-
|
|
6540
|
-
if (result && typeof result.parse === "function") try {
|
|
6541
|
-
result.parse();
|
|
6542
|
-
} catch {}
|
|
6543
|
-
});
|
|
6207
|
+
const appRoot = resolve(workspacePath, appPath);
|
|
6208
|
+
const fullPath = resolve(appRoot, modulePath);
|
|
6209
|
+
const workerPath = resolveSnifferFile("sniffer-envparser-worker");
|
|
6210
|
+
const ran = await runSniffer(run, workspacePath, appRoot, nodeWithTsx(workerPath, [fullPath, exportName]));
|
|
6211
|
+
if ("error" in ran) return {
|
|
6212
|
+
envVars: [],
|
|
6213
|
+
optionalEnvVars: [],
|
|
6214
|
+
unhandledRejections: [],
|
|
6215
|
+
error: ran.error
|
|
6216
|
+
};
|
|
6217
|
+
const answer = snifferAnswer(ran.stdout);
|
|
6218
|
+
if (!answer) return {
|
|
6219
|
+
envVars: [],
|
|
6220
|
+
optionalEnvVars: [],
|
|
6221
|
+
unhandledRejections: [],
|
|
6222
|
+
error: /* @__PURE__ */ new Error(`Failed to sniff envParser (exit code ${ran.code}): ${ran.stderr || ran.stdout || "No output"}`)
|
|
6223
|
+
};
|
|
6224
|
+
for (const warning of answer.warnings ?? []) output.warn(warning);
|
|
6225
|
+
return {
|
|
6226
|
+
envVars: answer.envVars ?? [],
|
|
6227
|
+
optionalEnvVars: answer.optionalEnvVars ?? [],
|
|
6228
|
+
unhandledRejections: (answer.unhandledRejections ?? []).map((message) => new Error(message)),
|
|
6229
|
+
...answer.error ? { error: new Error(answer.error) } : {}
|
|
6230
|
+
};
|
|
6544
6231
|
}
|
|
6545
6232
|
/**
|
|
6546
6233
|
* Sniff environment requirements for multiple apps.
|
|
@@ -6559,6 +6246,6 @@ async function sniffAllApps(apps, workspacePath, options = {}) {
|
|
|
6559
6246
|
return results;
|
|
6560
6247
|
}
|
|
6561
6248
|
//#endregion
|
|
6562
|
-
export {
|
|
6249
|
+
export { pgClient as $, StateStoreBusy as A, FAKE_ENV as B, setDnsRecord as C, loginCommand as Ct, DocumentStateStore as D, canPrompt as Dt, setPostgresBackupId as E, whoamiCommand as Et, newLockHolder as F, workspace_exports as G, constructGlobs as H, withGeneratedSecrets as I, applyPostgres as J, LOCAL_CA_PATH as K, encryptSecrets as L, StateVersionConflict as M, contentVersion as N, StageStateMissing as O, prompt as Ot, createStateStore as P, composeFor as Q, encryption_exports as R, setDeployedImage as S, prepareEntryCredentials as St, setGeneratedSecret as T, validateDokployToken as Tt, derivedContainers as U, backendsOf as V, reconcileWorkspace as W, postgresStatements as X, postgresDatabaseNames as Y, quoteIdentifier as Z, getBackupState as _, createEntryWrapper as _t, DockerBuildFailed as a, resourceName as at, setApplicationId as b, loadEnvFiles as bt, dockerCommand as c, eventsBackendFor as ct, generateDockerignore as d, DEFAULT_IMAGES as dt, appEnvKeys as et, generateSlimDockerfile as f, describeServices as ft, createEmptyState as g, createCredentialsPreload as gt, resolveHost as h, primaryPortKey as ht, DokployApiError as i, planFor as it, StateStoreWithoutLocking as j, StateLocked as k, siteDockerfile as l, providerOf as lt, isMainFrontendApp as m, portKeys as mt, sniffAppEnvironment as n, envFor as nt, DockerPushFailed as o, hostFor as ot, validateImageRef as p, fakeKey as pt, forgetState as q, DokployApi as r, localRolePassword as rt, appPackageName as s, cacheBackendFor as st, sniffAllApps as t, networkEnv as tt, detectPackageManager as u, storageBackendFor as ut, getGeneratedSecret as v, findAvailablePort as vt, setDnsVerification as w, logoutCommand as wt, setBackupState as x, loadSecretsForApp as xt, isDnsVerified as y, isPortAvailable as yt, keyFingerprint as z };
|
|
6563
6250
|
|
|
6564
|
-
//# sourceMappingURL=sniffer-
|
|
6251
|
+
//# sourceMappingURL=sniffer-49KPbDgq.mjs.map
|