@geekmidas/cli 10.0.0-alpha.130 → 10.0.0-alpha.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{EndpointGenerator-B99OGzbO.mjs → EndpointGenerator-Bm6xwLIF.mjs} +5 -3
- package/dist/EndpointGenerator-Bm6xwLIF.mjs.map +1 -0
- package/dist/{EndpointGenerator-De0lknKD.cjs → EndpointGenerator-D3p5WQOv.cjs} +5 -3
- package/dist/EndpointGenerator-D3p5WQOv.cjs.map +1 -0
- package/dist/{GoDaddyProvider-D10Le3VX.mjs → GoDaddyProvider-CLrIIpCr.mjs} +2 -2
- package/dist/{GoDaddyProvider-D10Le3VX.mjs.map → GoDaddyProvider-CLrIIpCr.mjs.map} +1 -1
- package/dist/{GoDaddyProvider-DTfa47i3.cjs → GoDaddyProvider-CtnM5qxL.cjs} +2 -2
- package/dist/{GoDaddyProvider-DTfa47i3.cjs.map → GoDaddyProvider-CtnM5qxL.cjs.map} +1 -1
- package/dist/{LegacyStateStore-C5c_zS4h.mjs → LegacyStateStore-C0LmkRnT.mjs} +3 -3
- package/dist/{LegacyStateStore-C5c_zS4h.mjs.map → LegacyStateStore-C0LmkRnT.mjs.map} +1 -1
- package/dist/{LegacyStateStore-CZSBR6ar.cjs → LegacyStateStore-C4rb-2W_.cjs} +3 -3
- package/dist/{LegacyStateStore-CZSBR6ar.cjs.map → LegacyStateStore-C4rb-2W_.cjs.map} +1 -1
- package/dist/{LocalStateStore-CgQtQix2.cjs → LocalStateStore-DL15tGfM.cjs} +2 -2
- package/dist/{LocalStateStore-CgQtQix2.cjs.map → LocalStateStore-DL15tGfM.cjs.map} +1 -1
- package/dist/{LocalStateStore-Ba0Y6q5C.mjs → LocalStateStore-vHx3OPmE.mjs} +2 -2
- package/dist/{LocalStateStore-Ba0Y6q5C.mjs.map → LocalStateStore-vHx3OPmE.mjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-DNUCgkkx.mjs → OpenApiTsGenerator-BB6dGP8i.mjs} +2 -2
- package/dist/{OpenApiTsGenerator-DNUCgkkx.mjs.map → OpenApiTsGenerator-BB6dGP8i.mjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-DMLzN-LU.cjs → OpenApiTsGenerator-HkNH_xw-.cjs} +2 -2
- package/dist/{OpenApiTsGenerator-DMLzN-LU.cjs.map → OpenApiTsGenerator-HkNH_xw-.cjs.map} +1 -1
- package/dist/{S3StateStore-00mB2AG4.mjs → S3StateStore-CLJJ4G8F.mjs} +2 -2
- package/dist/{S3StateStore-00mB2AG4.mjs.map → S3StateStore-CLJJ4G8F.mjs.map} +1 -1
- package/dist/{S3StateStore-C6amZI39.cjs → S3StateStore-jJUI-UW7.cjs} +2 -2
- package/dist/{S3StateStore-C6amZI39.cjs.map → S3StateStore-jJUI-UW7.cjs.map} +1 -1
- package/dist/{SSMStateStore-Cnn5fHCg.cjs → SSMStateStore-B0Z9hEeo.cjs} +2 -2
- package/dist/{SSMStateStore-Cnn5fHCg.cjs.map → SSMStateStore-B0Z9hEeo.cjs.map} +1 -1
- package/dist/{SSMStateStore-CkYqOAzW.mjs → SSMStateStore-D1QPy_gq.mjs} +2 -2
- package/dist/{SSMStateStore-CkYqOAzW.mjs.map → SSMStateStore-D1QPy_gq.mjs.map} +1 -1
- package/dist/{SubscriberGenerator-0ruEmYXj.mjs → SubscriberGenerator-CI7roxx9.mjs} +2 -2
- package/dist/{SubscriberGenerator-0ruEmYXj.mjs.map → SubscriberGenerator-CI7roxx9.mjs.map} +1 -1
- package/dist/{SubscriberGenerator-CPjbWEOI.cjs → SubscriberGenerator-uDZW1ddC.cjs} +2 -2
- package/dist/{SubscriberGenerator-CPjbWEOI.cjs.map → SubscriberGenerator-uDZW1ddC.cjs.map} +1 -1
- package/dist/{add-CdMInvmN.cjs → add-BV5ZDKgx.cjs} +5 -5
- package/dist/{add-CdMInvmN.cjs.map → add-BV5ZDKgx.cjs.map} +1 -1
- package/dist/{add-DZSU5Tcc.mjs → add-xwmKaLFC.mjs} +5 -5
- package/dist/{add-DZSU5Tcc.mjs.map → add-xwmKaLFC.mjs.map} +1 -1
- package/dist/{bundler-GKF4xpYI.cjs → bundler-CHXBqzsc.cjs} +5 -5
- package/dist/{bundler-GKF4xpYI.cjs.map → bundler-CHXBqzsc.cjs.map} +1 -1
- package/dist/{bundler-BzDMJbx8.mjs → bundler-DrpnJNwr.mjs} +5 -5
- package/dist/{bundler-BzDMJbx8.mjs.map → bundler-DrpnJNwr.mjs.map} +1 -1
- package/dist/{cli-Ct6PQtc7.cjs → cli-CdwEMpeT.cjs} +2 -2
- package/dist/{cli-Ct6PQtc7.cjs.map → cli-CdwEMpeT.cjs.map} +1 -1
- package/dist/{cli-DXeLFtpA.mjs → cli-o3cXaGtO.mjs} +2 -2
- package/dist/{cli-DXeLFtpA.mjs.map → cli-o3cXaGtO.mjs.map} +1 -1
- package/dist/{compose-CnanpQBB.mjs → compose-D0SN1LaV.mjs} +23 -7
- package/dist/compose-D0SN1LaV.mjs.map +1 -0
- package/dist/{compose-BfLDidYU.cjs → compose-DNRPMVES.cjs} +22 -6
- package/dist/compose-DNRPMVES.cjs.map +1 -0
- package/dist/{config-azErNJSd.d.cts → config-CnrwEcSa.d.mts} +3 -3
- package/dist/{config-DPsCfNpR.d.mts.map → config-CnrwEcSa.d.mts.map} +1 -1
- package/dist/{config-DPsCfNpR.d.mts → config-DlKOvs3Y.d.cts} +3 -3
- package/dist/{config-azErNJSd.d.cts.map → config-DlKOvs3Y.d.cts.map} +1 -1
- package/dist/config.cjs +2 -2
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +2 -2
- package/dist/deploy/public.cjs +8 -8
- package/dist/deploy/public.d.cts +3 -3
- package/dist/deploy/public.d.mts +3 -3
- package/dist/deploy/public.mjs +8 -8
- package/dist/{deploy-B35L6CMr.mjs → deploy-B98pqds6.mjs} +8 -8
- package/dist/{deploy-B35L6CMr.mjs.map → deploy-B98pqds6.mjs.map} +1 -1
- package/dist/{deploy-zFe_W4WS.cjs → deploy-DC8YEQPF.cjs} +8 -8
- package/dist/{deploy-zFe_W4WS.cjs.map → deploy-DC8YEQPF.cjs.map} +1 -1
- package/dist/{derive-BtGidITm.cjs → derive-BkWnOSPH.cjs} +113 -2
- package/dist/derive-BkWnOSPH.cjs.map +1 -0
- package/dist/{derive-Dew0QoGe.mjs → derive-BpT9jpPo.mjs} +109 -4
- package/dist/derive-BpT9jpPo.mjs.map +1 -0
- package/dist/{dokploy-sDTohVj5.mjs → dokploy-BexEz2nW.mjs} +2 -2
- package/dist/{dokploy-sDTohVj5.mjs.map → dokploy-BexEz2nW.mjs.map} +1 -1
- package/dist/{dokploy-BGJxcEh0.cjs → dokploy-DGVo3gIu.cjs} +2 -2
- package/dist/{dokploy-BGJxcEh0.cjs.map → dokploy-DGVo3gIu.cjs.map} +1 -1
- package/dist/{eas-DogHTOxl.cjs → eas-DZ4DRSpN.cjs} +3 -3
- package/dist/{eas-DogHTOxl.cjs.map → eas-DZ4DRSpN.cjs.map} +1 -1
- package/dist/{eas-Bxb9pymo.mjs → eas-vfFOLF35.mjs} +3 -3
- package/dist/{eas-Bxb9pymo.mjs.map → eas-vfFOLF35.mjs.map} +1 -1
- package/dist/{encryption-BZk_sxC-.mjs → encryption-DcXhLeea.mjs} +3 -3
- package/dist/{encryption-BZk_sxC-.mjs.map → encryption-DcXhLeea.mjs.map} +1 -1
- package/dist/{encryption-DRXgL9Lh.cjs → encryption-qxFK97mG.cjs} +3 -3
- package/dist/{encryption-DRXgL9Lh.cjs.map → encryption-qxFK97mG.cjs.map} +1 -1
- package/dist/{engine-uQmNnvNQ.mjs → engine-BJ1JjsqP.mjs} +5 -5
- package/dist/{engine-uQmNnvNQ.mjs.map → engine-BJ1JjsqP.mjs.map} +1 -1
- package/dist/{engine-BuPhWFVm.cjs → engine-BsfN6Z2y.cjs} +5 -5
- package/dist/{engine-BuPhWFVm.cjs.map → engine-BsfN6Z2y.cjs.map} +1 -1
- package/dist/{github-BCRbDSQa.cjs → github-CHnzHGbI.cjs} +5 -5
- package/dist/{github-BCRbDSQa.cjs.map → github-CHnzHGbI.cjs.map} +1 -1
- package/dist/{github-YknZQnYF.mjs → github-DM8dcTS3.mjs} +5 -5
- package/dist/{github-YknZQnYF.mjs.map → github-DM8dcTS3.mjs.map} +1 -1
- package/dist/{googlePlay-Cm2uipeZ.cjs → googlePlay-D4CBqrrd.cjs} +3 -3
- package/dist/{googlePlay-Cm2uipeZ.cjs.map → googlePlay-D4CBqrrd.cjs.map} +1 -1
- package/dist/{googlePlay-B_2dIDSO.mjs → googlePlay-DDrnzQWm.mjs} +3 -3
- package/dist/{googlePlay-B_2dIDSO.mjs.map → googlePlay-DDrnzQWm.mjs.map} +1 -1
- package/dist/{index-D-gNc445.d.cts → index-BYJMHnMt.d.cts} +2 -2
- package/dist/{index-D-gNc445.d.cts.map → index-BYJMHnMt.d.cts.map} +1 -1
- package/dist/{index-Ur-ZIDYC.d.mts → index-CBCGDhD6.d.mts} +2 -2
- package/dist/{index-Ur-ZIDYC.d.mts.map → index-CBCGDhD6.d.mts.map} +1 -1
- package/dist/index.cjs +72 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +72 -75
- package/dist/index.mjs.map +1 -1
- package/dist/{migrate-Co3UnkrE.cjs → migrate-Bonkj7OS.cjs} +13 -14
- package/dist/migrate-Bonkj7OS.cjs.map +1 -0
- package/dist/{migrate-D71REG0N.mjs → migrate-CtXmf5sw.mjs} +13 -14
- package/dist/migrate-CtXmf5sw.mjs.map +1 -0
- package/dist/{migrate-zqsyod5I.mjs → migrate-DXj1Kc79.mjs} +3 -3
- package/dist/{migrate-zqsyod5I.mjs.map → migrate-DXj1Kc79.mjs.map} +1 -1
- package/dist/{migrate-BIl4kLb1.cjs → migrate-Dw94du_D.cjs} +3 -3
- package/dist/{migrate-BIl4kLb1.cjs.map → migrate-Dw94du_D.cjs.map} +1 -1
- package/dist/openapi.cjs +4 -4
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.mjs +4 -4
- package/dist/{publish-BtmLOhV9.mjs → publish-0CESXM6R.mjs} +2 -2
- package/dist/{publish-BtmLOhV9.mjs.map → publish-0CESXM6R.mjs.map} +1 -1
- package/dist/{publish-BUnnuLl_.cjs → publish-CLD1NjFa.cjs} +2 -2
- package/dist/{publish-BUnnuLl_.cjs.map → publish-CLD1NjFa.cjs.map} +1 -1
- package/dist/{ready-BwtLriAF.mjs → ready-AcAH2WL6.mjs} +4 -4
- package/dist/{ready-BwtLriAF.mjs.map → ready-AcAH2WL6.mjs.map} +1 -1
- package/dist/{ready-Cj4pI0dw.cjs → ready-DhkmqsOH.cjs} +4 -4
- package/dist/{ready-Cj4pI0dw.cjs.map → ready-DhkmqsOH.cjs.map} +1 -1
- package/dist/reconcile/public.d.cts +1 -1
- package/dist/reconcile/public.d.mts +1 -1
- package/dist/{resolve-BVVSf27Y.cjs → resolve-Af3UHIxS.cjs} +4 -4
- package/dist/{resolve-BVVSf27Y.cjs.map → resolve-Af3UHIxS.cjs.map} +1 -1
- package/dist/{resolve-B1zK9f8_.mjs → resolve-DuZ4RSeN.mjs} +4 -4
- package/dist/{resolve-B1zK9f8_.mjs.map → resolve-DuZ4RSeN.mjs.map} +1 -1
- package/dist/{rollback-hV8Kbbg_.cjs → rollback-CWcIVBLT.cjs} +5 -5
- package/dist/{rollback-hV8Kbbg_.cjs.map → rollback-CWcIVBLT.cjs.map} +1 -1
- package/dist/{rollback-CAPWtOm3.mjs → rollback-DCIeBIX3.mjs} +5 -5
- package/dist/{rollback-CAPWtOm3.mjs.map → rollback-DCIeBIX3.mjs.map} +1 -1
- package/dist/{runtime-DfwIeO8f.d.mts → runtime-CBro-1N4.d.cts} +2 -2
- package/dist/{runtime-C0okGPpK.d.cts.map → runtime-CBro-1N4.d.cts.map} +1 -1
- package/dist/{runtime-C0okGPpK.d.cts → runtime-f9aiOHxq.d.mts} +2 -2
- package/dist/{runtime-DfwIeO8f.d.mts.map → runtime-f9aiOHxq.d.mts.map} +1 -1
- package/dist/{s3-xJtWm6WN.cjs → s3-BUkV5_fV.cjs} +2 -2
- package/dist/{s3-xJtWm6WN.cjs.map → s3-BUkV5_fV.cjs.map} +1 -1
- package/dist/{s3-CkERdmxm.mjs → s3-VpdagzYE.mjs} +2 -2
- package/dist/{s3-CkERdmxm.mjs.map → s3-VpdagzYE.mjs.map} +1 -1
- package/dist/{seeds-MR13eS-F.cjs → seeds-BGhU_55R.cjs} +32 -13
- package/dist/seeds-BGhU_55R.cjs.map +1 -0
- package/dist/{seeds-CNPdk_2f.mjs → seeds-CVbX__84.mjs} +33 -14
- package/dist/seeds-CVbX__84.mjs.map +1 -0
- package/dist/{serverSetup-DgAERQ5s.mjs → serverSetup-Blb5uyq8.mjs} +6 -6
- package/dist/{serverSetup-DgAERQ5s.mjs.map → serverSetup-Blb5uyq8.mjs.map} +1 -1
- package/dist/{serverSetup-9kFFmA86.cjs → serverSetup-C8W-mpu2.cjs} +6 -6
- package/dist/{serverSetup-9kFFmA86.cjs.map → serverSetup-C8W-mpu2.cjs.map} +1 -1
- package/dist/{sniffer-Biw5SE1V.cjs → sniffer-C94960vd.cjs} +7 -7
- package/dist/{sniffer-Biw5SE1V.cjs.map → sniffer-C94960vd.cjs.map} +1 -1
- package/dist/{sniffer-KS_EcbAk.mjs → sniffer-xx8N8mpY.mjs} +7 -7
- package/dist/{sniffer-KS_EcbAk.mjs.map → sniffer-xx8N8mpY.mjs.map} +1 -1
- package/dist/{snsSubscriptions-Bl3CChIH.mjs → snsSubscriptions-CLkFDjZc.mjs} +4 -4
- package/dist/{snsSubscriptions-Bl3CChIH.mjs.map → snsSubscriptions-CLkFDjZc.mjs.map} +1 -1
- package/dist/{snsSubscriptions-CQFfrCJf.cjs → snsSubscriptions-DcmmVj2k.cjs} +4 -4
- package/dist/{snsSubscriptions-CQFfrCJf.cjs.map → snsSubscriptions-DcmmVj2k.cjs.map} +1 -1
- package/dist/{sst-DmVJRu5l.cjs → sst-C7mwg02Z.cjs} +2 -2
- package/dist/{sst-DmVJRu5l.cjs.map → sst-C7mwg02Z.cjs.map} +1 -1
- package/dist/{sst-fop6uZ25.mjs → sst-ChTeT2qY.mjs} +2 -2
- package/dist/{sst-fop6uZ25.mjs.map → sst-ChTeT2qY.mjs.map} +1 -1
- package/dist/{stage-BIKAMxNc.cjs → stage-BdJzkWOO.cjs} +5 -5
- package/dist/{stage-BIKAMxNc.cjs.map → stage-BdJzkWOO.cjs.map} +1 -1
- package/dist/{stage-tIMFTQtj.mjs → stage-COixgz4P.mjs} +5 -5
- package/dist/{stage-tIMFTQtj.mjs.map → stage-COixgz4P.mjs.map} +1 -1
- package/dist/{stages-DhmbURs_.mjs → stages-COSKjrfd.mjs} +2 -2
- package/dist/{stages-DhmbURs_.mjs.map → stages-COSKjrfd.mjs.map} +1 -1
- package/dist/{stages-C9uSkohw.cjs → stages-CuV3zh-h.cjs} +2 -2
- package/dist/{stages-C9uSkohw.cjs.map → stages-CuV3zh-h.cjs.map} +1 -1
- package/dist/target/public.cjs +1 -1
- package/dist/target/public.d.cts +2 -2
- package/dist/target/public.d.mts +2 -2
- package/dist/target/public.mjs +1 -1
- package/dist/{types-xBx-07__.d.mts → types-C5Zvkpc_.d.mts} +16 -1
- package/dist/{types-xBx-07__.d.mts.map → types-C5Zvkpc_.d.mts.map} +1 -1
- package/dist/{types-Cjnqw1ta.d.cts → types-CSOoemtk.d.cts} +16 -1
- package/dist/{types-Cjnqw1ta.d.cts.map → types-CSOoemtk.d.cts.map} +1 -1
- package/dist/vitest.cjs +1 -1
- package/dist/vitest.mjs +1 -1
- 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-CjSfjfMK.mjs → workspace-aiDQZMje.mjs} +8 -1
- package/dist/workspace-aiDQZMje.mjs.map +1 -0
- package/dist/{workspace-DImrdet4.cjs → workspace-secxwA6K.cjs} +8 -1
- package/dist/workspace-secxwA6K.cjs.map +1 -0
- package/package.json +15 -15
- package/dist/EndpointGenerator-B99OGzbO.mjs.map +0 -1
- package/dist/EndpointGenerator-De0lknKD.cjs.map +0 -1
- package/dist/compose-BfLDidYU.cjs.map +0 -1
- package/dist/compose-CnanpQBB.mjs.map +0 -1
- package/dist/derive-BtGidITm.cjs.map +0 -1
- package/dist/derive-Dew0QoGe.mjs.map +0 -1
- package/dist/migrate-Co3UnkrE.cjs.map +0 -1
- package/dist/migrate-D71REG0N.mjs.map +0 -1
- package/dist/seeds-CNPdk_2f.mjs.map +0 -1
- package/dist/seeds-MR13eS-F.cjs.map +0 -1
- package/dist/workspace-CjSfjfMK.mjs.map +0 -1
- package/dist/workspace-DImrdet4.cjs.map +0 -1
|
@@ -1,4 +1,108 @@
|
|
|
1
|
+
const require_errors = require("./errors-DMC4Umsb.cjs");
|
|
1
2
|
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
3
|
+
//#region src/workspace/subdomains.ts
|
|
4
|
+
/**
|
|
5
|
+
* The subdomains of a stage's domain, as a wildcard site sees them.
|
|
6
|
+
*
|
|
7
|
+
* A site declared `subdomain: '*'` answers on every label nothing else does,
|
|
8
|
+
* so the labels something else does answer on are the ones a tenant can never
|
|
9
|
+
* take. They come from two places and from nowhere else: every app's own
|
|
10
|
+
* label, read off the constructs and never listed by hand, and the names no
|
|
11
|
+
* construct declares (`www`, `mail`, `status`), listed once in the workspace
|
|
12
|
+
* config as `protectedSubdomains`.
|
|
13
|
+
*/
|
|
14
|
+
/** A `protectedSubdomains` entry an app already answers on. */
|
|
15
|
+
var ProtectedSubdomainIsAnApp = class extends require_errors.GkmError {
|
|
16
|
+
subdomain;
|
|
17
|
+
app;
|
|
18
|
+
constructor(subdomain, app) {
|
|
19
|
+
super(`protectedSubdomains lists '${subdomain}', which '${app}' already answers on — a construct's own subdomain is protected without being listed. Remove it from protectedSubdomains.`);
|
|
20
|
+
this.subdomain = subdomain;
|
|
21
|
+
this.app = app;
|
|
22
|
+
this.name = "ProtectedSubdomainIsAnApp";
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
/** Two sites that both answer on every subdomain. */
|
|
26
|
+
var SecondWildcardSite = class extends require_errors.GkmError {
|
|
27
|
+
sites;
|
|
28
|
+
constructor(sites) {
|
|
29
|
+
super(`${sites.join(" and ")} both declare subdomain: '*', and two sites cannot share the same hosts. Keep one wildcard site per project; give the other a subdomain of its own.`);
|
|
30
|
+
this.sites = sites;
|
|
31
|
+
this.name = "SecondWildcardSite";
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
/** A wildcard site whose `hosts` route is on no surface the project declares. */
|
|
35
|
+
var SiteHostsEndpointMissing = class extends require_errors.GkmError {
|
|
36
|
+
site;
|
|
37
|
+
surface;
|
|
38
|
+
path;
|
|
39
|
+
constructor(site, surface, path) {
|
|
40
|
+
super(`'${site}' checks its hosts with GET ${path} on '${surface}', but '${surface}' serves no such route. Export the endpoint from the surface's endpoints, or point \`hosts\` at one it serves.`);
|
|
41
|
+
this.site = site;
|
|
42
|
+
this.surface = surface;
|
|
43
|
+
this.path = path;
|
|
44
|
+
this.name = "SiteHostsEndpointMissing";
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Every label an app answers on, by the app it belongs to — what a deploy
|
|
49
|
+
* puts under the stage's domain: a surface's or site's `subdomain` (or its id
|
|
50
|
+
* kebab-cased), each file server and its processors' origin, and each worker,
|
|
51
|
+
* which SNS may push to on a host of its own.
|
|
52
|
+
*
|
|
53
|
+
* The root site's is kept although it answers on the domain itself: which
|
|
54
|
+
* site is the root can change without a tenant's slug changing meaning. The
|
|
55
|
+
* wildcard site has none — its labels are whatever is left.
|
|
56
|
+
*/
|
|
57
|
+
function appSubdomains(manifest) {
|
|
58
|
+
const labels = /* @__PURE__ */ new Map();
|
|
59
|
+
for (const [id, declaration] of Object.entries(manifest)) switch (declaration.kind) {
|
|
60
|
+
case "rest-api":
|
|
61
|
+
case "websocket-api":
|
|
62
|
+
labels.set(declaration.subdomain ?? (0, _geekmidas_manifest.kebabCase)(id), id);
|
|
63
|
+
break;
|
|
64
|
+
case "site":
|
|
65
|
+
if (declaration.subdomain === _geekmidas_manifest.WILDCARD_SUBDOMAIN) break;
|
|
66
|
+
labels.set(declaration.subdomain ?? (0, _geekmidas_manifest.kebabCase)(id), id);
|
|
67
|
+
break;
|
|
68
|
+
case "file-server":
|
|
69
|
+
labels.set((0, _geekmidas_manifest.kebabCase)(id), id);
|
|
70
|
+
if (declaration.processors?.length) labels.set(`${(0, _geekmidas_manifest.kebabCase)(id)}-processors`, id);
|
|
71
|
+
break;
|
|
72
|
+
case "worker": labels.set((0, _geekmidas_manifest.kebabCase)(id), id);
|
|
73
|
+
}
|
|
74
|
+
return labels;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The labels no tenant may take: every app's own and the workspace's
|
|
78
|
+
* `protectedSubdomains`, sorted.
|
|
79
|
+
*/
|
|
80
|
+
function protectedSubdomains(manifest, configured = []) {
|
|
81
|
+
return [.../* @__PURE__ */ new Set([...appSubdomains(manifest).keys(), ...configured])].sort();
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* What a project's subdomains have to satisfy before anything is derived
|
|
85
|
+
* from them.
|
|
86
|
+
*
|
|
87
|
+
* @throws {SecondWildcardSite} when two sites declare `subdomain: '*'`
|
|
88
|
+
* @throws {SiteHostsEndpointMissing} when the wildcard site's `hosts` route is not served
|
|
89
|
+
* @throws {ProtectedSubdomainIsAnApp} when `protectedSubdomains` repeats an app's own
|
|
90
|
+
*/
|
|
91
|
+
function assertSubdomains(manifest, configured = []) {
|
|
92
|
+
const wildcards = Object.values(manifest).filter(_geekmidas_manifest.isWildcardSite);
|
|
93
|
+
if (wildcards.length > 1) throw new SecondWildcardSite(wildcards.map((site) => site.id).sort());
|
|
94
|
+
const site = wildcards[0];
|
|
95
|
+
if (site?.hosts) {
|
|
96
|
+
const surface = manifest[site.hosts.surface];
|
|
97
|
+
if (!(surface?.kind === "rest-api" && (surface.endpoints.length === 0 || surface.endpoints.some((endpoint) => endpoint.method.toUpperCase() === "GET" && endpoint.path === site.hosts?.path)))) throw new SiteHostsEndpointMissing(site.id, site.hosts.surface, site.hosts.path);
|
|
98
|
+
}
|
|
99
|
+
const labels = appSubdomains(manifest);
|
|
100
|
+
for (const subdomain of configured) {
|
|
101
|
+
const app = labels.get(subdomain);
|
|
102
|
+
if (app) throw new ProtectedSubdomainIsAnApp(subdomain, app);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
2
106
|
//#region src/workspace/derive.ts
|
|
3
107
|
/**
|
|
4
108
|
* The apps a manifest implies.
|
|
@@ -82,13 +186,14 @@ function assignPorts(apps) {
|
|
|
82
186
|
* rely on. Then an explicit `root: true`. A project with one site needs neither.
|
|
83
187
|
*/
|
|
84
188
|
function markRoot(apps) {
|
|
85
|
-
const sites = Object.entries(apps).filter(([, a]) => a.type === "web");
|
|
189
|
+
const sites = Object.entries(apps).filter(([, a]) => a.type === "web" && a.subdomain !== _geekmidas_manifest.WILDCARD_SUBDOMAIN);
|
|
86
190
|
if (sites.length === 0) return;
|
|
87
191
|
if (sites.some(([, a]) => a.root)) return;
|
|
88
192
|
const chosen = sites.find(([name]) => name === "web") ?? (sites.length === 1 ? sites[0] : void 0);
|
|
89
193
|
if (chosen) chosen[1].root = true;
|
|
90
194
|
}
|
|
91
195
|
function derivedApps(manifest, workspace) {
|
|
196
|
+
assertSubdomains(manifest, workspace.protectedSubdomains);
|
|
92
197
|
const apps = {};
|
|
93
198
|
const defaultTarget = workspace.deploy?.default ?? "dokploy";
|
|
94
199
|
for (const [id, declaration] of Object.entries(manifest)) {
|
|
@@ -157,5 +262,11 @@ Object.defineProperty(exports, "derivedApps", {
|
|
|
157
262
|
return derivedApps;
|
|
158
263
|
}
|
|
159
264
|
});
|
|
265
|
+
Object.defineProperty(exports, "protectedSubdomains", {
|
|
266
|
+
enumerable: true,
|
|
267
|
+
get: function() {
|
|
268
|
+
return protectedSubdomains;
|
|
269
|
+
}
|
|
270
|
+
});
|
|
160
271
|
|
|
161
|
-
//# sourceMappingURL=derive-
|
|
272
|
+
//# sourceMappingURL=derive-BkWnOSPH.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derive-BkWnOSPH.cjs","names":["GkmError","appKey","WILDCARD_SUBDOMAIN","isWildcardSite","kebabCase","WILDCARD_SUBDOMAIN"],"sources":["../src/workspace/subdomains.ts","../src/workspace/derive.ts"],"sourcesContent":["/**\n * The subdomains of a stage's domain, as a wildcard site sees them.\n *\n * A site declared `subdomain: '*'` answers on every label nothing else does,\n * so the labels something else does answer on are the ones a tenant can never\n * take. They come from two places and from nowhere else: every app's own\n * label, read off the constructs and never listed by hand, and the names no\n * construct declares (`www`, `mail`, `status`), listed once in the workspace\n * config as `protectedSubdomains`.\n */\n\nimport {\n\tkebabCase as appKey,\n\ttype ConstructManifest,\n\tisWildcardSite,\n\ttype SiteDeclaration,\n\tWILDCARD_SUBDOMAIN,\n} from '@geekmidas/manifest';\nimport { GkmError } from '../errors';\n\n/** A `protectedSubdomains` entry an app already answers on. */\nexport class ProtectedSubdomainIsAnApp extends GkmError {\n\tconstructor(\n\t\treadonly subdomain: string,\n\t\treadonly app: string,\n\t) {\n\t\tsuper(\n\t\t\t`protectedSubdomains lists '${subdomain}', which '${app}' already ` +\n\t\t\t\t`answers on — a construct's own subdomain is protected without ` +\n\t\t\t\t`being listed. Remove it from protectedSubdomains.`,\n\t\t);\n\t\tthis.name = 'ProtectedSubdomainIsAnApp';\n\t}\n}\n\n/** Two sites that both answer on every subdomain. */\nexport class SecondWildcardSite extends GkmError {\n\tconstructor(readonly sites: readonly string[]) {\n\t\tsuper(\n\t\t\t`${sites.join(' and ')} both declare subdomain: '*', and two sites ` +\n\t\t\t\t`cannot share the same hosts. Keep one wildcard site per project; ` +\n\t\t\t\t`give the other a subdomain of its own.`,\n\t\t);\n\t\tthis.name = 'SecondWildcardSite';\n\t}\n}\n\n/** A wildcard site whose `hosts` route is on no surface the project declares. */\nexport class SiteHostsEndpointMissing extends GkmError {\n\tconstructor(\n\t\treadonly site: string,\n\t\treadonly surface: string,\n\t\treadonly path: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${site}' checks its hosts with GET ${path} on '${surface}', but ` +\n\t\t\t\t`'${surface}' serves no such route. Export the endpoint from the ` +\n\t\t\t\t`surface's endpoints, or point \\`hosts\\` at one it serves.`,\n\t\t);\n\t\tthis.name = 'SiteHostsEndpointMissing';\n\t}\n}\n\n/** The project's one wildcard site, or `undefined` when it has none. */\nexport function wildcardSite(\n\tmanifest: ConstructManifest,\n): SiteDeclaration | undefined {\n\treturn Object.values(manifest).find(isWildcardSite);\n}\n\n/**\n * Every label an app answers on, by the app it belongs to — what a deploy\n * puts under the stage's domain: a surface's or site's `subdomain` (or its id\n * kebab-cased), each file server and its processors' origin, and each worker,\n * which SNS may push to on a host of its own.\n *\n * The root site's is kept although it answers on the domain itself: which\n * site is the root can change without a tenant's slug changing meaning. The\n * wildcard site has none — its labels are whatever is left.\n */\nexport function appSubdomains(\n\tmanifest: ConstructManifest,\n): Map<string, string> {\n\tconst labels = new Map<string, string>();\n\tfor (const [id, declaration] of Object.entries(manifest)) {\n\t\tswitch (declaration.kind) {\n\t\t\tcase 'rest-api':\n\t\t\tcase 'websocket-api':\n\t\t\t\tlabels.set(declaration.subdomain ?? appKey(id), id);\n\t\t\t\tbreak;\n\t\t\tcase 'site':\n\t\t\t\tif (declaration.subdomain === WILDCARD_SUBDOMAIN) break;\n\t\t\t\tlabels.set(declaration.subdomain ?? appKey(id), id);\n\t\t\t\tbreak;\n\t\t\tcase 'file-server':\n\t\t\t\tlabels.set(appKey(id), id);\n\t\t\t\tif (declaration.processors?.length) {\n\t\t\t\t\tlabels.set(`${appKey(id)}-processors`, id);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'worker':\n\t\t\t\tlabels.set(appKey(id), id);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn labels;\n}\n\n/**\n * The labels no tenant may take: every app's own and the workspace's\n * `protectedSubdomains`, sorted.\n */\nexport function protectedSubdomains(\n\tmanifest: ConstructManifest,\n\tconfigured: readonly string[] = [],\n): string[] {\n\treturn [\n\t\t...new Set([...appSubdomains(manifest).keys(), ...configured]),\n\t].sort();\n}\n\n/**\n * What a project's subdomains have to satisfy before anything is derived\n * from them.\n *\n * @throws {SecondWildcardSite} when two sites declare `subdomain: '*'`\n * @throws {SiteHostsEndpointMissing} when the wildcard site's `hosts` route is not served\n * @throws {ProtectedSubdomainIsAnApp} when `protectedSubdomains` repeats an app's own\n */\nexport function assertSubdomains(\n\tmanifest: ConstructManifest,\n\tconfigured: readonly string[] = [],\n): void {\n\tconst wildcards = Object.values(manifest).filter(isWildcardSite);\n\tif (wildcards.length > 1) {\n\t\tthrow new SecondWildcardSite(wildcards.map((site) => site.id).sort());\n\t}\n\n\tconst site = wildcards[0];\n\tif (site?.hosts) {\n\t\tconst surface = manifest[site.hosts.surface];\n\t\t// A surface's globbed endpoints are folded into its node by a build,\n\t\t// not by discovery, so an empty list says nothing: the site was handed\n\t\t// the endpoint itself, and its construct checked it is a GET on that\n\t\t// surface. Only routes the node does list can show it missing.\n\t\tconst served =\n\t\t\tsurface?.kind === 'rest-api' &&\n\t\t\t(surface.endpoints.length === 0 ||\n\t\t\t\tsurface.endpoints.some(\n\t\t\t\t\t(endpoint) =>\n\t\t\t\t\t\tendpoint.method.toUpperCase() === 'GET' &&\n\t\t\t\t\t\tendpoint.path === site.hosts?.path,\n\t\t\t\t));\n\t\tif (!served) {\n\t\t\tthrow new SiteHostsEndpointMissing(\n\t\t\t\tsite.id,\n\t\t\t\tsite.hosts.surface,\n\t\t\t\tsite.hosts.path,\n\t\t\t);\n\t\t}\n\t}\n\n\tconst labels = appSubdomains(manifest);\n\tfor (const subdomain of configured) {\n\t\tconst app = labels.get(subdomain);\n\t\tif (app) throw new ProtectedSubdomainIsAnApp(subdomain, app);\n\t}\n}\n","/**\n * The apps a manifest implies.\n *\n * `gkm.config.ts` used to carry an `apps` block naming every app: its type, its\n * path, its port, its framework, which other apps it depended on. Every one of\n * those facts was already declared. A `StaticSite('Web', { path: 'apps/web' })`\n * and an `apps.web = { type: 'web', path: 'apps/web', framework: 'vite',\n * dependencies: ['api'] }` are the same statement written twice, and only one of\n * them was checked against anything — so the copy in config was free to drift,\n * and a surface config had no entry for simply never deployed.\n *\n * So the list comes from the graph. A `site` is an app, and so is every\n * `rest-api` — one surface, one container, at the `path` it declared.\n *\n * What config still supplies is what no graph can answer: the backends a cache\n * and a mailer resolve to, the deploy endpoint, the stage's domain.\n */\n\nimport {\n\ttype AppSpec,\n\ttype ConstructManifest,\n\tkebabCase,\n\tWILDCARD_SUBDOMAIN,\n} from '@geekmidas/manifest';\nimport { assertSubdomains } from './subdomains.js';\nimport type {\n\tAppDomainConfig,\n\tDeployTargetName,\n\tFramework,\n\tNormalizedAppConfig,\n\tNormalizedWorkspace,\n} from './types.js';\n\n/** Which frontend framework builds each site variant. */\nconst FRAMEWORKS: Record<string, Framework> = {\n\tstatic: 'vite',\n\tnext: 'nextjs',\n\ttanstack: 'tanstack-start',\n};\n\n/**\n * The app key a construct id becomes.\n *\n * The same kebab form every physical name is built from, so `Api` is `api` in\n * the config, `production-kitchen-sink-api` on Dokploy, and `API_URL` in an\n * environment — one id, three renderings, no second list.\n */\nexport function appKey(id: string): string {\n\treturn kebabCase(id);\n}\n\n/**\n * The app serving a surface: its own, always.\n *\n * Every surface gets a container. There is no arrangement in which one runs\n * inside another — two surfaces in a process share a filesystem, an\n * environment, and every credential either was granted, so an auth server\n * beside an API is one bug in the API away from being read by it.\n */\nexport function hostOf(\n\tmanifest: ConstructManifest,\n\tid: string,\n): string | undefined {\n\tconst declaration = manifest[id];\n\tif (\n\t\t!declaration ||\n\t\t(declaration.kind !== 'rest-api' && declaration.kind !== 'websocket-api')\n\t)\n\t\treturn undefined;\n\n\treturn id;\n}\n\n/**\n * Local ports, assigned so that adding a site does not renumber the others.\n *\n * Backends first, then the site holding the base domain, then the rest\n * alphabetically. The ordering is arbitrary but it is *fixed*, which is the\n * property that matters: a port that moves when an unrelated app is added is a\n * port nobody can put in a bookmark. A construct that names its own port keeps\n * it, and is skipped here.\n */\nfunction assignPorts(apps: Record<string, NormalizedAppConfig>): void {\n\tconst rank = (\n\t\tname: string,\n\t\tapp: NormalizedAppConfig,\n\t): [number, number, string] => [\n\t\tapp.type === 'backend' ? 0 : app.type === 'web' ? 1 : 2,\n\t\tapp.root ? 0 : 1,\n\t\tname,\n\t];\n\n\tconst ordered = Object.entries(apps).sort(([aName, a], [bName, b]) => {\n\t\tconst [at, ar, an] = rank(aName, a);\n\t\tconst [bt, br, bn] = rank(bName, b);\n\t\treturn at - bt || ar - br || an.localeCompare(bn);\n\t});\n\n\tconst taken = new Set(\n\t\tordered.map(([, app]) => app.port).filter((p): p is number => !!p),\n\t);\n\n\tlet next = 3000;\n\tfor (const [, app] of ordered) {\n\t\tif (app.port) continue;\n\t\twhile (taken.has(next)) next += 1;\n\t\tapp.port = next;\n\t\ttaken.add(next);\n\t}\n}\n\n/**\n * Whichever site holds the base domain.\n *\n * The convention first — a site named `web` — because it is one people already\n * rely on. Then an explicit `root: true`. A project with one site needs neither.\n */\nfunction markRoot(apps: Record<string, NormalizedAppConfig>): void {\n\t// A wildcard site answers on every subdomain, never on the domain itself.\n\tconst sites = Object.entries(apps).filter(\n\t\t([, a]) => a.type === 'web' && a.subdomain !== WILDCARD_SUBDOMAIN,\n\t);\n\tif (sites.length === 0) return;\n\tif (sites.some(([, a]) => a.root)) return;\n\n\tconst chosen =\n\t\tsites.find(([name]) => name === 'web') ??\n\t\t(sites.length === 1 ? sites[0] : undefined);\n\tif (chosen) chosen[1].root = true;\n}\n\nexport function derivedApps(\n\tmanifest: ConstructManifest,\n\tworkspace: NormalizedWorkspace,\n): Record<string, NormalizedAppConfig> {\n\tassertSubdomains(manifest, workspace.protectedSubdomains);\n\n\tconst apps: Record<string, NormalizedAppConfig> = {};\n\tconst defaultTarget: DeployTargetName =\n\t\tworkspace.deploy?.default ?? 'dokploy';\n\n\tfor (const [id, declaration] of Object.entries(manifest)) {\n\t\t// Three kinds are apps: a site, a mobile app and an HTTP surface. A worker\n\t\t// is not one — it names the process that runs a cron or a subscriber, and\n\t\t// that process is the app's server, which already exists. Everything else\n\t\t// is a resource one of them uses.\n\t\tif (\n\t\t\tdeclaration.kind !== 'site' &&\n\t\t\tdeclaration.kind !== 'mobile-app' &&\n\t\t\tdeclaration.kind !== 'rest-api' &&\n\t\t\tdeclaration.kind !== 'websocket-api'\n\t\t)\n\t\t\tcontinue;\n\n\t\t// No opt-in to be had. Each says where it lives.\n\t\tconst spec: AppSpec =\n\t\t\tdeclaration.kind === 'site' || declaration.kind === 'mobile-app'\n\t\t\t\t? declaration.app\n\t\t\t\t: {\n\t\t\t\t\t\tpath: declaration.path,\n\t\t\t\t\t\t...(declaration.kind === 'rest-api' && declaration.telescope\n\t\t\t\t\t\t\t? { telescope: true }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t};\n\n\t\tconst name = appKey(id);\n\t\t// A config entry of the same name still wins, so a workspace can override\n\t\t// one field without restating the app. Nothing in this repo needs to.\n\t\tconst configured = workspace.apps[name];\n\n\t\tapps[name] = {\n\t\t\t...configured,\n\t\t\ttype:\n\t\t\t\tdeclaration.kind === 'site'\n\t\t\t\t\t? 'web'\n\t\t\t\t\t: declaration.kind === 'mobile-app'\n\t\t\t\t\t\t? 'mobile'\n\t\t\t\t\t\t: 'backend',\n\t\t\tpath: spec.path,\n\t\t\tport: spec.port ?? configured?.port ?? 0,\n\t\t\t// The label it answers on, under a stage's domain and locally alike.\n\t\t\t...((declaration.kind === 'rest-api' ||\n\t\t\t\tdeclaration.kind === 'websocket-api' ||\n\t\t\t\tdeclaration.kind === 'site') &&\n\t\t\tdeclaration.subdomain\n\t\t\t\t? { subdomain: declaration.subdomain }\n\t\t\t\t: {}),\n\t\t\tdependencies: [],\n\t\t\tresolvedDeployTarget: configured?.resolvedDeployTarget ?? defaultTarget,\n\t\t\t...(declaration.kind === 'site'\n\t\t\t\t? {\n\t\t\t\t\t\tframework: configured?.framework ?? FRAMEWORKS[declaration.variant],\n\t\t\t\t\t\t...(declaration.root ? { root: true } : {}),\n\t\t\t\t\t\t...(spec.config ? { config: spec.config } : {}),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\t...(declaration.kind === 'mobile-app'\n\t\t\t\t? {\n\t\t\t\t\t\tframework: configured?.framework ?? declaration.variant,\n\t\t\t\t\t\t...(spec.config ? { config: spec.config } : {}),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\t// One glob fans out to the six the build reads, because each generator\n\t\t\t// already inspects every export and keeps what it recognises. A\n\t\t\t// per-kind field still wins where one was given.\n\t\t\t...(spec.telescope !== undefined ? { telescope: spec.telescope } : {}),\n\t\t\t...(spec.openapi !== undefined ? { openapi: spec.openapi } : {}),\n\t\t\t...(spec.runtime !== undefined ? { runtime: spec.runtime } : {}),\n\t\t\t...(spec.env !== undefined ? { env: spec.env } : {}),\n\t\t\t...(spec.entry !== undefined ? { entry: spec.entry } : {}),\n\t\t\t...(configured?.domain\n\t\t\t\t? { domain: configured.domain as AppDomainConfig }\n\t\t\t\t: {}),\n\t\t} as NormalizedAppConfig;\n\t}\n\n\t// Build order, from the edges rather than from a hand-kept list. A site that\n\t// depends on a surface depends on the app that serves it — which for a\n\t// mounted auth server is its host, not a container that does not exist.\n\tfor (const [id, declaration] of Object.entries(manifest)) {\n\t\tif (\n\t\t\tdeclaration.kind !== 'site' &&\n\t\t\tdeclaration.kind !== 'mobile-app' &&\n\t\t\tdeclaration.kind !== 'rest-api' &&\n\t\t\tdeclaration.kind !== 'websocket-api'\n\t\t)\n\t\t\tcontinue;\n\n\t\tconst app = apps[appKey(id)];\n\t\tif (!app) continue;\n\n\t\t// A site names its edges `dependencies`; a surface names them `calls`.\n\t\tconst edges =\n\t\t\tdeclaration.kind === 'rest-api' || declaration.kind === 'websocket-api'\n\t\t\t\t? (declaration.calls ?? [])\n\t\t\t\t: (declaration.dependencies ?? []);\n\n\t\tconst names = new Set<string>();\n\t\tfor (const edge of edges) {\n\t\t\tif (edge.kind !== 'rest-api') continue;\n\t\t\tconst host = hostOf(manifest, edge.target);\n\t\t\tif (!host) continue;\n\t\t\tconst key = appKey(host);\n\t\t\tif (key !== appKey(id) && apps[key]) names.add(key);\n\t\t}\n\n\t\tapp.dependencies = [...names].sort();\n\t}\n\n\tmarkRoot(apps);\n\tassignPorts(apps);\n\n\t// Apps config declared that the graph knows nothing about — a `type: 'mobile'`\n\t// entry, or a hand-run process. Kept rather than dropped: config is still the\n\t// escape hatch for what nothing declares.\n\tfor (const [name, app] of Object.entries(workspace.apps)) {\n\t\tif (!apps[name]) apps[name] = app;\n\t}\n\n\treturn apps;\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBA,IAAa,4BAAb,cAA+CA,eAAAA,SAAS;CAE7C;CACA;CAFV,YACC,WACA,KACC;EACD,MACC,8BAA8B,UAAU,YAAY,IAAI,0HAGzD;EAPS,KAAA,YAAA;EACA,KAAA,MAAA;EAOT,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,qBAAb,cAAwCA,eAAAA,SAAS;CAC3B;CAArB,YAAY,OAAmC;EAC9C,MACC,GAAG,MAAM,KAAK,OAAO,EAAE,oJAGxB;EALoB,KAAA,QAAA;EAMpB,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,2BAAb,cAA8CA,eAAAA,SAAS;CAE5C;CACA;CACA;CAHV,YACC,MACA,SACA,MACC;EACD,MACC,IAAI,KAAK,8BAA8B,KAAK,OAAO,QAAQ,UACtD,QAAQ,+GAEd;EARS,KAAA,OAAA;EACA,KAAA,UAAA;EACA,KAAA,OAAA;EAOT,KAAK,OAAO;CACb;AACD;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B,IAAI,KAAK,SAAS,YAAY;GAC9B,MAAM,OAAO,OAAO,UAAU,KAAK,MAAM;GACzC,IAAI,CAAC,MAAM;GACX,MAAM,MAAM,OAAO,IAAI;GACvB,IAAI,QAAQ,OAAO,EAAE,KAAK,KAAK,MAAM,MAAM,IAAI,GAAG;EACnD;EAEA,IAAI,eAAe,CAAC,GAAG,KAAK,CAAC,CAAC,KAAK;CACpC;CAEA,SAAS,IAAI;CACb,YAAY,IAAI;CAKhB,KAAK,MAAM,CAAC,MAAM,QAAQ,OAAO,QAAQ,UAAU,IAAI,GACtD,IAAI,CAAC,KAAK,OAAO,KAAK,QAAQ;CAG/B,OAAO;AACR"}
|
|
@@ -1,4 +1,108 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
|
|
2
|
+
import { WILDCARD_SUBDOMAIN, isWildcardSite, kebabCase } from "@geekmidas/manifest";
|
|
3
|
+
//#region src/workspace/subdomains.ts
|
|
4
|
+
/**
|
|
5
|
+
* The subdomains of a stage's domain, as a wildcard site sees them.
|
|
6
|
+
*
|
|
7
|
+
* A site declared `subdomain: '*'` answers on every label nothing else does,
|
|
8
|
+
* so the labels something else does answer on are the ones a tenant can never
|
|
9
|
+
* take. They come from two places and from nowhere else: every app's own
|
|
10
|
+
* label, read off the constructs and never listed by hand, and the names no
|
|
11
|
+
* construct declares (`www`, `mail`, `status`), listed once in the workspace
|
|
12
|
+
* config as `protectedSubdomains`.
|
|
13
|
+
*/
|
|
14
|
+
/** A `protectedSubdomains` entry an app already answers on. */
|
|
15
|
+
var ProtectedSubdomainIsAnApp = class extends GkmError {
|
|
16
|
+
subdomain;
|
|
17
|
+
app;
|
|
18
|
+
constructor(subdomain, app) {
|
|
19
|
+
super(`protectedSubdomains lists '${subdomain}', which '${app}' already answers on — a construct's own subdomain is protected without being listed. Remove it from protectedSubdomains.`);
|
|
20
|
+
this.subdomain = subdomain;
|
|
21
|
+
this.app = app;
|
|
22
|
+
this.name = "ProtectedSubdomainIsAnApp";
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
/** Two sites that both answer on every subdomain. */
|
|
26
|
+
var SecondWildcardSite = class extends GkmError {
|
|
27
|
+
sites;
|
|
28
|
+
constructor(sites) {
|
|
29
|
+
super(`${sites.join(" and ")} both declare subdomain: '*', and two sites cannot share the same hosts. Keep one wildcard site per project; give the other a subdomain of its own.`);
|
|
30
|
+
this.sites = sites;
|
|
31
|
+
this.name = "SecondWildcardSite";
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
/** A wildcard site whose `hosts` route is on no surface the project declares. */
|
|
35
|
+
var SiteHostsEndpointMissing = class extends GkmError {
|
|
36
|
+
site;
|
|
37
|
+
surface;
|
|
38
|
+
path;
|
|
39
|
+
constructor(site, surface, path) {
|
|
40
|
+
super(`'${site}' checks its hosts with GET ${path} on '${surface}', but '${surface}' serves no such route. Export the endpoint from the surface's endpoints, or point \`hosts\` at one it serves.`);
|
|
41
|
+
this.site = site;
|
|
42
|
+
this.surface = surface;
|
|
43
|
+
this.path = path;
|
|
44
|
+
this.name = "SiteHostsEndpointMissing";
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Every label an app answers on, by the app it belongs to — what a deploy
|
|
49
|
+
* puts under the stage's domain: a surface's or site's `subdomain` (or its id
|
|
50
|
+
* kebab-cased), each file server and its processors' origin, and each worker,
|
|
51
|
+
* which SNS may push to on a host of its own.
|
|
52
|
+
*
|
|
53
|
+
* The root site's is kept although it answers on the domain itself: which
|
|
54
|
+
* site is the root can change without a tenant's slug changing meaning. The
|
|
55
|
+
* wildcard site has none — its labels are whatever is left.
|
|
56
|
+
*/
|
|
57
|
+
function appSubdomains(manifest) {
|
|
58
|
+
const labels = /* @__PURE__ */ new Map();
|
|
59
|
+
for (const [id, declaration] of Object.entries(manifest)) switch (declaration.kind) {
|
|
60
|
+
case "rest-api":
|
|
61
|
+
case "websocket-api":
|
|
62
|
+
labels.set(declaration.subdomain ?? kebabCase(id), id);
|
|
63
|
+
break;
|
|
64
|
+
case "site":
|
|
65
|
+
if (declaration.subdomain === WILDCARD_SUBDOMAIN) break;
|
|
66
|
+
labels.set(declaration.subdomain ?? kebabCase(id), id);
|
|
67
|
+
break;
|
|
68
|
+
case "file-server":
|
|
69
|
+
labels.set(kebabCase(id), id);
|
|
70
|
+
if (declaration.processors?.length) labels.set(`${kebabCase(id)}-processors`, id);
|
|
71
|
+
break;
|
|
72
|
+
case "worker": labels.set(kebabCase(id), id);
|
|
73
|
+
}
|
|
74
|
+
return labels;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The labels no tenant may take: every app's own and the workspace's
|
|
78
|
+
* `protectedSubdomains`, sorted.
|
|
79
|
+
*/
|
|
80
|
+
function protectedSubdomains(manifest, configured = []) {
|
|
81
|
+
return [.../* @__PURE__ */ new Set([...appSubdomains(manifest).keys(), ...configured])].sort();
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* What a project's subdomains have to satisfy before anything is derived
|
|
85
|
+
* from them.
|
|
86
|
+
*
|
|
87
|
+
* @throws {SecondWildcardSite} when two sites declare `subdomain: '*'`
|
|
88
|
+
* @throws {SiteHostsEndpointMissing} when the wildcard site's `hosts` route is not served
|
|
89
|
+
* @throws {ProtectedSubdomainIsAnApp} when `protectedSubdomains` repeats an app's own
|
|
90
|
+
*/
|
|
91
|
+
function assertSubdomains(manifest, configured = []) {
|
|
92
|
+
const wildcards = Object.values(manifest).filter(isWildcardSite);
|
|
93
|
+
if (wildcards.length > 1) throw new SecondWildcardSite(wildcards.map((site) => site.id).sort());
|
|
94
|
+
const site = wildcards[0];
|
|
95
|
+
if (site?.hosts) {
|
|
96
|
+
const surface = manifest[site.hosts.surface];
|
|
97
|
+
if (!(surface?.kind === "rest-api" && (surface.endpoints.length === 0 || surface.endpoints.some((endpoint) => endpoint.method.toUpperCase() === "GET" && endpoint.path === site.hosts?.path)))) throw new SiteHostsEndpointMissing(site.id, site.hosts.surface, site.hosts.path);
|
|
98
|
+
}
|
|
99
|
+
const labels = appSubdomains(manifest);
|
|
100
|
+
for (const subdomain of configured) {
|
|
101
|
+
const app = labels.get(subdomain);
|
|
102
|
+
if (app) throw new ProtectedSubdomainIsAnApp(subdomain, app);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
2
106
|
//#region src/workspace/derive.ts
|
|
3
107
|
/**
|
|
4
108
|
* The apps a manifest implies.
|
|
@@ -82,13 +186,14 @@ function assignPorts(apps) {
|
|
|
82
186
|
* rely on. Then an explicit `root: true`. A project with one site needs neither.
|
|
83
187
|
*/
|
|
84
188
|
function markRoot(apps) {
|
|
85
|
-
const sites = Object.entries(apps).filter(([, a]) => a.type === "web");
|
|
189
|
+
const sites = Object.entries(apps).filter(([, a]) => a.type === "web" && a.subdomain !== WILDCARD_SUBDOMAIN);
|
|
86
190
|
if (sites.length === 0) return;
|
|
87
191
|
if (sites.some(([, a]) => a.root)) return;
|
|
88
192
|
const chosen = sites.find(([name]) => name === "web") ?? (sites.length === 1 ? sites[0] : void 0);
|
|
89
193
|
if (chosen) chosen[1].root = true;
|
|
90
194
|
}
|
|
91
195
|
function derivedApps(manifest, workspace) {
|
|
196
|
+
assertSubdomains(manifest, workspace.protectedSubdomains);
|
|
92
197
|
const apps = {};
|
|
93
198
|
const defaultTarget = workspace.deploy?.default ?? "dokploy";
|
|
94
199
|
for (const [id, declaration] of Object.entries(manifest)) {
|
|
@@ -145,6 +250,6 @@ function derivedApps(manifest, workspace) {
|
|
|
145
250
|
return apps;
|
|
146
251
|
}
|
|
147
252
|
//#endregion
|
|
148
|
-
export { derivedApps as n, appKey as t };
|
|
253
|
+
export { derivedApps as n, protectedSubdomains as r, appKey as t };
|
|
149
254
|
|
|
150
|
-
//# sourceMappingURL=derive-
|
|
255
|
+
//# sourceMappingURL=derive-BpT9jpPo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derive-BpT9jpPo.mjs","names":["appKey"],"sources":["../src/workspace/subdomains.ts","../src/workspace/derive.ts"],"sourcesContent":["/**\n * The subdomains of a stage's domain, as a wildcard site sees them.\n *\n * A site declared `subdomain: '*'` answers on every label nothing else does,\n * so the labels something else does answer on are the ones a tenant can never\n * take. They come from two places and from nowhere else: every app's own\n * label, read off the constructs and never listed by hand, and the names no\n * construct declares (`www`, `mail`, `status`), listed once in the workspace\n * config as `protectedSubdomains`.\n */\n\nimport {\n\tkebabCase as appKey,\n\ttype ConstructManifest,\n\tisWildcardSite,\n\ttype SiteDeclaration,\n\tWILDCARD_SUBDOMAIN,\n} from '@geekmidas/manifest';\nimport { GkmError } from '../errors';\n\n/** A `protectedSubdomains` entry an app already answers on. */\nexport class ProtectedSubdomainIsAnApp extends GkmError {\n\tconstructor(\n\t\treadonly subdomain: string,\n\t\treadonly app: string,\n\t) {\n\t\tsuper(\n\t\t\t`protectedSubdomains lists '${subdomain}', which '${app}' already ` +\n\t\t\t\t`answers on — a construct's own subdomain is protected without ` +\n\t\t\t\t`being listed. Remove it from protectedSubdomains.`,\n\t\t);\n\t\tthis.name = 'ProtectedSubdomainIsAnApp';\n\t}\n}\n\n/** Two sites that both answer on every subdomain. */\nexport class SecondWildcardSite extends GkmError {\n\tconstructor(readonly sites: readonly string[]) {\n\t\tsuper(\n\t\t\t`${sites.join(' and ')} both declare subdomain: '*', and two sites ` +\n\t\t\t\t`cannot share the same hosts. Keep one wildcard site per project; ` +\n\t\t\t\t`give the other a subdomain of its own.`,\n\t\t);\n\t\tthis.name = 'SecondWildcardSite';\n\t}\n}\n\n/** A wildcard site whose `hosts` route is on no surface the project declares. */\nexport class SiteHostsEndpointMissing extends GkmError {\n\tconstructor(\n\t\treadonly site: string,\n\t\treadonly surface: string,\n\t\treadonly path: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${site}' checks its hosts with GET ${path} on '${surface}', but ` +\n\t\t\t\t`'${surface}' serves no such route. Export the endpoint from the ` +\n\t\t\t\t`surface's endpoints, or point \\`hosts\\` at one it serves.`,\n\t\t);\n\t\tthis.name = 'SiteHostsEndpointMissing';\n\t}\n}\n\n/** The project's one wildcard site, or `undefined` when it has none. */\nexport function wildcardSite(\n\tmanifest: ConstructManifest,\n): SiteDeclaration | undefined {\n\treturn Object.values(manifest).find(isWildcardSite);\n}\n\n/**\n * Every label an app answers on, by the app it belongs to — what a deploy\n * puts under the stage's domain: a surface's or site's `subdomain` (or its id\n * kebab-cased), each file server and its processors' origin, and each worker,\n * which SNS may push to on a host of its own.\n *\n * The root site's is kept although it answers on the domain itself: which\n * site is the root can change without a tenant's slug changing meaning. The\n * wildcard site has none — its labels are whatever is left.\n */\nexport function appSubdomains(\n\tmanifest: ConstructManifest,\n): Map<string, string> {\n\tconst labels = new Map<string, string>();\n\tfor (const [id, declaration] of Object.entries(manifest)) {\n\t\tswitch (declaration.kind) {\n\t\t\tcase 'rest-api':\n\t\t\tcase 'websocket-api':\n\t\t\t\tlabels.set(declaration.subdomain ?? appKey(id), id);\n\t\t\t\tbreak;\n\t\t\tcase 'site':\n\t\t\t\tif (declaration.subdomain === WILDCARD_SUBDOMAIN) break;\n\t\t\t\tlabels.set(declaration.subdomain ?? appKey(id), id);\n\t\t\t\tbreak;\n\t\t\tcase 'file-server':\n\t\t\t\tlabels.set(appKey(id), id);\n\t\t\t\tif (declaration.processors?.length) {\n\t\t\t\t\tlabels.set(`${appKey(id)}-processors`, id);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'worker':\n\t\t\t\tlabels.set(appKey(id), id);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn labels;\n}\n\n/**\n * The labels no tenant may take: every app's own and the workspace's\n * `protectedSubdomains`, sorted.\n */\nexport function protectedSubdomains(\n\tmanifest: ConstructManifest,\n\tconfigured: readonly string[] = [],\n): string[] {\n\treturn [\n\t\t...new Set([...appSubdomains(manifest).keys(), ...configured]),\n\t].sort();\n}\n\n/**\n * What a project's subdomains have to satisfy before anything is derived\n * from them.\n *\n * @throws {SecondWildcardSite} when two sites declare `subdomain: '*'`\n * @throws {SiteHostsEndpointMissing} when the wildcard site's `hosts` route is not served\n * @throws {ProtectedSubdomainIsAnApp} when `protectedSubdomains` repeats an app's own\n */\nexport function assertSubdomains(\n\tmanifest: ConstructManifest,\n\tconfigured: readonly string[] = [],\n): void {\n\tconst wildcards = Object.values(manifest).filter(isWildcardSite);\n\tif (wildcards.length > 1) {\n\t\tthrow new SecondWildcardSite(wildcards.map((site) => site.id).sort());\n\t}\n\n\tconst site = wildcards[0];\n\tif (site?.hosts) {\n\t\tconst surface = manifest[site.hosts.surface];\n\t\t// A surface's globbed endpoints are folded into its node by a build,\n\t\t// not by discovery, so an empty list says nothing: the site was handed\n\t\t// the endpoint itself, and its construct checked it is a GET on that\n\t\t// surface. Only routes the node does list can show it missing.\n\t\tconst served =\n\t\t\tsurface?.kind === 'rest-api' &&\n\t\t\t(surface.endpoints.length === 0 ||\n\t\t\t\tsurface.endpoints.some(\n\t\t\t\t\t(endpoint) =>\n\t\t\t\t\t\tendpoint.method.toUpperCase() === 'GET' &&\n\t\t\t\t\t\tendpoint.path === site.hosts?.path,\n\t\t\t\t));\n\t\tif (!served) {\n\t\t\tthrow new SiteHostsEndpointMissing(\n\t\t\t\tsite.id,\n\t\t\t\tsite.hosts.surface,\n\t\t\t\tsite.hosts.path,\n\t\t\t);\n\t\t}\n\t}\n\n\tconst labels = appSubdomains(manifest);\n\tfor (const subdomain of configured) {\n\t\tconst app = labels.get(subdomain);\n\t\tif (app) throw new ProtectedSubdomainIsAnApp(subdomain, app);\n\t}\n}\n","/**\n * The apps a manifest implies.\n *\n * `gkm.config.ts` used to carry an `apps` block naming every app: its type, its\n * path, its port, its framework, which other apps it depended on. Every one of\n * those facts was already declared. A `StaticSite('Web', { path: 'apps/web' })`\n * and an `apps.web = { type: 'web', path: 'apps/web', framework: 'vite',\n * dependencies: ['api'] }` are the same statement written twice, and only one of\n * them was checked against anything — so the copy in config was free to drift,\n * and a surface config had no entry for simply never deployed.\n *\n * So the list comes from the graph. A `site` is an app, and so is every\n * `rest-api` — one surface, one container, at the `path` it declared.\n *\n * What config still supplies is what no graph can answer: the backends a cache\n * and a mailer resolve to, the deploy endpoint, the stage's domain.\n */\n\nimport {\n\ttype AppSpec,\n\ttype ConstructManifest,\n\tkebabCase,\n\tWILDCARD_SUBDOMAIN,\n} from '@geekmidas/manifest';\nimport { assertSubdomains } from './subdomains.js';\nimport type {\n\tAppDomainConfig,\n\tDeployTargetName,\n\tFramework,\n\tNormalizedAppConfig,\n\tNormalizedWorkspace,\n} from './types.js';\n\n/** Which frontend framework builds each site variant. */\nconst FRAMEWORKS: Record<string, Framework> = {\n\tstatic: 'vite',\n\tnext: 'nextjs',\n\ttanstack: 'tanstack-start',\n};\n\n/**\n * The app key a construct id becomes.\n *\n * The same kebab form every physical name is built from, so `Api` is `api` in\n * the config, `production-kitchen-sink-api` on Dokploy, and `API_URL` in an\n * environment — one id, three renderings, no second list.\n */\nexport function appKey(id: string): string {\n\treturn kebabCase(id);\n}\n\n/**\n * The app serving a surface: its own, always.\n *\n * Every surface gets a container. There is no arrangement in which one runs\n * inside another — two surfaces in a process share a filesystem, an\n * environment, and every credential either was granted, so an auth server\n * beside an API is one bug in the API away from being read by it.\n */\nexport function hostOf(\n\tmanifest: ConstructManifest,\n\tid: string,\n): string | undefined {\n\tconst declaration = manifest[id];\n\tif (\n\t\t!declaration ||\n\t\t(declaration.kind !== 'rest-api' && declaration.kind !== 'websocket-api')\n\t)\n\t\treturn undefined;\n\n\treturn id;\n}\n\n/**\n * Local ports, assigned so that adding a site does not renumber the others.\n *\n * Backends first, then the site holding the base domain, then the rest\n * alphabetically. The ordering is arbitrary but it is *fixed*, which is the\n * property that matters: a port that moves when an unrelated app is added is a\n * port nobody can put in a bookmark. A construct that names its own port keeps\n * it, and is skipped here.\n */\nfunction assignPorts(apps: Record<string, NormalizedAppConfig>): void {\n\tconst rank = (\n\t\tname: string,\n\t\tapp: NormalizedAppConfig,\n\t): [number, number, string] => [\n\t\tapp.type === 'backend' ? 0 : app.type === 'web' ? 1 : 2,\n\t\tapp.root ? 0 : 1,\n\t\tname,\n\t];\n\n\tconst ordered = Object.entries(apps).sort(([aName, a], [bName, b]) => {\n\t\tconst [at, ar, an] = rank(aName, a);\n\t\tconst [bt, br, bn] = rank(bName, b);\n\t\treturn at - bt || ar - br || an.localeCompare(bn);\n\t});\n\n\tconst taken = new Set(\n\t\tordered.map(([, app]) => app.port).filter((p): p is number => !!p),\n\t);\n\n\tlet next = 3000;\n\tfor (const [, app] of ordered) {\n\t\tif (app.port) continue;\n\t\twhile (taken.has(next)) next += 1;\n\t\tapp.port = next;\n\t\ttaken.add(next);\n\t}\n}\n\n/**\n * Whichever site holds the base domain.\n *\n * The convention first — a site named `web` — because it is one people already\n * rely on. Then an explicit `root: true`. A project with one site needs neither.\n */\nfunction markRoot(apps: Record<string, NormalizedAppConfig>): void {\n\t// A wildcard site answers on every subdomain, never on the domain itself.\n\tconst sites = Object.entries(apps).filter(\n\t\t([, a]) => a.type === 'web' && a.subdomain !== WILDCARD_SUBDOMAIN,\n\t);\n\tif (sites.length === 0) return;\n\tif (sites.some(([, a]) => a.root)) return;\n\n\tconst chosen =\n\t\tsites.find(([name]) => name === 'web') ??\n\t\t(sites.length === 1 ? sites[0] : undefined);\n\tif (chosen) chosen[1].root = true;\n}\n\nexport function derivedApps(\n\tmanifest: ConstructManifest,\n\tworkspace: NormalizedWorkspace,\n): Record<string, NormalizedAppConfig> {\n\tassertSubdomains(manifest, workspace.protectedSubdomains);\n\n\tconst apps: Record<string, NormalizedAppConfig> = {};\n\tconst defaultTarget: DeployTargetName =\n\t\tworkspace.deploy?.default ?? 'dokploy';\n\n\tfor (const [id, declaration] of Object.entries(manifest)) {\n\t\t// Three kinds are apps: a site, a mobile app and an HTTP surface. A worker\n\t\t// is not one — it names the process that runs a cron or a subscriber, and\n\t\t// that process is the app's server, which already exists. Everything else\n\t\t// is a resource one of them uses.\n\t\tif (\n\t\t\tdeclaration.kind !== 'site' &&\n\t\t\tdeclaration.kind !== 'mobile-app' &&\n\t\t\tdeclaration.kind !== 'rest-api' &&\n\t\t\tdeclaration.kind !== 'websocket-api'\n\t\t)\n\t\t\tcontinue;\n\n\t\t// No opt-in to be had. Each says where it lives.\n\t\tconst spec: AppSpec =\n\t\t\tdeclaration.kind === 'site' || declaration.kind === 'mobile-app'\n\t\t\t\t? declaration.app\n\t\t\t\t: {\n\t\t\t\t\t\tpath: declaration.path,\n\t\t\t\t\t\t...(declaration.kind === 'rest-api' && declaration.telescope\n\t\t\t\t\t\t\t? { telescope: true }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t};\n\n\t\tconst name = appKey(id);\n\t\t// A config entry of the same name still wins, so a workspace can override\n\t\t// one field without restating the app. Nothing in this repo needs to.\n\t\tconst configured = workspace.apps[name];\n\n\t\tapps[name] = {\n\t\t\t...configured,\n\t\t\ttype:\n\t\t\t\tdeclaration.kind === 'site'\n\t\t\t\t\t? 'web'\n\t\t\t\t\t: declaration.kind === 'mobile-app'\n\t\t\t\t\t\t? 'mobile'\n\t\t\t\t\t\t: 'backend',\n\t\t\tpath: spec.path,\n\t\t\tport: spec.port ?? configured?.port ?? 0,\n\t\t\t// The label it answers on, under a stage's domain and locally alike.\n\t\t\t...((declaration.kind === 'rest-api' ||\n\t\t\t\tdeclaration.kind === 'websocket-api' ||\n\t\t\t\tdeclaration.kind === 'site') &&\n\t\t\tdeclaration.subdomain\n\t\t\t\t? { subdomain: declaration.subdomain }\n\t\t\t\t: {}),\n\t\t\tdependencies: [],\n\t\t\tresolvedDeployTarget: configured?.resolvedDeployTarget ?? defaultTarget,\n\t\t\t...(declaration.kind === 'site'\n\t\t\t\t? {\n\t\t\t\t\t\tframework: configured?.framework ?? FRAMEWORKS[declaration.variant],\n\t\t\t\t\t\t...(declaration.root ? { root: true } : {}),\n\t\t\t\t\t\t...(spec.config ? { config: spec.config } : {}),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\t...(declaration.kind === 'mobile-app'\n\t\t\t\t? {\n\t\t\t\t\t\tframework: configured?.framework ?? declaration.variant,\n\t\t\t\t\t\t...(spec.config ? { config: spec.config } : {}),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\t// One glob fans out to the six the build reads, because each generator\n\t\t\t// already inspects every export and keeps what it recognises. A\n\t\t\t// per-kind field still wins where one was given.\n\t\t\t...(spec.telescope !== undefined ? { telescope: spec.telescope } : {}),\n\t\t\t...(spec.openapi !== undefined ? { openapi: spec.openapi } : {}),\n\t\t\t...(spec.runtime !== undefined ? { runtime: spec.runtime } : {}),\n\t\t\t...(spec.env !== undefined ? { env: spec.env } : {}),\n\t\t\t...(spec.entry !== undefined ? { entry: spec.entry } : {}),\n\t\t\t...(configured?.domain\n\t\t\t\t? { domain: configured.domain as AppDomainConfig }\n\t\t\t\t: {}),\n\t\t} as NormalizedAppConfig;\n\t}\n\n\t// Build order, from the edges rather than from a hand-kept list. A site that\n\t// depends on a surface depends on the app that serves it — which for a\n\t// mounted auth server is its host, not a container that does not exist.\n\tfor (const [id, declaration] of Object.entries(manifest)) {\n\t\tif (\n\t\t\tdeclaration.kind !== 'site' &&\n\t\t\tdeclaration.kind !== 'mobile-app' &&\n\t\t\tdeclaration.kind !== 'rest-api' &&\n\t\t\tdeclaration.kind !== 'websocket-api'\n\t\t)\n\t\t\tcontinue;\n\n\t\tconst app = apps[appKey(id)];\n\t\tif (!app) continue;\n\n\t\t// A site names its edges `dependencies`; a surface names them `calls`.\n\t\tconst edges =\n\t\t\tdeclaration.kind === 'rest-api' || declaration.kind === 'websocket-api'\n\t\t\t\t? (declaration.calls ?? [])\n\t\t\t\t: (declaration.dependencies ?? []);\n\n\t\tconst names = new Set<string>();\n\t\tfor (const edge of edges) {\n\t\t\tif (edge.kind !== 'rest-api') continue;\n\t\t\tconst host = hostOf(manifest, edge.target);\n\t\t\tif (!host) continue;\n\t\t\tconst key = appKey(host);\n\t\t\tif (key !== appKey(id) && apps[key]) names.add(key);\n\t\t}\n\n\t\tapp.dependencies = [...names].sort();\n\t}\n\n\tmarkRoot(apps);\n\tassignPorts(apps);\n\n\t// Apps config declared that the graph knows nothing about — a `type: 'mobile'`\n\t// entry, or a hand-run process. Kept rather than dropped: config is still the\n\t// escape hatch for what nothing declares.\n\tfor (const [name, app] of Object.entries(workspace.apps)) {\n\t\tif (!apps[name]) apps[name] = app;\n\t}\n\n\treturn apps;\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBA,IAAa,4BAAb,cAA+C,SAAS;CAE7C;CACA;CAFV,YACC,WACA,KACC;EACD,MACC,8BAA8B,UAAU,YAAY,IAAI,0HAGzD;EAPS,KAAA,YAAA;EACA,KAAA,MAAA;EAOT,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,qBAAb,cAAwC,SAAS;CAC3B;CAArB,YAAY,OAAmC;EAC9C,MACC,GAAG,MAAM,KAAK,OAAO,EAAE,oJAGxB;EALoB,KAAA,QAAA;EAMpB,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,2BAAb,cAA8C,SAAS;CAE5C;CACA;CACA;CAHV,YACC,MACA,SACA,MACC;EACD,MACC,IAAI,KAAK,8BAA8B,KAAK,OAAO,QAAQ,UACtD,QAAQ,+GAEd;EARS,KAAA,OAAA;EACA,KAAA,UAAA;EACA,KAAA,OAAA;EAOT,KAAK,OAAO;CACb;AACD;;;;;;;;;;;AAmBA,SAAgB,cACf,UACsB;CACtB,MAAM,yBAAS,IAAI,IAAoB;CACvC,KAAK,MAAM,CAAC,IAAI,gBAAgB,OAAO,QAAQ,QAAQ,GACtD,QAAQ,YAAY,MAApB;EACC,KAAK;EACL,KAAK;GACJ,OAAO,IAAI,YAAY,aAAaA,UAAO,EAAE,GAAG,EAAE;GAClD;EACD,KAAK;GACJ,IAAI,YAAY,cAAc,oBAAoB;GAClD,OAAO,IAAI,YAAY,aAAaA,UAAO,EAAE,GAAG,EAAE;GAClD;EACD,K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dokployResult, c as releaseDokploy, d as validateDokploy, f as verifyDokploy, o as planDokploy, s as provisionDokploy, u as rollbackDokploy } from "./engine-
|
|
2
|
+
import { a as dokployResult, c as releaseDokploy, d as validateDokploy, f as verifyDokploy, o as planDokploy, s as provisionDokploy, u as rollbackDokploy } from "./engine-BJ1JjsqP.mjs";
|
|
3
3
|
//#region src/target/dokploy/index.ts
|
|
4
4
|
/**
|
|
5
5
|
* The built-in `dokploy` target: the Dokploy engine `gkm deploy` has always
|
|
@@ -35,4 +35,4 @@ const dokployTarget = defineTarget({
|
|
|
35
35
|
//#endregion
|
|
36
36
|
export { dokployTarget };
|
|
37
37
|
|
|
38
|
-
//# sourceMappingURL=dokploy-
|
|
38
|
+
//# sourceMappingURL=dokploy-BexEz2nW.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dokploy-
|
|
1
|
+
{"version":3,"file":"dokploy-BexEz2nW.mjs","names":[],"sources":["../src/target/dokploy/index.ts"],"sourcesContent":["/**\n * The built-in `dokploy` target: the Dokploy engine `gkm deploy` has always\n * run, behind the phases.\n *\n * - `provision`: the project, environment and registry, and what the\n * manifest declares — its databases' roles applied over a port published\n * for the purpose.\n * - `release`: the stage's migrations, then each image built and pushed\n * beside its application and deployed, waited on until Dokploy has\n * finished; backends first and checked before any site is released.\n * - `verify`: each site answering its health check.\n * - `rollback`: what failed — or, `--atomic`, everything the run released —\n * pointed back at the image it ran before.\n */\n\nimport { defineTarget } from '../define';\nimport {\n\ttype DokployRun,\n\tdokployResult,\n\tplanDokploy,\n\tprovisionDokploy,\n\treleaseDokploy,\n\trollbackDokploy,\n\tvalidateDokploy,\n\tverifyDokploy,\n} from './engine';\n\nexport const dokployTarget = defineTarget<undefined, DokployRun>({\n\tname: 'dokploy',\n\truntime: 'server',\n\tcapabilities: { rollback: true, migrations: 'target', images: true },\n\tcredentials: ['dokploy', 'registry'],\n\tvalidate: (ctx) => validateDokploy(ctx),\n\tplan: (_ctx, run) => planDokploy(run),\n\tprovision: (_ctx, run) => provisionDokploy(run),\n\trelease: (_ctx, run) => releaseDokploy(run),\n\tverify: (_ctx, run) => verifyDokploy(run),\n\trollback: (_ctx, run, failure) => rollbackDokploy(run, failure),\n\tresult: (_ctx, run) => dokployResult(run),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AA2BA,MAAa,gBAAgB,aAAoC;CAChE,MAAM;CACN,SAAS;CACT,cAAc;EAAE,UAAU;EAAM,YAAY;EAAU,QAAQ;CAAK;CACnE,aAAa,CAAC,WAAW,UAAU;CACnC,WAAW,QAAQ,gBAAgB,GAAG;CACtC,OAAO,MAAM,QAAQ,YAAY,GAAG;CACpC,YAAY,MAAM,QAAQ,iBAAiB,GAAG;CAC9C,UAAU,MAAM,QAAQ,eAAe,GAAG;CAC1C,SAAS,MAAM,QAAQ,cAAc,GAAG;CACxC,WAAW,MAAM,KAAK,YAAY,gBAAgB,KAAK,OAAO;CAC9D,SAAS,MAAM,QAAQ,cAAc,GAAG;AACzC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_define = require("./define-crmMcXFS.cjs");
|
|
2
|
-
const require_engine = require("./engine-
|
|
2
|
+
const require_engine = require("./engine-BsfN6Z2y.cjs");
|
|
3
3
|
//#region src/target/dokploy/index.ts
|
|
4
4
|
/**
|
|
5
5
|
* The built-in `dokploy` target: the Dokploy engine `gkm deploy` has always
|
|
@@ -35,4 +35,4 @@ const dokployTarget = require_define.defineTarget({
|
|
|
35
35
|
//#endregion
|
|
36
36
|
exports.dokployTarget = dokployTarget;
|
|
37
37
|
|
|
38
|
-
//# sourceMappingURL=dokploy-
|
|
38
|
+
//# sourceMappingURL=dokploy-DGVo3gIu.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dokploy-
|
|
1
|
+
{"version":3,"file":"dokploy-DGVo3gIu.cjs","names":["defineTarget","validateDokploy","planDokploy","provisionDokploy","releaseDokploy","verifyDokploy","rollbackDokploy","dokployResult"],"sources":["../src/target/dokploy/index.ts"],"sourcesContent":["/**\n * The built-in `dokploy` target: the Dokploy engine `gkm deploy` has always\n * run, behind the phases.\n *\n * - `provision`: the project, environment and registry, and what the\n * manifest declares — its databases' roles applied over a port published\n * for the purpose.\n * - `release`: the stage's migrations, then each image built and pushed\n * beside its application and deployed, waited on until Dokploy has\n * finished; backends first and checked before any site is released.\n * - `verify`: each site answering its health check.\n * - `rollback`: what failed — or, `--atomic`, everything the run released —\n * pointed back at the image it ran before.\n */\n\nimport { defineTarget } from '../define';\nimport {\n\ttype DokployRun,\n\tdokployResult,\n\tplanDokploy,\n\tprovisionDokploy,\n\treleaseDokploy,\n\trollbackDokploy,\n\tvalidateDokploy,\n\tverifyDokploy,\n} from './engine';\n\nexport const dokployTarget = defineTarget<undefined, DokployRun>({\n\tname: 'dokploy',\n\truntime: 'server',\n\tcapabilities: { rollback: true, migrations: 'target', images: true },\n\tcredentials: ['dokploy', 'registry'],\n\tvalidate: (ctx) => validateDokploy(ctx),\n\tplan: (_ctx, run) => planDokploy(run),\n\tprovision: (_ctx, run) => provisionDokploy(run),\n\trelease: (_ctx, run) => releaseDokploy(run),\n\tverify: (_ctx, run) => verifyDokploy(run),\n\trollback: (_ctx, run, failure) => rollbackDokploy(run, failure),\n\tresult: (_ctx, run) => dokployResult(run),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AA2BA,MAAa,gBAAgBA,eAAAA,aAAoC;CAChE,MAAM;CACN,SAAS;CACT,cAAc;EAAE,UAAU;EAAM,YAAY;EAAU,QAAQ;CAAK;CACnE,aAAa,CAAC,WAAW,UAAU;CACnC,WAAW,QAAQC,eAAAA,gBAAgB,GAAG;CACtC,OAAO,MAAM,QAAQC,eAAAA,YAAY,GAAG;CACpC,YAAY,MAAM,QAAQC,eAAAA,iBAAiB,GAAG;CAC9C,UAAU,MAAM,QAAQC,eAAAA,eAAe,GAAG;CAC1C,SAAS,MAAM,QAAQC,eAAAA,cAAc,GAAG;CACxC,WAAW,MAAM,KAAK,YAAYC,eAAAA,gBAAgB,KAAK,OAAO;CAC9D,SAAS,MAAM,QAAQC,eAAAA,cAAc,GAAG;AACzC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_errors = require("./errors-DMC4Umsb.cjs");
|
|
2
|
-
const require_derive = require("./derive-
|
|
2
|
+
const require_derive = require("./derive-BkWnOSPH.cjs");
|
|
3
3
|
const require_index = require("./index.cjs");
|
|
4
|
-
const require_stage = require("./stage-
|
|
4
|
+
const require_stage = require("./stage-BdJzkWOO.cjs");
|
|
5
5
|
let node_path = require("node:path");
|
|
6
6
|
let node_fs = require("node:fs");
|
|
7
7
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -334,4 +334,4 @@ exports.easCli = easCli;
|
|
|
334
334
|
exports.easSync = easSync;
|
|
335
335
|
exports.withStageProfiles = withStageProfiles;
|
|
336
336
|
|
|
337
|
-
//# sourceMappingURL=eas-
|
|
337
|
+
//# sourceMappingURL=eas-DZ4DRSpN.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eas-DogHTOxl.cjs","names":["GkmError","spawn","join","delimiter","appKey","loadStage","mobileStage","existsSync","readFile","easWorkflowPath","easWorkflow","writeFile","mkdir","dirname"],"sources":["../src/mobile/eas.ts"],"sourcesContent":["/**\n * `gkm eas:sync --stage <stage>`: a mobile app's EAS project set up for a\n * deployed stage, from what the workspace declares — so a store build, which\n * EAS runs on its own machines, outside gkm, is built with the same values\n * the stage's servers were deployed with.\n *\n * - **`eas.json`**: the stage's build profile (`build.<stage>`) reads its EAS\n * environment and listens on its channel; its submit profile\n * (`submit.<stage>.android`) has its Play track and release status — see\n * `mobileStage`. Every other field is left as it is.\n * - **The EAS environment**: each value the app's build reads for the stage\n * (`StackMobileApp.values`) — its scheme, its edges' public URLs under\n * `EXPO_PUBLIC_`, and every stage secret already named so — set with\n * `eas env:set`, as `plaintext`: a bundle inlines them, so none is secret.\n * Nothing else is written: no server key reaches EAS.\n */\n\nimport { spawn } from 'node:child_process';\nimport { existsSync } from 'node:fs';\nimport { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { delimiter, dirname, join } from 'node:path';\nimport type {\n\tConstructManifest,\n\tMobileAppDeclaration,\n} from '@geekmidas/manifest';\nimport { GkmError } from '../errors';\nimport { loadStage } from '../exec/stage.js';\nimport { appKey } from '../workspace/derive.js';\nimport { easWorkflow, easWorkflowPath } from './easWorkflow.js';\nimport { type MobileStage, mobileStage } from './stage.js';\n\nconst logger = console;\n\n/** The workspace declares no `MobileApp`: nothing to set up. */\nexport class NoMobileApp extends GkmError {\n\tconstructor() {\n\t\tsuper(\n\t\t\t'The workspace declares no MobileApp, so there is no EAS project to set ' +\n\t\t\t\t\"up. Declare one: new MobileApp('App', { path: 'apps/app' }).dependsOn([api, auth]).\",\n\t\t);\n\t\tthis.name = 'NoMobileApp';\n\t}\n}\n\n/** Several `MobileApp`s, and nothing to say which. */\nexport class MobileAppNotChosen extends GkmError {\n\tconstructor(readonly apps: readonly string[]) {\n\t\tsuper(\n\t\t\t`The workspace declares ${apps.length} mobile apps (${apps.join(', ')}). ` +\n\t\t\t\t`Run from one's directory, or name it: --app ${apps[0]}.`,\n\t\t);\n\t\tthis.name = 'MobileAppNotChosen';\n\t}\n}\n\n/** `--app` names no `MobileApp`. */\nexport class MobileAppUnknown extends GkmError {\n\tconstructor(\n\t\treadonly app: string,\n\t\treadonly apps: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`'${app}' is not one of the workspace's mobile apps (${apps.join(', ')}).`,\n\t\t);\n\t\tthis.name = 'MobileAppUnknown';\n\t}\n}\n\n/** `eas` is not installed where the app is. */\nexport class EasCliMissing extends GkmError {\n\tconstructor(readonly dir: string) {\n\t\tsuper(\n\t\t\t`No \\`eas\\` to run in ${dir}. Add it to the app: pnpm add -D eas-cli ` +\n\t\t\t\t'(or install it globally: npm install -g eas-cli).',\n\t\t);\n\t\tthis.name = 'EasCliMissing';\n\t}\n}\n\n/** `eas` refused a command. */\nexport class EasCommandFailed extends GkmError {\n\tconstructor(\n\t\treadonly command: string,\n\t\treadonly code: number | null,\n\t\treadonly stderr: string,\n\t) {\n\t\tsuper(\n\t\t\t`\\`eas ${command}\\` failed (exit ${code}): ${stderr.trim() || 'it said nothing'}. ` +\n\t\t\t\t'In CI, EXPO_TOKEN must be set; on this machine, `eas login`.',\n\t\t);\n\t\tthis.name = 'EasCommandFailed';\n\t}\n}\n\n/** A platform EAS builds for. */\nexport type EasPlatform = 'ios' | 'android';\n\n/** What gkm asks of EAS, so tests can stand in. */\nexport interface EasCli {\n\t/** Create or update a variable in one of the project's environments. */\n\tsetEnv(\n\t\tdir: string,\n\t\tvariable: { environment: string; name: string; value: string },\n\t): Promise<void>;\n\t/**\n\t * The fingerprint of the app's native code, as a build with `profile`\n\t * would compute it — what its runtime version is.\n\t */\n\tfingerprint(\n\t\tdir: string,\n\t\toptions: { platform: EasPlatform; profile: string },\n\t): Promise<string>;\n\t/** A finished store build of `profile` with that fingerprint, if any. */\n\tstoreBuild(\n\t\tdir: string,\n\t\toptions: { platform: EasPlatform; profile: string; fingerprint: string },\n\t): Promise<string | undefined>;\n\t/** Start a store build of `profile`, submitted to the store when asked. */\n\tbuild(\n\t\tdir: string,\n\t\toptions: {\n\t\t\tplatform: EasPlatform;\n\t\t\tprofile: string;\n\t\t\tsubmit: boolean;\n\t\t\twait: boolean;\n\t\t},\n\t): Promise<void>;\n\t/** Publish an update of the app's JavaScript on a channel. */\n\tupdate(\n\t\tdir: string,\n\t\toptions: {\n\t\t\tplatform: EasPlatform;\n\t\t\tchannel: string;\n\t\t\tenvironment: string;\n\t\t\tmessage: string;\n\t\t},\n\t): Promise<void>;\n}\n\n/**\n * Run `eas` in `dir`: the app's own, else the workspace's, else the one on\n * PATH. What it prints on stdout is answered; a failure is\n * {@link EasCommandFailed} with what it said.\n */\nfunction runEas(\n\troot: string,\n\tdir: string,\n\targs: readonly string[],\n\toptions: { inherit?: boolean; env?: Readonly<Record<string, string>> } = {},\n): Promise<string> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst child = spawn('eas', [...args, '--non-interactive'], {\n\t\t\tcwd: dir,\n\t\t\t// A build's or an update's progress is the user's to read.\n\t\t\tstdio: ['ignore', options.inherit ? 'inherit' : 'pipe', 'pipe'],\n\t\t\tenv: {\n\t\t\t\t...process.env,\n\t\t\t\t...options.env,\n\t\t\t\tPATH: [\n\t\t\t\t\tjoin(dir, 'node_modules', '.bin'),\n\t\t\t\t\tjoin(root, 'node_modules', '.bin'),\n\t\t\t\t\tprocess.env.PATH,\n\t\t\t\t].join(delimiter),\n\t\t\t},\n\t\t});\n\t\tlet stdout = '';\n\t\tlet stderr = '';\n\t\tchild.stdout?.on('data', (chunk: Buffer) => {\n\t\t\tstdout += chunk.toString();\n\t\t});\n\t\tchild.stderr?.on('data', (chunk: Buffer) => {\n\t\t\tstderr += chunk.toString();\n\t\t\tif (options.inherit) process.stderr.write(chunk);\n\t\t});\n\t\tconst command = args.slice(0, 3).join(' ');\n\t\tchild.on('error', (error: NodeJS.ErrnoException) =>\n\t\t\treject(\n\t\t\t\terror.code === 'ENOENT'\n\t\t\t\t\t? new EasCliMissing(dir)\n\t\t\t\t\t: new EasCommandFailed(command, null, error.message),\n\t\t\t),\n\t\t);\n\t\tchild.on('close', (code) =>\n\t\t\tcode === 0\n\t\t\t\t? resolve(stdout)\n\t\t\t\t: reject(new EasCommandFailed(command, code, stderr)),\n\t\t);\n\t});\n}\n\n/** The JSON `eas … --json` printed, read for `what`. */\nfunction easJson(output: string, what: string): unknown {\n\ttry {\n\t\treturn JSON.parse(output);\n\t} catch {\n\t\tthrow new EasCommandFailed(what, 0, `not JSON: ${output.slice(0, 200)}`);\n\t}\n}\n\n/**\n * The real one — never a prompt (`--non-interactive`). `env` is what the\n * app's `app.config.ts` reads for the stage: every `eas` command evaluates\n * it, and one that reads a value it lacks fails before it starts — and a\n * fingerprint computed here must match the one EAS computes with the\n * stage's values.\n */\nexport function easCli(\n\troot: string,\n\tenv: Readonly<Record<string, string>> = {},\n): EasCli {\n\tconst run = (\n\t\tdir: string,\n\t\targs: readonly string[],\n\t\toptions: { inherit?: boolean } = {},\n\t) => runEas(root, dir, args, { ...options, env });\n\treturn {\n\t\tasync setEnv(dir, { environment, name, value }) {\n\t\t\tawait run(dir, [\n\t\t\t\t'env:set',\n\t\t\t\t'--environment',\n\t\t\t\tenvironment,\n\t\t\t\t'--name',\n\t\t\t\tname,\n\t\t\t\t'--value',\n\t\t\t\tvalue,\n\t\t\t\t'--visibility',\n\t\t\t\t'plaintext',\n\t\t\t\t'--scope',\n\t\t\t\t'project',\n\t\t\t]);\n\t\t},\n\n\t\tasync fingerprint(dir, { platform, profile }) {\n\t\t\tconst output = await run(dir, [\n\t\t\t\t'fingerprint:generate',\n\t\t\t\t'--platform',\n\t\t\t\tplatform,\n\t\t\t\t'--build-profile',\n\t\t\t\tprofile,\n\t\t\t\t'--json',\n\t\t\t]);\n\t\t\tconst hash = (\n\t\t\t\teasJson(output, 'fingerprint:generate') as { hash?: unknown }\n\t\t\t).hash;\n\t\t\tif (typeof hash !== 'string') {\n\t\t\t\tthrow new EasCommandFailed('fingerprint:generate', 0, 'no hash');\n\t\t\t}\n\t\t\treturn hash;\n\t\t},\n\n\t\tasync storeBuild(dir, { platform, profile, fingerprint }) {\n\t\t\tconst output = await run(dir, [\n\t\t\t\t'build:list',\n\t\t\t\t'--platform',\n\t\t\t\tplatform,\n\t\t\t\t'--build-profile',\n\t\t\t\tprofile,\n\t\t\t\t'--fingerprint-hash',\n\t\t\t\tfingerprint,\n\t\t\t\t'--status',\n\t\t\t\t'finished',\n\t\t\t\t'--distribution',\n\t\t\t\t'store',\n\t\t\t\t'--limit',\n\t\t\t\t'1',\n\t\t\t\t'--json',\n\t\t\t]);\n\t\t\tconst builds = easJson(output, 'build:list');\n\t\t\tif (!Array.isArray(builds)) return undefined;\n\t\t\tconst id = (builds[0] as { id?: unknown } | undefined)?.id;\n\t\t\treturn typeof id === 'string' ? id : undefined;\n\t\t},\n\n\t\tasync build(dir, { platform, profile, submit, wait }) {\n\t\t\tawait run(\n\t\t\t\tdir,\n\t\t\t\t[\n\t\t\t\t\t'build',\n\t\t\t\t\t'--platform',\n\t\t\t\t\tplatform,\n\t\t\t\t\t'--profile',\n\t\t\t\t\tprofile,\n\t\t\t\t\t...(submit ? ['--auto-submit'] : []),\n\t\t\t\t\t...(wait ? [] : ['--no-wait']),\n\t\t\t\t],\n\t\t\t\t{ inherit: true },\n\t\t\t);\n\t\t},\n\n\t\tasync update(dir, { platform, channel, environment, message }) {\n\t\t\tawait run(\n\t\t\t\tdir,\n\t\t\t\t[\n\t\t\t\t\t'update',\n\t\t\t\t\t'--platform',\n\t\t\t\t\tplatform,\n\t\t\t\t\t'--channel',\n\t\t\t\t\tchannel,\n\t\t\t\t\t'--environment',\n\t\t\t\t\tenvironment,\n\t\t\t\t\t'--message',\n\t\t\t\t\tmessage,\n\t\t\t\t],\n\t\t\t\t{ inherit: true },\n\t\t\t);\n\t\t},\n\t};\n}\n\n/**\n * The mobile app a command is about: the one `--app` names, else the one\n * this directory is, else the only one.\n *\n * @throws {NoMobileApp}, {MobileAppNotChosen}, {MobileAppUnknown}\n */\nexport function chooseMobileApp(\n\tmanifest: ConstructManifest,\n\tapp: string | undefined,\n\there: string | undefined,\n): MobileAppDeclaration {\n\tconst declarations = Object.values(manifest).filter(\n\t\t(declaration): declaration is MobileAppDeclaration =>\n\t\t\tdeclaration.kind === 'mobile-app',\n\t);\n\tconst names = declarations.map((declaration) => appKey(declaration.id));\n\tif (declarations.length === 0) throw new NoMobileApp();\n\tconst name =\n\t\tapp ??\n\t\t(here && names.includes(here)\n\t\t\t? here\n\t\t\t: names.length === 1\n\t\t\t\t? names[0]\n\t\t\t\t: undefined);\n\tif (!name) throw new MobileAppNotChosen(names);\n\tconst declaration = declarations.find((d) => appKey(d.id) === name);\n\tif (!declaration) throw new MobileAppUnknown(name, names);\n\treturn declaration;\n}\n\n/** `eas.json`, as far as gkm writes it. */\ninterface EasJson {\n\tbuild?: Record<string, Record<string, unknown>>;\n\tsubmit?: Record<string, Record<string, unknown>>;\n\t[key: string]: unknown;\n}\n\n/**\n * `eas.json` with the stage's build and submit profiles as `stage` says:\n * every field gkm does not decide is kept.\n */\nexport function withStageProfiles(\n\teasJson: EasJson,\n\tstage: MobileStage,\n): EasJson {\n\tconst build = easJson.build?.[stage.stage] ?? {};\n\tconst submit = easJson.submit?.[stage.stage] ?? {};\n\tconst android = (submit.android as Record<string, unknown> | undefined) ?? {};\n\treturn {\n\t\t...easJson,\n\t\tbuild: {\n\t\t\t...easJson.build,\n\t\t\t[stage.stage]: {\n\t\t\t\t...build,\n\t\t\t\tenvironment: stage.environment,\n\t\t\t\tchannel: stage.channel,\n\t\t\t},\n\t\t},\n\t\tsubmit: {\n\t\t\t...easJson.submit,\n\t\t\t[stage.stage]: {\n\t\t\t\t...submit,\n\t\t\t\tandroid: {\n\t\t\t\t\t...android,\n\t\t\t\t\ttrack: stage.android.track,\n\t\t\t\t\treleaseStatus: stage.android.releaseStatus,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t};\n}\n\nexport interface EasSyncOptions {\n\tstage: string;\n\t/** The mobile app, by its app key; the one here, or the only one, if not. */\n\tapp?: string;\n\t/** The AWS profile for the stage's account, where its secrets are kept. */\n\tprofile?: string;\n\tcwd?: string;\n\t/** Say what would be written, and write nothing. */\n\tdryRun?: boolean;\n}\n\n/** What a sync wrote — or, dry, would. */\nexport interface EasSyncResult {\n\tapp: string;\n\t/** The workspace's root, where its `eas` may be installed. */\n\troot: string;\n\tdir: string;\n\tstage: MobileStage;\n\tvalues: Record<string, string>;\n\t/** Whether `eas.json` changed. */\n\teasJsonChanged: boolean;\n\t/** The stage's EAS workflow, relative to the app, and whether it changed. */\n\tworkflow: { path: string; changed: boolean };\n}\n\n/**\n * Set up a mobile app's EAS project for a deployed stage.\n *\n * @throws {NoMobileApp}, {MobileAppNotChosen}, {MobileAppUnknown},\n * {MobileAppStageUndeclared}, {EasCliMissing}, {EasCommandFailed} — and\n * what loading the stage throws: {UndeclaredStage}, {ExecStageNotComposed},\n * {ExecStageNotDeployed}\n */\nexport async function easSync(\n\toptions: EasSyncOptions,\n\teas?: EasCli,\n): Promise<EasSyncResult> {\n\tconst loaded = await loadStage(options);\n\tconst { workspace, manifest, stack } = loaded;\n\n\tconst declaration = chooseMobileApp(manifest, options.app, loaded.appName);\n\tconst name = appKey(declaration.id);\n\n\tconst stage = mobileStage(workspace, declaration, options.stage);\n\tconst values =\n\t\tstack.mobileApps.find((candidate) => candidate.name === name)?.values ?? {};\n\tconst dir = join(workspace.root, declaration.app.path);\n\n\tconst path = join(dir, 'eas.json');\n\tconst before = existsSync(path)\n\t\t? (JSON.parse(await readFile(path, 'utf8')) as EasJson)\n\t\t: {};\n\tconst after = withStageProfiles(before, stage);\n\tconst easJsonChanged = JSON.stringify(before) !== JSON.stringify(after);\n\n\tconst workflowPath = easWorkflowPath(stage.stage);\n\tconst workflowFile = join(dir, workflowPath);\n\tconst workflowYaml = easWorkflow(stage, {\n\t\trelease: workspace.stages.protected?.includes(stage.stage) ?? false,\n\t\tiosSubmits: Boolean(\n\t\t\t(after.submit?.[stage.stage]?.ios as { ascAppId?: string } | undefined)\n\t\t\t\t?.ascAppId,\n\t\t),\n\t});\n\tconst workflow = {\n\t\tpath: workflowPath,\n\t\tchanged:\n\t\t\t!existsSync(workflowFile) ||\n\t\t\t(await readFile(workflowFile, 'utf8')) !== workflowYaml,\n\t};\n\n\tconst where = `${name} on '${stage.stage}': EAS environment '${stage.environment}', channel '${stage.channel}', Play track '${stage.android.track}' (${stage.android.releaseStatus})`;\n\tif (options.dryRun) {\n\t\tlogger.log(`📱 ${where} (dry run)`);\n\t\tif (easJsonChanged) {\n\t\t\tlogger.log(\n\t\t\t\t` would write build.${stage.stage} and submit.${stage.stage} in ${path}`,\n\t\t\t);\n\t\t}\n\t\tif (workflow.changed) logger.log(` would write ${workflowFile}`);\n\t\tfor (const [key, value] of Object.entries(values)) {\n\t\t\tlogger.log(` would set ${key}=${value}`);\n\t\t}\n\t\treturn {\n\t\t\tapp: name,\n\t\t\troot: workspace.root,\n\t\t\tdir,\n\t\t\tstage,\n\t\t\tvalues,\n\t\t\teasJsonChanged,\n\t\t\tworkflow,\n\t\t};\n\t}\n\n\tlogger.log(`📱 ${where}`);\n\tif (easJsonChanged) {\n\t\tawait writeFile(path, `${JSON.stringify(after, null, 2)}\\n`);\n\t\tlogger.log(\n\t\t\t` wrote build.${stage.stage} and submit.${stage.stage} in ${path}`,\n\t\t);\n\t}\n\tif (workflow.changed) {\n\t\tawait mkdir(dirname(workflowFile), { recursive: true });\n\t\tawait writeFile(workflowFile, workflowYaml);\n\t\tlogger.log(` wrote ${workflowFile}`);\n\t}\n\tconst cli = eas ?? easCli(workspace.root, values);\n\tfor (const [key, value] of Object.entries(values)) {\n\t\tawait cli.setEnv(dir, { environment: stage.environment, name: key, value });\n\t\tlogger.log(` set ${key}`);\n\t}\n\treturn {\n\t\tapp: name,\n\t\troot: workspace.root,\n\t\tdir,\n\t\tstage,\n\t\tvalues,\n\t\teasJsonChanged,\n\t\tworkflow,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,SAAS;;AAGf,IAAa,cAAb,cAAiCA,eAAAA,SAAS;CACzC,cAAc;EACb,MACC,4JAED;EACA,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,qBAAb,cAAwCA,eAAAA,SAAS;CAC3B;CAArB,YAAY,MAAkC;EAC7C,MACC,0BAA0B,KAAK,OAAO,gBAAgB,KAAK,KAAK,IAAI,EAAE,iDACtB,KAAK,GAAG,EACzD;EAJoB,KAAA,OAAA;EAKpB,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,mBAAb,cAAsCA,eAAAA,SAAS;CAEpC;CACA;CAFV,YACC,KACA,MACC;EACD,MACC,IAAI,IAAI,+CAA+C,KAAK,KAAK,IAAI,EAA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EAClD,MAAM,IAAI,OAAO,KAAK;GAAE,aAAa,MAAM;GAAa,MAAM;GAAK;EAAM,CAAC;EAC1E,OAAO,IAAI,UAAU,KAAK;CAC3B;CACA,OAAO;EACN,KAAK;EACL,MAAM,UAAU;EAChB;EACA;EACA;EACA;EACA;CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"eas-DZ4DRSpN.cjs","names":["GkmError","spawn","join","delimiter","appKey","loadStage","mobileStage","existsSync","readFile","easWorkflowPath","easWorkflow","writeFile","mkdir","dirname"],"sources":["../src/mobile/eas.ts"],"sourcesContent":["/**\n * `gkm eas:sync --stage <stage>`: a mobile app's EAS project set up for a\n * deployed stage, from what the workspace declares — so a store build, which\n * EAS runs on its own machines, outside gkm, is built with the same values\n * the stage's servers were deployed with.\n *\n * - **`eas.json`**: the stage's build profile (`build.<stage>`) reads its EAS\n * environment and listens on its channel; its submit profile\n * (`submit.<stage>.android`) has its Play track and release status — see\n * `mobileStage`. Every other field is left as it is.\n * - **The EAS environment**: each value the app's build reads for the stage\n * (`StackMobileApp.values`) — its scheme, its edges' public URLs under\n * `EXPO_PUBLIC_`, and every stage secret already named so — set with\n * `eas env:set`, as `plaintext`: a bundle inlines them, so none is secret.\n * Nothing else is written: no server key reaches EAS.\n */\n\nimport { spawn } from 'node:child_process';\nimport { existsSync } from 'node:fs';\nimport { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { delimiter, dirname, join } from 'node:path';\nimport type {\n\tConstructManifest,\n\tMobileAppDeclaration,\n} from '@geekmidas/manifest';\nimport { GkmError } from '../errors';\nimport { loadStage } from '../exec/stage.js';\nimport { appKey } from '../workspace/derive.js';\nimport { easWorkflow, easWorkflowPath } from './easWorkflow.js';\nimport { type MobileStage, mobileStage } from './stage.js';\n\nconst logger = console;\n\n/** The workspace declares no `MobileApp`: nothing to set up. */\nexport class NoMobileApp extends GkmError {\n\tconstructor() {\n\t\tsuper(\n\t\t\t'The workspace declares no MobileApp, so there is no EAS project to set ' +\n\t\t\t\t\"up. Declare one: new MobileApp('App', { path: 'apps/app' }).dependsOn([api, auth]).\",\n\t\t);\n\t\tthis.name = 'NoMobileApp';\n\t}\n}\n\n/** Several `MobileApp`s, and nothing to say which. */\nexport class MobileAppNotChosen extends GkmError {\n\tconstructor(readonly apps: readonly string[]) {\n\t\tsuper(\n\t\t\t`The workspace declares ${apps.length} mobile apps (${apps.join(', ')}). ` +\n\t\t\t\t`Run from one's directory, or name it: --app ${apps[0]}.`,\n\t\t);\n\t\tthis.name = 'MobileAppNotChosen';\n\t}\n}\n\n/** `--app` names no `MobileApp`. */\nexport class MobileAppUnknown extends GkmError {\n\tconstructor(\n\t\treadonly app: string,\n\t\treadonly apps: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`'${app}' is not one of the workspace's mobile apps (${apps.join(', ')}).`,\n\t\t);\n\t\tthis.name = 'MobileAppUnknown';\n\t}\n}\n\n/** `eas` is not installed where the app is. */\nexport class EasCliMissing extends GkmError {\n\tconstructor(readonly dir: string) {\n\t\tsuper(\n\t\t\t`No \\`eas\\` to run in ${dir}. Add it to the app: pnpm add -D eas-cli ` +\n\t\t\t\t'(or install it globally: npm install -g eas-cli).',\n\t\t);\n\t\tthis.name = 'EasCliMissing';\n\t}\n}\n\n/** `eas` refused a command. */\nexport class EasCommandFailed extends GkmError {\n\tconstructor(\n\t\treadonly command: string,\n\t\treadonly code: number | null,\n\t\treadonly stderr: string,\n\t) {\n\t\tsuper(\n\t\t\t`\\`eas ${command}\\` failed (exit ${code}): ${stderr.trim() || 'it said nothing'}. ` +\n\t\t\t\t'In CI, EXPO_TOKEN must be set; on this machine, `eas login`.',\n\t\t);\n\t\tthis.name = 'EasCommandFailed';\n\t}\n}\n\n/** A platform EAS builds for. */\nexport type EasPlatform = 'ios' | 'android';\n\n/** What gkm asks of EAS, so tests can stand in. */\nexport interface EasCli {\n\t/** Create or update a variable in one of the project's environments. */\n\tsetEnv(\n\t\tdir: string,\n\t\tvariable: { environment: string; name: string; value: string },\n\t): Promise<void>;\n\t/**\n\t * The fingerprint of the app's native code, as a build with `profile`\n\t * would compute it — what its runtime version is.\n\t */\n\tfingerprint(\n\t\tdir: string,\n\t\toptions: { platform: EasPlatform; profile: string },\n\t): Promise<string>;\n\t/** A finished store build of `profile` with that fingerprint, if any. */\n\tstoreBuild(\n\t\tdir: string,\n\t\toptions: { platform: EasPlatform; profile: string; fingerprint: string },\n\t): Promise<string | undefined>;\n\t/** Start a store build of `profile`, submitted to the store when asked. */\n\tbuild(\n\t\tdir: string,\n\t\toptions: {\n\t\t\tplatform: EasPlatform;\n\t\t\tprofile: string;\n\t\t\tsubmit: boolean;\n\t\t\twait: boolean;\n\t\t},\n\t): Promise<void>;\n\t/** Publish an update of the app's JavaScript on a channel. */\n\tupdate(\n\t\tdir: string,\n\t\toptions: {\n\t\t\tplatform: EasPlatform;\n\t\t\tchannel: string;\n\t\t\tenvironment: string;\n\t\t\tmessage: string;\n\t\t},\n\t): Promise<void>;\n}\n\n/**\n * Run `eas` in `dir`: the app's own, else the workspace's, else the one on\n * PATH. What it prints on stdout is answered; a failure is\n * {@link EasCommandFailed} with what it said.\n */\nfunction runEas(\n\troot: string,\n\tdir: string,\n\targs: readonly string[],\n\toptions: { inherit?: boolean; env?: Readonly<Record<string, string>> } = {},\n): Promise<string> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst child = spawn('eas', [...args, '--non-interactive'], {\n\t\t\tcwd: dir,\n\t\t\t// A build's or an update's progress is the user's to read.\n\t\t\tstdio: ['ignore', options.inherit ? 'inherit' : 'pipe', 'pipe'],\n\t\t\tenv: {\n\t\t\t\t...process.env,\n\t\t\t\t...options.env,\n\t\t\t\tPATH: [\n\t\t\t\t\tjoin(dir, 'node_modules', '.bin'),\n\t\t\t\t\tjoin(root, 'node_modules', '.bin'),\n\t\t\t\t\tprocess.env.PATH,\n\t\t\t\t].join(delimiter),\n\t\t\t},\n\t\t});\n\t\tlet stdout = '';\n\t\tlet stderr = '';\n\t\tchild.stdout?.on('data', (chunk: Buffer) => {\n\t\t\tstdout += chunk.toString();\n\t\t});\n\t\tchild.stderr?.on('data', (chunk: Buffer) => {\n\t\t\tstderr += chunk.toString();\n\t\t\tif (options.inherit) process.stderr.write(chunk);\n\t\t});\n\t\tconst command = args.slice(0, 3).join(' ');\n\t\tchild.on('error', (error: NodeJS.ErrnoException) =>\n\t\t\treject(\n\t\t\t\terror.code === 'ENOENT'\n\t\t\t\t\t? new EasCliMissing(dir)\n\t\t\t\t\t: new EasCommandFailed(command, null, error.message),\n\t\t\t),\n\t\t);\n\t\tchild.on('close', (code) =>\n\t\t\tcode === 0\n\t\t\t\t? resolve(stdout)\n\t\t\t\t: reject(new EasCommandFailed(command, code, stderr)),\n\t\t);\n\t});\n}\n\n/** The JSON `eas … --json` printed, read for `what`. */\nfunction easJson(output: string, what: string): unknown {\n\ttry {\n\t\treturn JSON.parse(output);\n\t} catch {\n\t\tthrow new EasCommandFailed(what, 0, `not JSON: ${output.slice(0, 200)}`);\n\t}\n}\n\n/**\n * The real one — never a prompt (`--non-interactive`). `env` is what the\n * app's `app.config.ts` reads for the stage: every `eas` command evaluates\n * it, and one that reads a value it lacks fails before it starts — and a\n * fingerprint computed here must match the one EAS computes with the\n * stage's values.\n */\nexport function easCli(\n\troot: string,\n\tenv: Readonly<Record<string, string>> = {},\n): EasCli {\n\tconst run = (\n\t\tdir: string,\n\t\targs: readonly string[],\n\t\toptions: { inherit?: boolean } = {},\n\t) => runEas(root, dir, args, { ...options, env });\n\treturn {\n\t\tasync setEnv(dir, { environment, name, value }) {\n\t\t\tawait run(dir, [\n\t\t\t\t'env:set',\n\t\t\t\t'--environment',\n\t\t\t\tenvironment,\n\t\t\t\t'--name',\n\t\t\t\tname,\n\t\t\t\t'--value',\n\t\t\t\tvalue,\n\t\t\t\t'--visibility',\n\t\t\t\t'plaintext',\n\t\t\t\t'--scope',\n\t\t\t\t'project',\n\t\t\t]);\n\t\t},\n\n\t\tasync fingerprint(dir, { platform, profile }) {\n\t\t\tconst output = await run(dir, [\n\t\t\t\t'fingerprint:generate',\n\t\t\t\t'--platform',\n\t\t\t\tplatform,\n\t\t\t\t'--build-profile',\n\t\t\t\tprofile,\n\t\t\t\t'--json',\n\t\t\t]);\n\t\t\tconst hash = (\n\t\t\t\teasJson(output, 'fingerprint:generate') as { hash?: unknown }\n\t\t\t).hash;\n\t\t\tif (typeof hash !== 'string') {\n\t\t\t\tthrow new EasCommandFailed('fingerprint:generate', 0, 'no hash');\n\t\t\t}\n\t\t\treturn hash;\n\t\t},\n\n\t\tasync storeBuild(dir, { platform, profile, fingerprint }) {\n\t\t\tconst output = await run(dir, [\n\t\t\t\t'build:list',\n\t\t\t\t'--platform',\n\t\t\t\tplatform,\n\t\t\t\t'--build-profile',\n\t\t\t\tprofile,\n\t\t\t\t'--fingerprint-hash',\n\t\t\t\tfingerprint,\n\t\t\t\t'--status',\n\t\t\t\t'finished',\n\t\t\t\t'--distribution',\n\t\t\t\t'store',\n\t\t\t\t'--limit',\n\t\t\t\t'1',\n\t\t\t\t'--json',\n\t\t\t]);\n\t\t\tconst builds = easJson(output, 'build:list');\n\t\t\tif (!Array.isArray(builds)) return undefined;\n\t\t\tconst id = (builds[0] as { id?: unknown } | undefined)?.id;\n\t\t\treturn typeof id === 'string' ? id : undefined;\n\t\t},\n\n\t\tasync build(dir, { platform, profile, submit, wait }) {\n\t\t\tawait run(\n\t\t\t\tdir,\n\t\t\t\t[\n\t\t\t\t\t'build',\n\t\t\t\t\t'--platform',\n\t\t\t\t\tplatform,\n\t\t\t\t\t'--profile',\n\t\t\t\t\tprofile,\n\t\t\t\t\t...(submit ? ['--auto-submit'] : []),\n\t\t\t\t\t...(wait ? [] : ['--no-wait']),\n\t\t\t\t],\n\t\t\t\t{ inherit: true },\n\t\t\t);\n\t\t},\n\n\t\tasync update(dir, { platform, channel, environment, message }) {\n\t\t\tawait run(\n\t\t\t\tdir,\n\t\t\t\t[\n\t\t\t\t\t'update',\n\t\t\t\t\t'--platform',\n\t\t\t\t\tplatform,\n\t\t\t\t\t'--channel',\n\t\t\t\t\tchannel,\n\t\t\t\t\t'--environment',\n\t\t\t\t\tenvironment,\n\t\t\t\t\t'--message',\n\t\t\t\t\tmessage,\n\t\t\t\t],\n\t\t\t\t{ inherit: true },\n\t\t\t);\n\t\t},\n\t};\n}\n\n/**\n * The mobile app a command is about: the one `--app` names, else the one\n * this directory is, else the only one.\n *\n * @throws {NoMobileApp}, {MobileAppNotChosen}, {MobileAppUnknown}\n */\nexport function chooseMobileApp(\n\tmanifest: ConstructManifest,\n\tapp: string | undefined,\n\there: string | undefined,\n): MobileAppDeclaration {\n\tconst declarations = Object.values(manifest).filter(\n\t\t(declaration): declaration is MobileAppDeclaration =>\n\t\t\tdeclaration.kind === 'mobile-app',\n\t);\n\tconst names = declarations.map((declaration) => appKey(declaration.id));\n\tif (declarations.length === 0) throw new NoMobileApp();\n\tconst name =\n\t\tapp ??\n\t\t(here && names.includes(here)\n\t\t\t? here\n\t\t\t: names.length === 1\n\t\t\t\t? names[0]\n\t\t\t\t: undefined);\n\tif (!name) throw new MobileAppNotChosen(names);\n\tconst declaration = declarations.find((d) => appKey(d.id) === name);\n\tif (!declaration) throw new MobileAppUnknown(name, names);\n\treturn declaration;\n}\n\n/** `eas.json`, as far as gkm writes it. */\ninterface EasJson {\n\tbuild?: Record<string, Record<string, unknown>>;\n\tsubmit?: Record<string, Record<string, unknown>>;\n\t[key: string]: unknown;\n}\n\n/**\n * `eas.json` with the stage's build and submit profiles as `stage` says:\n * every field gkm does not decide is kept.\n */\nexport function withStageProfiles(\n\teasJson: EasJson,\n\tstage: MobileStage,\n): EasJson {\n\tconst build = easJson.build?.[stage.stage] ?? {};\n\tconst submit = easJson.submit?.[stage.stage] ?? {};\n\tconst android = (submit.android as Record<string, unknown> | undefined) ?? {};\n\treturn {\n\t\t...easJson,\n\t\tbuild: {\n\t\t\t...easJson.build,\n\t\t\t[stage.stage]: {\n\t\t\t\t...build,\n\t\t\t\tenvironment: stage.environment,\n\t\t\t\tchannel: stage.channel,\n\t\t\t},\n\t\t},\n\t\tsubmit: {\n\t\t\t...easJson.submit,\n\t\t\t[stage.stage]: {\n\t\t\t\t...submit,\n\t\t\t\tandroid: {\n\t\t\t\t\t...android,\n\t\t\t\t\ttrack: stage.android.track,\n\t\t\t\t\treleaseStatus: stage.android.releaseStatus,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t};\n}\n\nexport interface EasSyncOptions {\n\tstage: string;\n\t/** The mobile app, by its app key; the one here, or the only one, if not. */\n\tapp?: string;\n\t/** The AWS profile for the stage's account, where its secrets are kept. */\n\tprofile?: string;\n\tcwd?: string;\n\t/** Say what would be written, and write nothing. */\n\tdryRun?: boolean;\n}\n\n/** What a sync wrote — or, dry, would. */\nexport interface EasSyncResult {\n\tapp: string;\n\t/** The workspace's root, where its `eas` may be installed. */\n\troot: string;\n\tdir: string;\n\tstage: MobileStage;\n\tvalues: Record<string, string>;\n\t/** Whether `eas.json` changed. */\n\teasJsonChanged: boolean;\n\t/** The stage's EAS workflow, relative to the app, and whether it changed. */\n\tworkflow: { path: string; changed: boolean };\n}\n\n/**\n * Set up a mobile app's EAS project for a deployed stage.\n *\n * @throws {NoMobileApp}, {MobileAppNotChosen}, {MobileAppUnknown},\n * {MobileAppStageUndeclared}, {EasCliMissing}, {EasCommandFailed} — and\n * what loading the stage throws: {UndeclaredStage}, {ExecStageNotComposed},\n * {ExecStageNotDeployed}\n */\nexport async function easSync(\n\toptions: EasSyncOptions,\n\teas?: EasCli,\n): Promise<EasSyncResult> {\n\tconst loaded = await loadStage(options);\n\tconst { workspace, manifest, stack } = loaded;\n\n\tconst declaration = chooseMobileApp(manifest, options.app, loaded.appName);\n\tconst name = appKey(declaration.id);\n\n\tconst stage = mobileStage(workspace, declaration, options.stage);\n\tconst values =\n\t\tstack.mobileApps.find((candidate) => candidate.name === name)?.values ?? {};\n\tconst dir = join(workspace.root, declaration.app.path);\n\n\tconst path = join(dir, 'eas.json');\n\tconst before = existsSync(path)\n\t\t? (JSON.parse(await readFile(path, 'utf8')) as EasJson)\n\t\t: {};\n\tconst after = withStageProfiles(before, stage);\n\tconst easJsonChanged = JSON.stringify(before) !== JSON.stringify(after);\n\n\tconst workflowPath = easWorkflowPath(stage.stage);\n\tconst workflowFile = join(dir, workflowPath);\n\tconst workflowYaml = easWorkflow(stage, {\n\t\trelease: workspace.stages.protected?.includes(stage.stage) ?? false,\n\t\tiosSubmits: Boolean(\n\t\t\t(after.submit?.[stage.stage]?.ios as { ascAppId?: string } | undefined)\n\t\t\t\t?.ascAppId,\n\t\t),\n\t});\n\tconst workflow = {\n\t\tpath: workflowPath,\n\t\tchanged:\n\t\t\t!existsSync(workflowFile) ||\n\t\t\t(await readFile(workflowFile, 'utf8')) !== workflowYaml,\n\t};\n\n\tconst where = `${name} on '${stage.stage}': EAS environment '${stage.environment}', channel '${stage.channel}', Play track '${stage.android.track}' (${stage.android.releaseStatus})`;\n\tif (options.dryRun) {\n\t\tlogger.log(`📱 ${where} (dry run)`);\n\t\tif (easJsonChanged) {\n\t\t\tlogger.log(\n\t\t\t\t` would write build.${stage.stage} and submit.${stage.stage} in ${path}`,\n\t\t\t);\n\t\t}\n\t\tif (workflow.changed) logger.log(` would write ${workflowFile}`);\n\t\tfor (const [key, value] of Object.entries(values)) {\n\t\t\tlogger.log(` would set ${key}=${value}`);\n\t\t}\n\t\treturn {\n\t\t\tapp: name,\n\t\t\troot: workspace.root,\n\t\t\tdir,\n\t\t\tstage,\n\t\t\tvalues,\n\t\t\teasJsonChanged,\n\t\t\tworkflow,\n\t\t};\n\t}\n\n\tlogger.log(`📱 ${where}`);\n\tif (easJsonChanged) {\n\t\tawait writeFile(path, `${JSON.stringify(after, null, 2)}\\n`);\n\t\tlogger.log(\n\t\t\t` wrote build.${stage.stage} and submit.${stage.stage} in ${path}`,\n\t\t);\n\t}\n\tif (workflow.changed) {\n\t\tawait mkdir(dirname(workflowFile), { recursive: true });\n\t\tawait writeFile(workflowFile, workflowYaml);\n\t\tlogger.log(` wrote ${workflowFile}`);\n\t}\n\tconst cli = eas ?? easCli(workspace.root, values);\n\tfor (const [key, value] of Object.entries(values)) {\n\t\tawait cli.setEnv(dir, { environment: stage.environment, name: key, value });\n\t\tlogger.log(` set ${key}`);\n\t}\n\treturn {\n\t\tapp: name,\n\t\troot: workspace.root,\n\t\tdir,\n\t\tstage,\n\t\tvalues,\n\t\teasJsonChanged,\n\t\tworkflow,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,SAAS;;AAGf,IAAa,cAAb,cAAiCA,eAAAA,SAAS;CACzC,cAAc;EACb,MACC,4JAED;EACA,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,qBAAb,cAAwCA,eAAAA,SAAS;CAC3B;CAArB,YAAY,MAAkC;EAC7C,MACC,0BAA0B,KAAK,OAAO,gBAAgB,KAAK,KAAK,IAAI,EAAE,iDACtB,KAAK,GAAG,EACzD;EAJoB,KAAA,OAAA;EAKpB,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,mBAAb,cAAsCA,eAAAA,SAAS;CAEpC;CACA;CAFV,YACC,KACA,MACC;EACD,MACC,IAAI,IAAI,+CAA+C,KAAK,KAAK,IAAI,EAAE,GACxE;EALS,KAAA,MAAA;EACA,KAAA,OAAA;EAKT,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,gBAAb,cAAmCA,eAAAA,SAAS;CACtB;CAArB,YAAY,KAAsB;EACjC,MACC,wBAAwB,IAAI,2FAE7B;EAJoB,KAAA,MAAA;EAKpB,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,mBAAb,cAAsCA,eAAAA,SAAS;CAEpC;CACA;CACA;CAHV,YACC,SACA,MACA,QACC;EACD,MACC,SAAS,QAAQ,kBAAkB,KAAK,KAAK,OAAO,KAAK,KAAK,kBAAkB,iEAEjF;EAPS,KAAA,UAAA;EACA,KAAA,OAAA;EACA,KAAA,SAAA;EAMT,KAAK,OAAO;CACb;AACD;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,IAAI,SAAS,SAAS,OAAO,IAAI,kBAAkB,cAAc;EACjE,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAC/C,OAAO,IAAI,gBAAgB,IAAI,GAAG,OAAO;EAE1C,OAAO;GACN,KAAK;GACL,MAAM,UAAU;GAChB;GACA;GACA;GACA;GACA;EACD;CACD;CAEA,OAAO,IAAI,MAAM,OAAO;CACxB,IAAI,gBAAgB;EACnB,OAAA,GAAMG,iBAAAA,UAAAA,CAAU,MAAM,GAAG,KAAK,UAAU,OAAO,MAAM,CAAC,EAAE,GAAG;EAC3D,OAAO,IACN,kBAAkB,MAAM,MAAM,cAAc,MAAM,MAAM,MAAM,MAC/D;CACD;CACA,IAAI,SAAS,SAAS;EACrB,OAAA,GAAMC,iBAAAA,MAAAA,EAAAA,GAAMC,UAAAA,QAAAA,CAAQ,YAAY,GAAG,EAAE,WAAW,KAAK,CAAC;EACtD,OAAA,GAAMF,iBAAAA,UAAAA,CAAU,cAAc,YAAY;EAC1C,OAAO,IAAI,YAAY,cAAc;CACtC;CACA,MAAM,MAAM,OAAO,OAAO,UAAU,MAAM,MAAM;CAChD,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAAG;EAClD,MAAM,IAAI,OAAO,KAAK;GAAE,aAAa,MAAM;GAAa,MAAM;GAAK;EAAM,CAAC;EAC1E,OAAO,IAAI,UAAU,KAAK;CAC3B;CACA,OAAO;EACN,KAAK;EACL,MAAM,UAAU;EAChB;EACA;EACA;EACA;EACA;CACD;AACD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
|
|
2
|
-
import { t as appKey } from "./derive-
|
|
2
|
+
import { t as appKey } from "./derive-BpT9jpPo.mjs";
|
|
3
3
|
import { i as easWorkflowPath, n as mobileStage, r as easWorkflow } from "./index.mjs";
|
|
4
|
-
import { t as loadStage } from "./stage-
|
|
4
|
+
import { t as loadStage } from "./stage-COixgz4P.mjs";
|
|
5
5
|
import { delimiter, dirname, join } from "node:path";
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
7
7
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
@@ -331,4 +331,4 @@ async function easSync(options, eas) {
|
|
|
331
331
|
//#endregion
|
|
332
332
|
export { chooseMobileApp, easCli, easSync, withStageProfiles };
|
|
333
333
|
|
|
334
|
-
//# sourceMappingURL=eas-
|
|
334
|
+
//# sourceMappingURL=eas-vfFOLF35.mjs.map
|