@geekmidas/cli 10.0.0-alpha.63 → 10.0.0-alpha.65
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 +1 -1
- package/dist/{HostingerProvider-mJ7YruxH.cjs → HostingerProvider-Dlmbfass.cjs} +3 -3
- package/dist/{HostingerProvider-mJ7YruxH.cjs.map → HostingerProvider-Dlmbfass.cjs.map} +1 -1
- package/dist/{HostingerProvider-DBBwpDjn.mjs → HostingerProvider-x9gQTAGZ.mjs} +2 -2
- package/dist/{HostingerProvider-DBBwpDjn.mjs.map → HostingerProvider-x9gQTAGZ.mjs.map} +1 -1
- package/dist/{LegacyStateStore-CP7SZwTP.cjs → LegacyStateStore-BGoo__sO.cjs} +2 -2
- package/dist/{LegacyStateStore-CP7SZwTP.cjs.map → LegacyStateStore-BGoo__sO.cjs.map} +1 -1
- package/dist/{LegacyStateStore-Q3GmKOdw.mjs → LegacyStateStore-BUu1nQ5u.mjs} +2 -2
- package/dist/{LegacyStateStore-Q3GmKOdw.mjs.map → LegacyStateStore-BUu1nQ5u.mjs.map} +1 -1
- package/dist/{LocalStateStore-sS8mvLeq.cjs → LocalStateStore-93urXyQe.cjs} +2 -2
- package/dist/{LocalStateStore-sS8mvLeq.cjs.map → LocalStateStore-93urXyQe.cjs.map} +1 -1
- package/dist/{LocalStateStore-BGIXcrvX.mjs → LocalStateStore-BRhMQRuy.mjs} +2 -2
- package/dist/{LocalStateStore-BGIXcrvX.mjs.map → LocalStateStore-BRhMQRuy.mjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-CjHWFRDd.cjs → OpenApiTsGenerator-BWuDRHe9.cjs} +2 -2
- package/dist/{OpenApiTsGenerator-CjHWFRDd.cjs.map → OpenApiTsGenerator-BWuDRHe9.cjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-CnAwhGxi.mjs → OpenApiTsGenerator-C6v-IeHt.mjs} +2 -2
- package/dist/{OpenApiTsGenerator-CnAwhGxi.mjs.map → OpenApiTsGenerator-C6v-IeHt.mjs.map} +1 -1
- package/dist/{S3StateStore-6jqITH2F.cjs → S3StateStore-F4dxw6kS.cjs} +2 -2
- package/dist/{S3StateStore-6jqITH2F.cjs.map → S3StateStore-F4dxw6kS.cjs.map} +1 -1
- package/dist/{S3StateStore-D7l_lWJ3.mjs → S3StateStore-pw1GhWwt.mjs} +2 -2
- package/dist/{S3StateStore-D7l_lWJ3.mjs.map → S3StateStore-pw1GhWwt.mjs.map} +1 -1
- package/dist/{SSMStateStore-B__F7IJa.cjs → SSMStateStore-Bt9acuAF.cjs} +2 -2
- package/dist/{SSMStateStore-B__F7IJa.cjs.map → SSMStateStore-Bt9acuAF.cjs.map} +1 -1
- package/dist/{SSMStateStore-CAQDVpoc.mjs → SSMStateStore-Dmj7zzFO.mjs} +2 -2
- package/dist/{SSMStateStore-CAQDVpoc.mjs.map → SSMStateStore-Dmj7zzFO.mjs.map} +1 -1
- package/dist/{bundler-DLfOn0ls.cjs → bundler-D6MlIfBT.cjs} +3 -3
- package/dist/{bundler-DLfOn0ls.cjs.map → bundler-D6MlIfBT.cjs.map} +1 -1
- package/dist/{bundler-DyWI41Iy.mjs → bundler-D_14JLZF.mjs} +3 -3
- package/dist/{bundler-DyWI41Iy.mjs.map → bundler-D_14JLZF.mjs.map} +1 -1
- package/dist/{cli-D-ZM-X2s.cjs → cli-BfH1deAT.cjs} +8 -7
- package/dist/{cli-D-ZM-X2s.cjs.map → cli-BfH1deAT.cjs.map} +1 -1
- package/dist/{cli-PkVF28LM.mjs → cli-P56vvrDQ.mjs} +5 -4
- package/dist/{cli-PkVF28LM.mjs.map → cli-P56vvrDQ.mjs.map} +1 -1
- package/dist/compose-391oEKj1.cjs +1982 -0
- package/dist/compose-391oEKj1.cjs.map +1 -0
- package/dist/compose-DprE3ASm.mjs +1862 -0
- package/dist/compose-DprE3ASm.mjs.map +1 -0
- package/dist/{config-C2BUosLm.d.mts → config-BonvTW8p.d.mts} +3 -3
- package/dist/{config-C2BUosLm.d.mts.map → config-BonvTW8p.d.mts.map} +1 -1
- package/dist/{config-CemHVcIr.d.cts → config-V_X_BMpm.d.cts} +3 -3
- package/dist/{config-CemHVcIr.d.cts.map → config-V_X_BMpm.d.cts.map} +1 -1
- package/dist/config.cjs +416 -17
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +401 -2
- package/dist/config.mjs.map +1 -0
- package/dist/credentials-Bzbg23n8.cjs +298 -0
- package/dist/credentials-Bzbg23n8.cjs.map +1 -0
- package/dist/credentials-Dq1MnWQf.mjs +233 -0
- package/dist/credentials-Dq1MnWQf.mjs.map +1 -0
- package/dist/{define-CHBIEc5j.mjs → define-DR8xGYfL.mjs} +6 -3
- package/dist/define-DR8xGYfL.mjs.map +1 -0
- package/dist/{define-Cv_QvDrg.cjs → define-DzRz8FgH.cjs} +6 -3
- package/dist/define-DzRz8FgH.cjs.map +1 -0
- package/dist/deploy/public.cjs +39 -33
- package/dist/deploy/public.cjs.map +1 -1
- package/dist/deploy/public.d.cts +44 -5
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +44 -5
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +15 -12
- package/dist/deploy/public.mjs.map +1 -1
- package/dist/{deploy-CGW-QY9D.mjs → deploy-9MBG_QLd.mjs} +11 -9
- package/dist/deploy-9MBG_QLd.mjs.map +1 -0
- package/dist/{deploy-BiMrP9i7.cjs → deploy-B80idPUZ.cjs} +17 -15
- package/dist/deploy-B80idPUZ.cjs.map +1 -0
- package/dist/{deploy-CG8bfFij.mjs → deploy-CZ5nlpsu.mjs} +16 -119
- package/dist/deploy-CZ5nlpsu.mjs.map +1 -0
- package/dist/{deploy-ABBI0lf1.cjs → deploy-Cy8igpQF.cjs} +48 -151
- package/dist/deploy-Cy8igpQF.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-C_6COHEv.cjs → discover-DHdECueV.cjs} +6 -157
- package/dist/discover-DHdECueV.cjs.map +1 -0
- package/dist/{discover-BaT6bpnA.mjs → discover-LMrqsWSU.mjs} +8 -117
- package/dist/discover-LMrqsWSU.mjs.map +1 -0
- package/dist/{dokploy-CwdmlyQL.mjs → dokploy-BdtBePjp.mjs} +3 -3
- package/dist/{dokploy-CwdmlyQL.mjs.map → dokploy-BdtBePjp.mjs.map} +1 -1
- package/dist/{dokploy-QJxMhxdf.cjs → dokploy-iFY8MY-L.cjs} +3 -3
- package/dist/{dokploy-QJxMhxdf.cjs.map → dokploy-iFY8MY-L.cjs.map} +1 -1
- package/dist/{encryption-DXw3jj0c.cjs → encryption-B1wJwgae.cjs} +6 -6
- package/dist/{encryption-DXw3jj0c.cjs.map → encryption-B1wJwgae.cjs.map} +1 -1
- package/dist/{encryption-CbQG_ayW.mjs → encryption-DF_hgIpl.mjs} +5 -5
- package/dist/{encryption-CbQG_ayW.mjs.map → encryption-DF_hgIpl.mjs.map} +1 -1
- package/dist/{github-ciwbIwVa.mjs → github-B0YYE98x.mjs} +4 -4
- package/dist/{github-ciwbIwVa.mjs.map → github-B0YYE98x.mjs.map} +1 -1
- package/dist/{github-BH_mETav.cjs → github-CYcmTdFs.cjs} +4 -4
- package/dist/{github-BH_mETav.cjs.map → github-CYcmTdFs.cjs.map} +1 -1
- package/dist/{index-DrKzpHl-.d.mts → index-DPUAGJaK.d.cts} +16 -3
- package/dist/index-DPUAGJaK.d.cts.map +1 -0
- package/dist/{index-BtXDZQuF.d.cts → index-DwKD_8lt.d.mts} +16 -3
- package/dist/index-DwKD_8lt.d.mts.map +1 -0
- package/dist/index.cjs +280 -1849
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +221 -1774
- package/dist/index.mjs.map +1 -1
- package/dist/local-BdH4XN0E.cjs +409 -0
- package/dist/local-BdH4XN0E.cjs.map +1 -0
- package/dist/local-CWR4Y_kW.mjs +350 -0
- package/dist/local-CWR4Y_kW.mjs.map +1 -0
- package/dist/{migrate-ImBKTBcW.mjs → migrate-B2qL5wj4.mjs} +8 -7
- package/dist/{migrate-ImBKTBcW.mjs.map → migrate-B2qL5wj4.mjs.map} +1 -1
- package/dist/{migrate-6oa9y_f2.cjs → migrate-q4pPAXtO.cjs} +21 -20
- package/dist/{migrate-6oa9y_f2.cjs.map → migrate-q4pPAXtO.cjs.map} +1 -1
- package/dist/openapi.cjs +2 -2
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.mjs +2 -2
- package/dist/provider-C9_-45d5.cjs +56 -0
- package/dist/provider-C9_-45d5.cjs.map +1 -0
- package/dist/provider-q4lsYzYG.mjs +45 -0
- package/dist/provider-q4lsYzYG.mjs.map +1 -0
- package/dist/{ready-Bpdnn2ON.mjs → ready-bQfu9GES.mjs} +3 -3
- package/dist/{ready-Bpdnn2ON.mjs.map → ready-bQfu9GES.mjs.map} +1 -1
- package/dist/{ready-BiG0rt4h.cjs → ready-brEhh68f.cjs} +3 -3
- package/dist/{ready-BiG0rt4h.cjs.map → ready-brEhh68f.cjs.map} +1 -1
- package/dist/reconcile/public.cjs +1 -1
- package/dist/reconcile/public.d.cts +1 -1
- package/dist/reconcile/public.d.mts +1 -1
- package/dist/reconcile/public.mjs +1 -1
- package/dist/resolve-DLkIXTct.mjs +262 -0
- package/dist/resolve-DLkIXTct.mjs.map +1 -0
- package/dist/resolve-N_i4XNd-.cjs +315 -0
- package/dist/resolve-N_i4XNd-.cjs.map +1 -0
- package/dist/{runtime-Dn_n-29S.d.cts → runtime-BnD7Nn96.d.cts} +2 -2
- package/dist/{runtime-CXPlkZzs.d.mts.map → runtime-BnD7Nn96.d.cts.map} +1 -1
- package/dist/{runtime-CXPlkZzs.d.mts → runtime-j-tmFL65.d.mts} +2 -2
- package/dist/{runtime-Dn_n-29S.d.cts.map → runtime-j-tmFL65.d.mts.map} +1 -1
- package/dist/sandbox/discover-worker.cjs +1 -1
- package/dist/sandbox/discover-worker.mjs +1 -1
- 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/sniffer-BSwaL-dX.cjs +2236 -0
- package/dist/sniffer-BSwaL-dX.cjs.map +1 -0
- package/dist/sniffer-BZ-OJO4Y.mjs +2068 -0
- package/dist/sniffer-BZ-OJO4Y.mjs.map +1 -0
- package/dist/sst-B2HbrDR3.mjs +430 -0
- package/dist/sst-B2HbrDR3.mjs.map +1 -0
- package/dist/sst-DcfsVH6x.cjs +453 -0
- package/dist/sst-DcfsVH6x.cjs.map +1 -0
- package/dist/{sniffer-aO_-s5vq.mjs → state-B8YwmUZU.mjs} +1204 -3236
- package/dist/state-B8YwmUZU.mjs.map +1 -0
- package/dist/{sniffer-D_SYc_pO.cjs → state-DF26e_lo.cjs} +1251 -3494
- package/dist/state-DF26e_lo.cjs.map +1 -0
- package/dist/{store-KvNQwYaB.cjs → store-CJF1Tqkq.cjs} +4 -4
- package/dist/{store-KvNQwYaB.cjs.map → store-CJF1Tqkq.cjs.map} +1 -1
- package/dist/{store-BS8A7NcA.mjs → store-CLiHnqOY.mjs} +2 -2
- package/dist/{store-BS8A7NcA.mjs.map → store-CLiHnqOY.mjs.map} +1 -1
- package/dist/target/public.cjs +6 -6
- 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-Bs5E1oxm.cjs +88 -0
- package/dist/terminal-Bs5E1oxm.cjs.map +1 -0
- package/dist/terminal-CfbiYUbZ.mjs +84 -0
- package/dist/terminal-CfbiYUbZ.mjs.map +1 -0
- package/dist/{types-DIA7Li-J.d.cts → types-BCzMWBb6.d.mts} +84 -17
- package/dist/types-BCzMWBb6.d.mts.map +1 -0
- package/dist/{types-CfLKGfC_.d.mts → types-ByMWkXKP.d.cts} +85 -16
- package/dist/types-ByMWkXKP.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 +1 -1
- package/dist/vitest.mjs +1 -1
- package/dist/workspace/index.cjs +3 -1
- package/dist/workspace/index.d.cts +3 -3
- package/dist/workspace/index.d.mts +3 -3
- package/dist/workspace/index.mjs +2 -2
- package/dist/{workspace-Kl4NG9IH.cjs → workspace-BewAHZIo.cjs} +41 -6
- package/dist/workspace-BewAHZIo.cjs.map +1 -0
- package/dist/{workspace-Dh7rr7l4.mjs → workspace-C06_pW4g.mjs} +30 -7
- package/dist/workspace-C06_pW4g.mjs.map +1 -0
- package/package.json +13 -13
- package/dist/config-BEJYKd4s.cjs +0 -648
- package/dist/config-BEJYKd4s.cjs.map +0 -1
- package/dist/config-LKKCVCnC.mjs +0 -547
- package/dist/config-LKKCVCnC.mjs.map +0 -1
- package/dist/define-CHBIEc5j.mjs.map +0 -1
- package/dist/define-Cv_QvDrg.cjs.map +0 -1
- package/dist/deploy-ABBI0lf1.cjs.map +0 -1
- package/dist/deploy-BiMrP9i7.cjs.map +0 -1
- package/dist/deploy-CG8bfFij.mjs.map +0 -1
- package/dist/deploy-CGW-QY9D.mjs.map +0 -1
- package/dist/discover-BaT6bpnA.mjs.map +0 -1
- package/dist/discover-C_6COHEv.cjs.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/index-BtXDZQuF.d.cts.map +0 -1
- package/dist/index-DrKzpHl-.d.mts.map +0 -1
- package/dist/resolve-B1T0hUaR.mjs +0 -170
- package/dist/resolve-B1T0hUaR.mjs.map +0 -1
- package/dist/resolve-xytBTtG4.cjs +0 -217
- package/dist/resolve-xytBTtG4.cjs.map +0 -1
- package/dist/runtime-CMwtq0AL.cjs +0 -163
- package/dist/runtime-CMwtq0AL.cjs.map +0 -1
- package/dist/runtime-DbakJS8u.mjs +0 -134
- package/dist/runtime-DbakJS8u.mjs.map +0 -1
- package/dist/sniffer-D_SYc_pO.cjs.map +0 -1
- package/dist/sniffer-aO_-s5vq.mjs.map +0 -1
- package/dist/terminal-D0f1u0LG.cjs +0 -576
- package/dist/terminal-D0f1u0LG.cjs.map +0 -1
- package/dist/terminal-gMxAo9Dj.mjs +0 -517
- package/dist/terminal-gMxAo9Dj.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-Dh7rr7l4.mjs.map +0 -1
- package/dist/workspace-Kl4NG9IH.cjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geekmidas/cli",
|
|
3
|
-
"version": "10.0.0-alpha.
|
|
3
|
+
"version": "10.0.0-alpha.65",
|
|
4
4
|
"description": "CLI tools for building Lambda handlers, server applications, and generating OpenAPI specs",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -118,15 +118,15 @@
|
|
|
118
118
|
"prompts": "~2.4.2",
|
|
119
119
|
"tsx": "~4.23.15",
|
|
120
120
|
"yaml": "~2.9.1",
|
|
121
|
-
"@geekmidas/cache": "10.0.0-alpha.
|
|
122
|
-
"@geekmidas/constructs": "~10.0.0-alpha.
|
|
123
|
-
"@geekmidas/db": "10.0.0-alpha.
|
|
124
|
-
"@geekmidas/envkit": "~10.0.0-alpha.
|
|
125
|
-
"@geekmidas/errors": "~10.0.0-alpha.
|
|
126
|
-
"@geekmidas/logger": "~10.0.0-alpha.
|
|
127
|
-
"@geekmidas/manifest": "10.0.0-alpha.
|
|
128
|
-
"@geekmidas/schema": "~10.0.0-alpha.
|
|
129
|
-
"@geekmidas/services": "~10.0.0-alpha.
|
|
121
|
+
"@geekmidas/cache": "10.0.0-alpha.65",
|
|
122
|
+
"@geekmidas/constructs": "~10.0.0-alpha.65",
|
|
123
|
+
"@geekmidas/db": "10.0.0-alpha.65",
|
|
124
|
+
"@geekmidas/envkit": "~10.0.0-alpha.65",
|
|
125
|
+
"@geekmidas/errors": "~10.0.0-alpha.65",
|
|
126
|
+
"@geekmidas/logger": "~10.0.0-alpha.65",
|
|
127
|
+
"@geekmidas/manifest": "10.0.0-alpha.65",
|
|
128
|
+
"@geekmidas/schema": "~10.0.0-alpha.65",
|
|
129
|
+
"@geekmidas/services": "~10.0.0-alpha.65"
|
|
130
130
|
},
|
|
131
131
|
"devDependencies": {
|
|
132
132
|
"@hono/node-server": "~1.19.5",
|
|
@@ -140,11 +140,11 @@
|
|
|
140
140
|
"typescript": "~7.0.2",
|
|
141
141
|
"vitest": "~5.0.2",
|
|
142
142
|
"zod": "~4.6.5",
|
|
143
|
-
"@geekmidas/events": "~10.0.0-alpha.
|
|
144
|
-
"@geekmidas/testkit": "10.0.0-alpha.
|
|
143
|
+
"@geekmidas/events": "~10.0.0-alpha.65",
|
|
144
|
+
"@geekmidas/testkit": "10.0.0-alpha.65"
|
|
145
145
|
},
|
|
146
146
|
"peerDependencies": {
|
|
147
|
-
"@geekmidas/telescope": "~10.0.0-alpha.
|
|
147
|
+
"@geekmidas/telescope": "~10.0.0-alpha.65"
|
|
148
148
|
},
|
|
149
149
|
"peerDependenciesMeta": {
|
|
150
150
|
"@geekmidas/telescope": {
|
package/dist/config-BEJYKd4s.cjs
DELETED
|
@@ -1,648 +0,0 @@
|
|
|
1
|
-
const require_schemas = require("./schemas-Ckm_aBnF.cjs");
|
|
2
|
-
const require_discover = require("./discover-C_6COHEv.cjs");
|
|
3
|
-
const require_workspace = require("./workspace-Kl4NG9IH.cjs");
|
|
4
|
-
let node_path = require("node:path");
|
|
5
|
-
let node_fs = require("node:fs");
|
|
6
|
-
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
7
|
-
//#region src/workspace/derive.ts
|
|
8
|
-
/**
|
|
9
|
-
* The apps a manifest implies.
|
|
10
|
-
*
|
|
11
|
-
* `gkm.config.ts` used to carry an `apps` block naming every app: its type, its
|
|
12
|
-
* path, its port, its framework, which other apps it depended on. Every one of
|
|
13
|
-
* those facts was already declared. A `StaticSite('Web', { path: 'apps/web' })`
|
|
14
|
-
* and an `apps.web = { type: 'web', path: 'apps/web', framework: 'vite',
|
|
15
|
-
* dependencies: ['api'] }` are the same statement written twice, and only one of
|
|
16
|
-
* them was checked against anything — so the copy in config was free to drift,
|
|
17
|
-
* and a surface config had no entry for simply never deployed.
|
|
18
|
-
*
|
|
19
|
-
* So the list comes from the graph. A `site` is an app, and so is every
|
|
20
|
-
* `rest-api` — one surface, one container, at the `path` it declared.
|
|
21
|
-
*
|
|
22
|
-
* What config still supplies is what no graph can answer: the backends a cache
|
|
23
|
-
* and a mailer resolve to, the deploy endpoint, the stage's domain.
|
|
24
|
-
*/
|
|
25
|
-
/** Which frontend framework builds each site variant. */
|
|
26
|
-
const FRAMEWORKS = {
|
|
27
|
-
static: "vite",
|
|
28
|
-
next: "nextjs",
|
|
29
|
-
tanstack: "tanstack-start"
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* The app key a construct id becomes.
|
|
33
|
-
*
|
|
34
|
-
* The same kebab form every physical name is built from, so `Api` is `api` in
|
|
35
|
-
* the config, `production-kitchen-sink-api` on Dokploy, and `API_URL` in an
|
|
36
|
-
* environment — one id, three renderings, no second list.
|
|
37
|
-
*/
|
|
38
|
-
function appKey(id) {
|
|
39
|
-
return (0, _geekmidas_manifest.kebabCase)(id);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* The app serving a surface: its own, always.
|
|
43
|
-
*
|
|
44
|
-
* Every surface gets a container. There is no arrangement in which one runs
|
|
45
|
-
* inside another — two surfaces in a process share a filesystem, an
|
|
46
|
-
* environment, and every credential either was granted, so an auth server
|
|
47
|
-
* beside an API is one bug in the API away from being read by it.
|
|
48
|
-
*/
|
|
49
|
-
function hostOf(manifest, id) {
|
|
50
|
-
const declaration = manifest[id];
|
|
51
|
-
if (!declaration || declaration.kind !== "rest-api") return void 0;
|
|
52
|
-
return id;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Local ports, assigned so that adding a site does not renumber the others.
|
|
56
|
-
*
|
|
57
|
-
* Backends first, then the site holding the base domain, then the rest
|
|
58
|
-
* alphabetically. The ordering is arbitrary but it is *fixed*, which is the
|
|
59
|
-
* property that matters: a port that moves when an unrelated app is added is a
|
|
60
|
-
* port nobody can put in a bookmark. A construct that names its own port keeps
|
|
61
|
-
* it, and is skipped here.
|
|
62
|
-
*/
|
|
63
|
-
function assignPorts(apps) {
|
|
64
|
-
const rank = (name, app) => [
|
|
65
|
-
app.type === "backend" ? 0 : app.type === "web" ? 1 : 2,
|
|
66
|
-
app.root ? 0 : 1,
|
|
67
|
-
name
|
|
68
|
-
];
|
|
69
|
-
const ordered = Object.entries(apps).sort(([aName, a], [bName, b]) => {
|
|
70
|
-
const [at, ar, an] = rank(aName, a);
|
|
71
|
-
const [bt, br, bn] = rank(bName, b);
|
|
72
|
-
return at - bt || ar - br || an.localeCompare(bn);
|
|
73
|
-
});
|
|
74
|
-
const taken = new Set(ordered.map(([, app]) => app.port).filter((p) => !!p));
|
|
75
|
-
let next = 3e3;
|
|
76
|
-
for (const [, app] of ordered) {
|
|
77
|
-
if (app.port) continue;
|
|
78
|
-
while (taken.has(next)) next += 1;
|
|
79
|
-
app.port = next;
|
|
80
|
-
taken.add(next);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Whichever site holds the base domain.
|
|
85
|
-
*
|
|
86
|
-
* The convention first — a site named `web` — because it is one people already
|
|
87
|
-
* rely on. Then an explicit `root: true`. A project with one site needs neither.
|
|
88
|
-
*/
|
|
89
|
-
function markRoot(apps) {
|
|
90
|
-
const sites = Object.entries(apps).filter(([, a]) => a.type === "web");
|
|
91
|
-
if (sites.length === 0) return;
|
|
92
|
-
if (sites.some(([, a]) => a.root)) return;
|
|
93
|
-
const chosen = sites.find(([name]) => name === "web") ?? (sites.length === 1 ? sites[0] : void 0);
|
|
94
|
-
if (chosen) chosen[1].root = true;
|
|
95
|
-
}
|
|
96
|
-
function derivedApps(manifest, workspace) {
|
|
97
|
-
const apps = {};
|
|
98
|
-
const defaultTarget = workspace.deploy?.default ?? "dokploy";
|
|
99
|
-
for (const [id, declaration] of Object.entries(manifest)) {
|
|
100
|
-
if (declaration.kind !== "site" && declaration.kind !== "mobile-app" && declaration.kind !== "rest-api") continue;
|
|
101
|
-
const spec = declaration.kind === "site" || declaration.kind === "mobile-app" ? declaration.app : {
|
|
102
|
-
path: declaration.path,
|
|
103
|
-
...declaration.telescope ? { telescope: true } : {}
|
|
104
|
-
};
|
|
105
|
-
const name = appKey(id);
|
|
106
|
-
const configured = workspace.apps[name];
|
|
107
|
-
apps[name] = {
|
|
108
|
-
...configured,
|
|
109
|
-
type: declaration.kind === "site" ? "web" : declaration.kind === "mobile-app" ? "mobile" : "backend",
|
|
110
|
-
path: spec.path,
|
|
111
|
-
port: spec.port ?? configured?.port ?? 0,
|
|
112
|
-
...(declaration.kind === "rest-api" || declaration.kind === "site") && declaration.subdomain ? { subdomain: declaration.subdomain } : {},
|
|
113
|
-
dependencies: [],
|
|
114
|
-
resolvedDeployTarget: configured?.resolvedDeployTarget ?? defaultTarget,
|
|
115
|
-
...declaration.kind === "site" ? {
|
|
116
|
-
framework: configured?.framework ?? FRAMEWORKS[declaration.variant],
|
|
117
|
-
...declaration.root ? { root: true } : {},
|
|
118
|
-
...spec.config ? { config: spec.config } : {}
|
|
119
|
-
} : {},
|
|
120
|
-
...declaration.kind === "mobile-app" ? {
|
|
121
|
-
framework: configured?.framework ?? declaration.variant,
|
|
122
|
-
...spec.config ? { config: spec.config } : {}
|
|
123
|
-
} : {},
|
|
124
|
-
...spec.telescope !== void 0 ? { telescope: spec.telescope } : {},
|
|
125
|
-
...spec.openapi !== void 0 ? { openapi: spec.openapi } : {},
|
|
126
|
-
...spec.runtime !== void 0 ? { runtime: spec.runtime } : {},
|
|
127
|
-
...spec.env !== void 0 ? { env: spec.env } : {},
|
|
128
|
-
...spec.entry !== void 0 ? { entry: spec.entry } : {},
|
|
129
|
-
...configured?.domain ? { domain: configured.domain } : {}
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
for (const [id, declaration] of Object.entries(manifest)) {
|
|
133
|
-
if (declaration.kind !== "site" && declaration.kind !== "mobile-app" && declaration.kind !== "rest-api") continue;
|
|
134
|
-
const app = apps[appKey(id)];
|
|
135
|
-
if (!app) continue;
|
|
136
|
-
const edges = declaration.kind === "rest-api" ? declaration.calls ?? [] : declaration.dependencies ?? [];
|
|
137
|
-
const names = /* @__PURE__ */ new Set();
|
|
138
|
-
for (const edge of edges) {
|
|
139
|
-
if (edge.kind !== "rest-api") continue;
|
|
140
|
-
const host = hostOf(manifest, edge.target);
|
|
141
|
-
if (!host) continue;
|
|
142
|
-
const key = appKey(host);
|
|
143
|
-
if (key !== appKey(id) && apps[key]) names.add(key);
|
|
144
|
-
}
|
|
145
|
-
app.dependencies = [...names].sort();
|
|
146
|
-
}
|
|
147
|
-
markRoot(apps);
|
|
148
|
-
assignPorts(apps);
|
|
149
|
-
for (const [name, app] of Object.entries(workspace.apps)) if (!apps[name]) apps[name] = app;
|
|
150
|
-
return apps;
|
|
151
|
-
}
|
|
152
|
-
//#endregion
|
|
153
|
-
//#region src/config.ts
|
|
154
|
-
/**
|
|
155
|
-
* Define GKM configuration with full TypeScript support.
|
|
156
|
-
* This is an identity function that provides type safety and autocomplete.
|
|
157
|
-
*
|
|
158
|
-
* @example
|
|
159
|
-
* ```ts
|
|
160
|
-
* // gkm.config.ts
|
|
161
|
-
* import { defineConfig } from '@geekmidas/cli/config';
|
|
162
|
-
*
|
|
163
|
-
* export default defineConfig({
|
|
164
|
-
* routes: './src/endpoints/**\/*.ts',
|
|
165
|
-
* envParser: './src/config/env',
|
|
166
|
-
* logger: './src/config/logger',
|
|
167
|
-
* telescope: true,
|
|
168
|
-
* });
|
|
169
|
-
* ```
|
|
170
|
-
*/
|
|
171
|
-
function defineConfig(config) {
|
|
172
|
-
return config;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Parse a module config string into path and import pattern.
|
|
176
|
-
*
|
|
177
|
-
* @param configString - Config string in format "./path/to/module" or "./path/to/module#exportName"
|
|
178
|
-
* @param defaultAlias - The default alias name to use if no export name specified
|
|
179
|
-
* @returns Object with path and import pattern
|
|
180
|
-
*
|
|
181
|
-
* @example
|
|
182
|
-
* parseModuleConfig('./src/config/env', 'envParser')
|
|
183
|
-
* // { path: './src/config/env', importPattern: 'envParser' }
|
|
184
|
-
*
|
|
185
|
-
* parseModuleConfig('./src/config/env#envParser', 'envParser')
|
|
186
|
-
* // { path: './src/config/env', importPattern: '{ envParser }' }
|
|
187
|
-
*
|
|
188
|
-
* parseModuleConfig('./src/config/env#myEnv', 'envParser')
|
|
189
|
-
* // { path: './src/config/env', importPattern: '{ myEnv as envParser }' }
|
|
190
|
-
*/
|
|
191
|
-
function parseModuleConfig(configString, defaultAlias) {
|
|
192
|
-
const parts = configString.split("#");
|
|
193
|
-
const path = parts[0] ?? configString;
|
|
194
|
-
const exportName = parts[1];
|
|
195
|
-
return {
|
|
196
|
-
path,
|
|
197
|
-
importPattern: !exportName ? defaultAlias : exportName === defaultAlias ? `{ ${defaultAlias} }` : `{ ${exportName} as ${defaultAlias} }`
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Find and return the path to the config file.
|
|
202
|
-
*
|
|
203
|
-
* Resolution order:
|
|
204
|
-
* 1. GKM_CONFIG_PATH env var (set by workspace dev command)
|
|
205
|
-
* 2. Walk up directory tree from cwd
|
|
206
|
-
*/
|
|
207
|
-
function findConfigPath(cwd) {
|
|
208
|
-
const files = [
|
|
209
|
-
"gkm.config.json",
|
|
210
|
-
"gkm.config.ts",
|
|
211
|
-
"gkm.config.js"
|
|
212
|
-
];
|
|
213
|
-
const envConfigPath = process.env.GKM_CONFIG_PATH;
|
|
214
|
-
if (envConfigPath && (0, node_fs.existsSync)(envConfigPath)) return {
|
|
215
|
-
configPath: envConfigPath,
|
|
216
|
-
workspaceRoot: (0, node_path.dirname)(envConfigPath)
|
|
217
|
-
};
|
|
218
|
-
let currentDir = cwd;
|
|
219
|
-
const { root } = (0, node_path.parse)(currentDir);
|
|
220
|
-
while (currentDir !== root) {
|
|
221
|
-
for (const file of files) {
|
|
222
|
-
const configPath = (0, node_path.join)(currentDir, file);
|
|
223
|
-
if ((0, node_fs.existsSync)(configPath)) return {
|
|
224
|
-
configPath,
|
|
225
|
-
workspaceRoot: currentDir
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
currentDir = (0, node_path.dirname)(currentDir);
|
|
229
|
-
}
|
|
230
|
-
throw new ConfigNotFound(cwd);
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* The directory holding the gkm config that `cwd` belongs to — the project a
|
|
234
|
-
* sandbox for it is confined to.
|
|
235
|
-
*
|
|
236
|
-
* @throws {ConfigNotFound} when neither `cwd` nor any parent has one.
|
|
237
|
-
*/
|
|
238
|
-
function findWorkspaceRoot(cwd) {
|
|
239
|
-
return findConfigPath(cwd).workspaceRoot;
|
|
240
|
-
}
|
|
241
|
-
/** No gkm config in a directory or any of its parents. */
|
|
242
|
-
var ConfigNotFound = class extends Error {
|
|
243
|
-
cwd;
|
|
244
|
-
constructor(cwd) {
|
|
245
|
-
super("Configuration file not found. Please create gkm.config.json, gkm.config.ts, or gkm.config.js in the project root.");
|
|
246
|
-
this.cwd = cwd;
|
|
247
|
-
this.name = "ConfigNotFound";
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
/**
|
|
251
|
-
* How long loading a config, or discovering its constructs, may take in a
|
|
252
|
-
* sandbox: room for tsx to compile a large project cold, and not a deploy
|
|
253
|
-
* held open by a config that never finishes importing.
|
|
254
|
-
*/
|
|
255
|
-
const CONFIG_LOAD_TIMEOUT_MS = 6e4;
|
|
256
|
-
/** The config failed to import, or threw while it ran. */
|
|
257
|
-
var ConfigLoadFailed = class extends Error {
|
|
258
|
-
configPath;
|
|
259
|
-
detail;
|
|
260
|
-
constructor(configPath, detail) {
|
|
261
|
-
super(`Failed to load config: ${detail}`);
|
|
262
|
-
this.configPath = configPath;
|
|
263
|
-
this.detail = detail;
|
|
264
|
-
this.name = "ConfigLoadFailed";
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
/**
|
|
268
|
-
* The config holds something that is not data — a custom state store, an
|
|
269
|
-
* inline deploy target, a function — and the sandbox it was loaded in hands
|
|
270
|
-
* the deploy nothing but data.
|
|
271
|
-
*/
|
|
272
|
-
var ConfigObjectNotSerializable = class extends Error {
|
|
273
|
-
configPath;
|
|
274
|
-
paths;
|
|
275
|
-
constructor(configPath, paths) {
|
|
276
|
-
super(`${configPath} holds values that are not plain data at: ${paths.join(", ")}. It was loaded in an isolating sandbox, which hands the deploy the config as JSON, so a live object — a custom store, an inline target, a function — cannot reach it. Configure these with plain values instead, or deploy this project with a sandbox that is not isolating (the default) if the host trusts it.`);
|
|
277
|
-
this.configPath = configPath;
|
|
278
|
-
this.paths = paths;
|
|
279
|
-
this.name = "ConfigObjectNotSerializable";
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
/** What the config worker answers. Checked: the worker ran project code. */
|
|
283
|
-
const ConfigAnswer = require_schemas.discriminatedUnion("reason", [
|
|
284
|
-
require_schemas.object({
|
|
285
|
-
reason: require_schemas.literal("loaded"),
|
|
286
|
-
config: require_schemas.record(require_schemas.string(), require_schemas.unknown())
|
|
287
|
-
}),
|
|
288
|
-
require_schemas.object({
|
|
289
|
-
reason: require_schemas.literal("live"),
|
|
290
|
-
paths: require_schemas.array(require_schemas.string())
|
|
291
|
-
}),
|
|
292
|
-
require_schemas.object({
|
|
293
|
-
reason: require_schemas.literal("failed"),
|
|
294
|
-
error: require_schemas.object({
|
|
295
|
-
name: require_schemas.string(),
|
|
296
|
-
message: require_schemas.string()
|
|
297
|
-
})
|
|
298
|
-
})
|
|
299
|
-
]);
|
|
300
|
-
/** Import the config in this process — live objects and all. */
|
|
301
|
-
async function importConfig(configPath) {
|
|
302
|
-
try {
|
|
303
|
-
return (await import(configPath)).default;
|
|
304
|
-
} catch (error) {
|
|
305
|
-
throw new ConfigLoadFailed(configPath, error.message);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* The config, loaded in `sandbox` and handed back as JSON.
|
|
310
|
-
*
|
|
311
|
-
* A config holding live objects cannot come back that way. An isolating
|
|
312
|
-
* sandbox refuses it with {@link ConfigObjectNotSerializable}; any other
|
|
313
|
-
* imports it here as well, as before, since the host already runs this
|
|
314
|
-
* project's code as its own.
|
|
315
|
-
*/
|
|
316
|
-
async function loadConfigInSandbox(sandbox, configPath, workspaceRoot, timeoutMs = CONFIG_LOAD_TIMEOUT_MS) {
|
|
317
|
-
const { value } = await require_discover.runWorker(sandbox, "config load", {
|
|
318
|
-
name: "config-worker",
|
|
319
|
-
args: [configPath],
|
|
320
|
-
cwd: workspaceRoot,
|
|
321
|
-
timeoutMs,
|
|
322
|
-
schema: ConfigAnswer
|
|
323
|
-
});
|
|
324
|
-
switch (value.reason) {
|
|
325
|
-
case "loaded": return value.config;
|
|
326
|
-
case "failed": throw new ConfigLoadFailed(configPath, value.error.message);
|
|
327
|
-
case "live":
|
|
328
|
-
if (sandbox.isolating) throw new ConfigObjectNotSerializable(configPath, value.paths);
|
|
329
|
-
return importConfig(configPath);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Load raw configuration from file.
|
|
334
|
-
*/
|
|
335
|
-
async function loadRawConfig(cwd, options = {}) {
|
|
336
|
-
const { configPath, workspaceRoot } = findConfigPath(cwd);
|
|
337
|
-
const sandbox = options.sandbox ?? require_discover.activeSandbox();
|
|
338
|
-
return {
|
|
339
|
-
config: sandbox ? await loadConfigInSandbox(sandbox, configPath, workspaceRoot, options.timeoutMs) : await importConfig(configPath),
|
|
340
|
-
workspaceRoot
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Load configuration file (single-app format).
|
|
345
|
-
* For backwards compatibility with existing code.
|
|
346
|
-
*
|
|
347
|
-
* @deprecated Use loadWorkspaceConfig for new code
|
|
348
|
-
*/
|
|
349
|
-
async function loadConfig(cwd = process.cwd()) {
|
|
350
|
-
const { config } = await loadRawConfig(cwd);
|
|
351
|
-
if (require_workspace.isWorkspaceConfig(config)) throw new Error("Workspace configuration detected. Use loadWorkspaceConfig() instead.");
|
|
352
|
-
return config;
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* Load configuration file and process it as a workspace.
|
|
356
|
-
* Works with both single-app and workspace configurations.
|
|
357
|
-
*
|
|
358
|
-
* Single-app configs are automatically wrapped as a workspace with one app.
|
|
359
|
-
*
|
|
360
|
-
* @example
|
|
361
|
-
* ```ts
|
|
362
|
-
* const { type, workspace } = await loadWorkspaceConfig();
|
|
363
|
-
*
|
|
364
|
-
* if (type === 'workspace') {
|
|
365
|
-
* console.log('Multi-app workspace:', workspace.apps);
|
|
366
|
-
* } else {
|
|
367
|
-
* console.log('Single app wrapped as workspace');
|
|
368
|
-
* }
|
|
369
|
-
* ```
|
|
370
|
-
*/
|
|
371
|
-
/**
|
|
372
|
-
* The workspace a directory belongs to, as its config states it — without
|
|
373
|
-
* discovering its constructs.
|
|
374
|
-
*
|
|
375
|
-
* For callers that need a fact the config holds (where a stage's secrets are
|
|
376
|
-
* stored) and nothing the graph adds. `loadWorkspaceConfig` imports every
|
|
377
|
-
* construct module to derive the apps, which is a cost a secrets read should
|
|
378
|
-
* not pay.
|
|
379
|
-
*/
|
|
380
|
-
async function loadWorkspaceSettings(cwd = process.cwd(), options = {}) {
|
|
381
|
-
const { config, workspaceRoot } = await loadRawConfig(cwd, options);
|
|
382
|
-
return require_workspace.processConfig(config, workspaceRoot).workspace;
|
|
383
|
-
}
|
|
384
|
-
async function loadWorkspaceConfig(cwd = process.cwd(), options = {}) {
|
|
385
|
-
const { config, workspaceRoot } = await loadRawConfig(cwd, options);
|
|
386
|
-
return withDerivedApps(require_workspace.processConfig(config, workspaceRoot), options.sandbox);
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* The loaded config, with its apps read off the graph.
|
|
390
|
-
*
|
|
391
|
-
* Here rather than at each call site because every command needs the same
|
|
392
|
-
* answer, and the ones that forgot to ask were exactly the bugs: a site that
|
|
393
|
-
* never deployed, a surface that could not be its own process. `gkm dev`,
|
|
394
|
-
* `gkm build`, `gkm docker` and `gkm deploy` now all see the same apps without
|
|
395
|
-
* any of them knowing a derivation happened.
|
|
396
|
-
*
|
|
397
|
-
* Discovery imports the construct modules — declarations only, not endpoints —
|
|
398
|
-
* which is the same import the reconciler and the build already do. A workspace
|
|
399
|
-
* with no `constructs` glob discovers nothing and keeps whatever its config
|
|
400
|
-
* said, so nothing that worked before changes.
|
|
401
|
-
*
|
|
402
|
-
* A construct file that throws is reported and skipped rather than taking the
|
|
403
|
-
* command down: `gkm dev` failing to start because a half-written declaration
|
|
404
|
-
* cannot be imported is a worse failure than starting with the app it does not
|
|
405
|
-
* describe yet.
|
|
406
|
-
*/
|
|
407
|
-
async function withDerivedApps(loaded, sandbox) {
|
|
408
|
-
const globs = require_workspace.allConstructGlobs(loaded.workspace);
|
|
409
|
-
if (globs.length === 0) throw new WorkspaceDeclaresNoConstructs(loaded.workspace.root);
|
|
410
|
-
try {
|
|
411
|
-
const manifest = await require_discover.discover({
|
|
412
|
-
patterns: globs,
|
|
413
|
-
cwd: loaded.workspace.root,
|
|
414
|
-
...sandbox ? { sandbox } : {}
|
|
415
|
-
});
|
|
416
|
-
return {
|
|
417
|
-
...loaded,
|
|
418
|
-
manifest,
|
|
419
|
-
workspace: {
|
|
420
|
-
...loaded.workspace,
|
|
421
|
-
apps: derivedApps(manifest, loaded.workspace)
|
|
422
|
-
}
|
|
423
|
-
};
|
|
424
|
-
} catch (error) {
|
|
425
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
426
|
-
require_discover.output.warn(`⚠️ Could not read constructs, so apps come from config alone: ${message}`);
|
|
427
|
-
return loaded;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* A workspace with no `constructs` glob.
|
|
432
|
-
*
|
|
433
|
-
* In v10 every address, container and app comes from what the workspace
|
|
434
|
-
* declares — there is no second path that reads a hand-written compose file or
|
|
435
|
-
* an `apps` block's ports. A config that declares nothing has nothing to run.
|
|
436
|
-
*/
|
|
437
|
-
var WorkspaceDeclaresNoConstructs = class extends Error {
|
|
438
|
-
root;
|
|
439
|
-
constructor(root) {
|
|
440
|
-
super(`The workspace at ${root} declares no constructs. Every workspace names where its constructs live — \`constructs: ['./constructs/**/*.ts', './apps/*/endpoints/**/*.ts']\` in gkm.config.ts — and its apps, containers and URLs are derived from them.`);
|
|
441
|
-
this.root = root;
|
|
442
|
-
this.name = "WorkspaceDeclaresNoConstructs";
|
|
443
|
-
}
|
|
444
|
-
};
|
|
445
|
-
/**
|
|
446
|
-
* The app a directory is part of: the one whose `path` contains it.
|
|
447
|
-
*
|
|
448
|
-
* An app's path is the one its construct declares — `new RestApi('Api',
|
|
449
|
-
* { path: 'apps/api' })` — read off the workspace the constructs were derived
|
|
450
|
-
* into, never off the filesystem's package names. The deepest match wins, so
|
|
451
|
-
* an app inside another app's folder is its own; the workspace root belongs to
|
|
452
|
-
* no app unless one lives there.
|
|
453
|
-
*/
|
|
454
|
-
function resolveWorkspaceApp(loadedConfig, cwd) {
|
|
455
|
-
const here = real(cwd);
|
|
456
|
-
let found;
|
|
457
|
-
for (const [key, app] of Object.entries(loadedConfig.workspace.apps)) {
|
|
458
|
-
const dir = real((0, node_path.join)(loadedConfig.workspace.root, app.path));
|
|
459
|
-
if ((here === dir || here.startsWith(`${dir}${node_path.sep}`)) && (!found || dir.length > found.dir.length)) found = {
|
|
460
|
-
key,
|
|
461
|
-
app,
|
|
462
|
-
dir
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
return found && {
|
|
466
|
-
key: found.key,
|
|
467
|
-
app: found.app
|
|
468
|
-
};
|
|
469
|
-
}
|
|
470
|
-
/** A path with its symlinks resolved, where it exists — `/tmp` is `/private/tmp`. */
|
|
471
|
-
function real(path) {
|
|
472
|
-
const absolute = (0, node_path.resolve)(path);
|
|
473
|
-
return (0, node_fs.existsSync)(absolute) ? (0, node_fs.realpathSync)(absolute) : absolute;
|
|
474
|
-
}
|
|
475
|
-
/** A directory that no app in the workspace lives in. */
|
|
476
|
-
var NotInAnApp = class extends Error {
|
|
477
|
-
cwd;
|
|
478
|
-
apps;
|
|
479
|
-
constructor(cwd, apps) {
|
|
480
|
-
super(`${cwd} is not inside any app's path. Apps: ` + Object.entries(apps).map(([key, path]) => `${key} (${path})`).join(", ") + ".");
|
|
481
|
-
this.cwd = cwd;
|
|
482
|
-
this.apps = apps;
|
|
483
|
-
this.name = "NotInAnApp";
|
|
484
|
-
}
|
|
485
|
-
};
|
|
486
|
-
/** Every app's path, by key — what `NotInAnApp` lists. */
|
|
487
|
-
function appPaths(loadedConfig) {
|
|
488
|
-
return Object.fromEntries(Object.entries(loadedConfig.workspace.apps).map(([key, app]) => [key, app.path]));
|
|
489
|
-
}
|
|
490
|
-
/**
|
|
491
|
-
* The backend app a directory is part of, with its gkm config — found by the
|
|
492
|
-
* `path` its construct declares.
|
|
493
|
-
*
|
|
494
|
-
* @example
|
|
495
|
-
* ```ts
|
|
496
|
-
* // From apps/api, where a construct declares `path: 'apps/api'`
|
|
497
|
-
* const { app, workspace, workspaceRoot } = await loadAppConfig();
|
|
498
|
-
* ```
|
|
499
|
-
*
|
|
500
|
-
* @throws {NotInAnApp} when no app's path contains the directory.
|
|
501
|
-
* @throws {NotABackendApp} when the app it is in has no gkm config to run.
|
|
502
|
-
*/
|
|
503
|
-
async function loadAppConfig(cwd = process.cwd()) {
|
|
504
|
-
const { appName, app, workspace, workspaceRoot } = await loadWorkspaceAppInfo(cwd);
|
|
505
|
-
const gkmConfig = require_workspace.getAppGkmConfig(workspace, appName);
|
|
506
|
-
if (!gkmConfig) throw new NotABackendApp(appName);
|
|
507
|
-
return {
|
|
508
|
-
appName,
|
|
509
|
-
app,
|
|
510
|
-
gkmConfig,
|
|
511
|
-
workspace,
|
|
512
|
-
workspaceRoot,
|
|
513
|
-
appRoot: (0, node_path.join)(workspaceRoot, app.path)
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
/** The app a directory is in has no gkm config — a site, or an entry app. */
|
|
517
|
-
var NotABackendApp = class extends Error {
|
|
518
|
-
appName;
|
|
519
|
-
constructor(appName) {
|
|
520
|
-
super(`App "${appName}" is not a backend app and cannot be run with gkm dev.`);
|
|
521
|
-
this.appName = appName;
|
|
522
|
-
this.name = "NotABackendApp";
|
|
523
|
-
}
|
|
524
|
-
};
|
|
525
|
-
/**
|
|
526
|
-
* The app a directory is part of, frontend or backend — found by the `path`
|
|
527
|
-
* its construct declares. Unlike `loadAppConfig`, the app need not have a
|
|
528
|
-
* gkm config, which is what `gkm exec` and `gkm test` from a site need.
|
|
529
|
-
*
|
|
530
|
-
* @throws {NotInAnApp} when no app's path contains the directory.
|
|
531
|
-
*/
|
|
532
|
-
async function loadWorkspaceAppInfo(cwd = process.cwd()) {
|
|
533
|
-
const { config, workspaceRoot } = await loadRawConfig(cwd);
|
|
534
|
-
const loadedConfig = await withDerivedApps(require_workspace.processConfig(config, workspaceRoot));
|
|
535
|
-
const resolved = resolveWorkspaceApp(loadedConfig, cwd);
|
|
536
|
-
if (!resolved) throw new NotInAnApp(cwd, appPaths(loadedConfig));
|
|
537
|
-
return {
|
|
538
|
-
appName: resolved.key,
|
|
539
|
-
app: resolved.app,
|
|
540
|
-
workspace: loadedConfig.workspace,
|
|
541
|
-
workspaceRoot
|
|
542
|
-
};
|
|
543
|
-
}
|
|
544
|
-
//#endregion
|
|
545
|
-
Object.defineProperty(exports, "CONFIG_LOAD_TIMEOUT_MS", {
|
|
546
|
-
enumerable: true,
|
|
547
|
-
get: function() {
|
|
548
|
-
return CONFIG_LOAD_TIMEOUT_MS;
|
|
549
|
-
}
|
|
550
|
-
});
|
|
551
|
-
Object.defineProperty(exports, "ConfigLoadFailed", {
|
|
552
|
-
enumerable: true,
|
|
553
|
-
get: function() {
|
|
554
|
-
return ConfigLoadFailed;
|
|
555
|
-
}
|
|
556
|
-
});
|
|
557
|
-
Object.defineProperty(exports, "ConfigNotFound", {
|
|
558
|
-
enumerable: true,
|
|
559
|
-
get: function() {
|
|
560
|
-
return ConfigNotFound;
|
|
561
|
-
}
|
|
562
|
-
});
|
|
563
|
-
Object.defineProperty(exports, "ConfigObjectNotSerializable", {
|
|
564
|
-
enumerable: true,
|
|
565
|
-
get: function() {
|
|
566
|
-
return ConfigObjectNotSerializable;
|
|
567
|
-
}
|
|
568
|
-
});
|
|
569
|
-
Object.defineProperty(exports, "NotABackendApp", {
|
|
570
|
-
enumerable: true,
|
|
571
|
-
get: function() {
|
|
572
|
-
return NotABackendApp;
|
|
573
|
-
}
|
|
574
|
-
});
|
|
575
|
-
Object.defineProperty(exports, "NotInAnApp", {
|
|
576
|
-
enumerable: true,
|
|
577
|
-
get: function() {
|
|
578
|
-
return NotInAnApp;
|
|
579
|
-
}
|
|
580
|
-
});
|
|
581
|
-
Object.defineProperty(exports, "WorkspaceDeclaresNoConstructs", {
|
|
582
|
-
enumerable: true,
|
|
583
|
-
get: function() {
|
|
584
|
-
return WorkspaceDeclaresNoConstructs;
|
|
585
|
-
}
|
|
586
|
-
});
|
|
587
|
-
Object.defineProperty(exports, "appKey", {
|
|
588
|
-
enumerable: true,
|
|
589
|
-
get: function() {
|
|
590
|
-
return appKey;
|
|
591
|
-
}
|
|
592
|
-
});
|
|
593
|
-
Object.defineProperty(exports, "defineConfig", {
|
|
594
|
-
enumerable: true,
|
|
595
|
-
get: function() {
|
|
596
|
-
return defineConfig;
|
|
597
|
-
}
|
|
598
|
-
});
|
|
599
|
-
Object.defineProperty(exports, "derivedApps", {
|
|
600
|
-
enumerable: true,
|
|
601
|
-
get: function() {
|
|
602
|
-
return derivedApps;
|
|
603
|
-
}
|
|
604
|
-
});
|
|
605
|
-
Object.defineProperty(exports, "findWorkspaceRoot", {
|
|
606
|
-
enumerable: true,
|
|
607
|
-
get: function() {
|
|
608
|
-
return findWorkspaceRoot;
|
|
609
|
-
}
|
|
610
|
-
});
|
|
611
|
-
Object.defineProperty(exports, "loadAppConfig", {
|
|
612
|
-
enumerable: true,
|
|
613
|
-
get: function() {
|
|
614
|
-
return loadAppConfig;
|
|
615
|
-
}
|
|
616
|
-
});
|
|
617
|
-
Object.defineProperty(exports, "loadConfig", {
|
|
618
|
-
enumerable: true,
|
|
619
|
-
get: function() {
|
|
620
|
-
return loadConfig;
|
|
621
|
-
}
|
|
622
|
-
});
|
|
623
|
-
Object.defineProperty(exports, "loadWorkspaceAppInfo", {
|
|
624
|
-
enumerable: true,
|
|
625
|
-
get: function() {
|
|
626
|
-
return loadWorkspaceAppInfo;
|
|
627
|
-
}
|
|
628
|
-
});
|
|
629
|
-
Object.defineProperty(exports, "loadWorkspaceConfig", {
|
|
630
|
-
enumerable: true,
|
|
631
|
-
get: function() {
|
|
632
|
-
return loadWorkspaceConfig;
|
|
633
|
-
}
|
|
634
|
-
});
|
|
635
|
-
Object.defineProperty(exports, "loadWorkspaceSettings", {
|
|
636
|
-
enumerable: true,
|
|
637
|
-
get: function() {
|
|
638
|
-
return loadWorkspaceSettings;
|
|
639
|
-
}
|
|
640
|
-
});
|
|
641
|
-
Object.defineProperty(exports, "parseModuleConfig", {
|
|
642
|
-
enumerable: true,
|
|
643
|
-
get: function() {
|
|
644
|
-
return parseModuleConfig;
|
|
645
|
-
}
|
|
646
|
-
});
|
|
647
|
-
|
|
648
|
-
//# sourceMappingURL=config-BEJYKd4s.cjs.map
|