@geekmidas/cli 10.0.0-alpha.75 → 10.0.0-alpha.76
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/{LegacyStateStore-BFnXUFlx.cjs → LegacyStateStore-DwngfJxr.cjs} +2 -2
- package/dist/{LegacyStateStore-BFnXUFlx.cjs.map → LegacyStateStore-DwngfJxr.cjs.map} +1 -1
- package/dist/{LegacyStateStore-cpt3K1vx.mjs → LegacyStateStore-dyq07_Ir.mjs} +2 -2
- package/dist/{LegacyStateStore-cpt3K1vx.mjs.map → LegacyStateStore-dyq07_Ir.mjs.map} +1 -1
- package/dist/{LocalStateStore-zQGZ9b4J.cjs → LocalStateStore-B0NCde8Z.cjs} +2 -2
- package/dist/{LocalStateStore-zQGZ9b4J.cjs.map → LocalStateStore-B0NCde8Z.cjs.map} +1 -1
- package/dist/{LocalStateStore-RH9F2ZEy.mjs → LocalStateStore-DLxCCatI.mjs} +2 -2
- package/dist/{LocalStateStore-RH9F2ZEy.mjs.map → LocalStateStore-DLxCCatI.mjs.map} +1 -1
- package/dist/{S3StateStore-CT-ZMlQY.cjs → S3StateStore-BOenb-3o.cjs} +2 -2
- package/dist/{S3StateStore-CT-ZMlQY.cjs.map → S3StateStore-BOenb-3o.cjs.map} +1 -1
- package/dist/{S3StateStore-DBeBc0c0.mjs → S3StateStore-CGK_4hlo.mjs} +2 -2
- package/dist/{S3StateStore-DBeBc0c0.mjs.map → S3StateStore-CGK_4hlo.mjs.map} +1 -1
- package/dist/{SSMStateStore-rnzNfOaV.mjs → SSMStateStore-B_5_RqY-.mjs} +2 -2
- package/dist/{SSMStateStore-rnzNfOaV.mjs.map → SSMStateStore-B_5_RqY-.mjs.map} +1 -1
- package/dist/{SSMStateStore-HmsH3c4v.cjs → SSMStateStore-DYeD__7p.cjs} +2 -2
- package/dist/{SSMStateStore-HmsH3c4v.cjs.map → SSMStateStore-DYeD__7p.cjs.map} +1 -1
- package/dist/{add-Cvzdw8cf.mjs → add-B7IMXzou.mjs} +3 -3
- package/dist/{add-Cvzdw8cf.mjs.map → add-B7IMXzou.mjs.map} +1 -1
- package/dist/{add-CHBin8TF.cjs → add-j2yI3cbS.cjs} +3 -3
- package/dist/{add-CHBin8TF.cjs.map → add-j2yI3cbS.cjs.map} +1 -1
- package/dist/{aws-DojzQnLd.mjs → aws-Bja4zGSs.mjs} +13 -9
- package/dist/aws-Bja4zGSs.mjs.map +1 -0
- package/dist/{aws-DkHdTV-p.cjs → aws-CQAuluiu.cjs} +13 -9
- package/dist/aws-CQAuluiu.cjs.map +1 -0
- package/dist/awsStore-7VmS_cZR.cjs +54 -0
- package/dist/awsStore-7VmS_cZR.cjs.map +1 -0
- package/dist/awsStore-B529csle.mjs +43 -0
- package/dist/awsStore-B529csle.mjs.map +1 -0
- package/dist/{bundler-_8AEZhrs.cjs → bundler-Cf6OgaOe.cjs} +5 -5
- package/dist/bundler-Cf6OgaOe.cjs.map +1 -0
- package/dist/{bundler-xjp5RwRS.mjs → bundler-DO6bHhnb.mjs} +5 -5
- package/dist/bundler-DO6bHhnb.mjs.map +1 -0
- package/dist/{cli-BTGfA0B7.mjs → cli-BCPOHmg9.mjs} +3 -3
- package/dist/{cli-BTGfA0B7.mjs.map → cli-BCPOHmg9.mjs.map} +1 -1
- package/dist/{cli-B4ktxAsM.cjs → cli-CNanUB7a.cjs} +3 -3
- package/dist/{cli-B4ktxAsM.cjs.map → cli-CNanUB7a.cjs.map} +1 -1
- package/dist/{compose-DdH2JQJD.mjs → compose-Dq4VCtu5.mjs} +4 -3
- package/dist/compose-Dq4VCtu5.mjs.map +1 -0
- package/dist/{compose-UKyv_1yU.cjs → compose-h_6oNnHC.cjs} +4 -3
- package/dist/compose-h_6oNnHC.cjs.map +1 -0
- package/dist/{config-B38YWicj.d.cts → config-CWyhLSY1.d.cts} +3 -3
- package/dist/{config-B38YWicj.d.cts.map → config-CWyhLSY1.d.cts.map} +1 -1
- package/dist/{config-DA0kRTQe.d.mts → config-CqAvPP-f.d.mts} +3 -3
- package/dist/{config-DA0kRTQe.d.mts.map → config-CqAvPP-f.d.mts.map} +1 -1
- package/dist/config.cjs +1 -1
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +1 -1
- package/dist/deploy/public.cjs +6 -6
- package/dist/deploy/public.d.cts +3 -3
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +3 -3
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +6 -6
- package/dist/{deploy-XUZoA1us.cjs → deploy-CT3R9de9.cjs} +5 -5
- package/dist/{deploy-XUZoA1us.cjs.map → deploy-CT3R9de9.cjs.map} +1 -1
- package/dist/{deploy-CuSsiFIc.mjs → deploy-CVXEx7Nm.mjs} +5 -5
- package/dist/{deploy-CuSsiFIc.mjs.map → deploy-CVXEx7Nm.mjs.map} +1 -1
- package/dist/{dokploy-DZXTQX10.mjs → dokploy-CYm2ozFs.mjs} +2 -2
- package/dist/{dokploy-DZXTQX10.mjs.map → dokploy-CYm2ozFs.mjs.map} +1 -1
- package/dist/{dokploy-Cvgg_pID.cjs → dokploy-eSGmlhhj.cjs} +2 -2
- package/dist/{dokploy-Cvgg_pID.cjs.map → dokploy-eSGmlhhj.cjs.map} +1 -1
- package/dist/{encryption-JkeMPugf.mjs → encryption-DC0rsR1W.mjs} +3 -3
- package/dist/{encryption-JkeMPugf.mjs.map → encryption-DC0rsR1W.mjs.map} +1 -1
- package/dist/{encryption-w-Ehh9DW.cjs → encryption-vS3Qzw73.cjs} +3 -3
- package/dist/{encryption-w-Ehh9DW.cjs.map → encryption-vS3Qzw73.cjs.map} +1 -1
- package/dist/{engine-CmozkHxq.mjs → engine-BOO5TWZd.mjs} +4 -4
- package/dist/{engine-CmozkHxq.mjs.map → engine-BOO5TWZd.mjs.map} +1 -1
- package/dist/{engine-zpWBMsQq.cjs → engine-C0N2d1i5.cjs} +4 -4
- package/dist/{engine-zpWBMsQq.cjs.map → engine-C0N2d1i5.cjs.map} +1 -1
- package/dist/{github-BNngHoId.mjs → github-CEaFDL6t.mjs} +6 -6
- package/dist/github-CEaFDL6t.mjs.map +1 -0
- package/dist/{github-BGdJ-Lnm.cjs → github-ClkdCOL9.cjs} +6 -6
- package/dist/github-ClkdCOL9.cjs.map +1 -0
- package/dist/{index-vMidfqhU.d.cts → index-Ccu0f_2m.d.cts} +2 -2
- package/dist/{index-B-1lLGzy.d.mts.map → index-Ccu0f_2m.d.cts.map} +1 -1
- package/dist/{index-B-1lLGzy.d.mts → index-DOxmDKqv.d.mts} +2 -2
- package/dist/{index-vMidfqhU.d.cts.map → index-DOxmDKqv.d.mts.map} +1 -1
- package/dist/index.cjs +79 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +79 -50
- package/dist/index.mjs.map +1 -1
- package/dist/migrate-BRbYtFXG.cjs +93 -0
- package/dist/migrate-BRbYtFXG.cjs.map +1 -0
- package/dist/migrate-D3NAT7Ns.mjs +93 -0
- package/dist/migrate-D3NAT7Ns.mjs.map +1 -0
- package/dist/{migrate-CgjlYeun.cjs → migrate-D5_-ylI1.cjs} +3 -3
- package/dist/{migrate-CgjlYeun.cjs.map → migrate-D5_-ylI1.cjs.map} +1 -1
- package/dist/{migrate-BLL1RTAj.mjs → migrate-DrO2p9Rl.mjs} +3 -3
- package/dist/{migrate-BLL1RTAj.mjs.map → migrate-DrO2p9Rl.mjs.map} +1 -1
- package/dist/openapi.cjs +16 -6
- package/dist/openapi.cjs.map +1 -1
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.cts.map +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.d.mts.map +1 -1
- package/dist/openapi.mjs +16 -6
- package/dist/openapi.mjs.map +1 -1
- package/dist/reconcile/public.d.cts +1 -1
- package/dist/reconcile/public.d.mts +1 -1
- package/dist/{resolve-DZNx7rLy.mjs → resolve-C1muFos5.mjs} +3 -3
- package/dist/{resolve-DZNx7rLy.mjs.map → resolve-C1muFos5.mjs.map} +1 -1
- package/dist/{resolve-fevXn-wZ.cjs → resolve-Fa1Ii0BK.cjs} +3 -3
- package/dist/{resolve-fevXn-wZ.cjs.map → resolve-Fa1Ii0BK.cjs.map} +1 -1
- package/dist/{rollback-Dw-FW3X2.cjs → rollback-C9N5lKVf.cjs} +5 -5
- package/dist/{rollback-Dw-FW3X2.cjs.map → rollback-C9N5lKVf.cjs.map} +1 -1
- package/dist/{rollback-CLi5Pln_.mjs → rollback-DeQzbRqM.mjs} +5 -5
- package/dist/{rollback-CLi5Pln_.mjs.map → rollback-DeQzbRqM.mjs.map} +1 -1
- package/dist/{runtime-BzZD5HHi.d.cts → runtime-BSvzPqXW.d.mts} +2 -2
- package/dist/{runtime-BzZD5HHi.d.cts.map → runtime-BSvzPqXW.d.mts.map} +1 -1
- package/dist/{runtime-Cm6J6L7n.d.mts → runtime-Cm7QA53H.d.cts} +2 -2
- package/dist/{runtime-Cm6J6L7n.d.mts.map → runtime-Cm7QA53H.d.cts.map} +1 -1
- package/dist/secretsManager-DUXW3fQt.cjs +70 -0
- package/dist/secretsManager-DUXW3fQt.cjs.map +1 -0
- package/dist/secretsManager-Ti0oZwsS.mjs +70 -0
- package/dist/secretsManager-Ti0oZwsS.mjs.map +1 -0
- package/dist/{sniffer-BmCvVyhq.mjs → sniffer-DR8AlRCk.mjs} +17 -17
- package/dist/sniffer-DR8AlRCk.mjs.map +1 -0
- package/dist/{sniffer-bMzrX4cO.cjs → sniffer-Y6GQOCXB.cjs} +17 -17
- package/dist/sniffer-Y6GQOCXB.cjs.map +1 -0
- package/dist/{state-kA4Fkufx.cjs → state-C2qi0iQw.cjs} +187 -24
- package/dist/state-C2qi0iQw.cjs.map +1 -0
- package/dist/{state-BrWIOce_.mjs → state-CUecOCNJ.mjs} +170 -25
- package/dist/state-CUecOCNJ.mjs.map +1 -0
- 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-TzCChNrA.d.cts → types-BdptGBFS.d.cts} +59 -6
- package/dist/types-BdptGBFS.d.cts.map +1 -0
- package/dist/{types-Dp9lgx_S.d.mts → types-OxE0OAn2.d.mts} +59 -6
- package/dist/types-OxE0OAn2.d.mts.map +1 -0
- package/dist/workspace/index.cjs +1 -1
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/dist/workspace/index.mjs +1 -1
- package/dist/{workspace-vdrcRI-m.cjs → workspace-DOm81oUo.cjs} +54 -1
- package/dist/workspace-DOm81oUo.cjs.map +1 -0
- package/dist/{workspace-C7NqCsQF.mjs → workspace-QUTqYmVy.mjs} +43 -2
- package/dist/workspace-QUTqYmVy.mjs.map +1 -0
- package/package.json +16 -15
- package/dist/aws-DkHdTV-p.cjs.map +0 -1
- package/dist/aws-DojzQnLd.mjs.map +0 -1
- package/dist/bundler-_8AEZhrs.cjs.map +0 -1
- package/dist/bundler-xjp5RwRS.mjs.map +0 -1
- package/dist/compose-DdH2JQJD.mjs.map +0 -1
- package/dist/compose-UKyv_1yU.cjs.map +0 -1
- package/dist/github-BGdJ-Lnm.cjs.map +0 -1
- package/dist/github-BNngHoId.mjs.map +0 -1
- package/dist/sniffer-BmCvVyhq.mjs.map +0 -1
- package/dist/sniffer-bMzrX4cO.cjs.map +0 -1
- package/dist/state-BrWIOce_.mjs.map +0 -1
- package/dist/state-kA4Fkufx.cjs.map +0 -1
- package/dist/types-Dp9lgx_S.d.mts.map +0 -1
- package/dist/types-TzCChNrA.d.cts.map +0 -1
- package/dist/workspace-C7NqCsQF.mjs.map +0 -1
- package/dist/workspace-vdrcRI-m.cjs.map +0 -1
|
@@ -2,10 +2,10 @@ import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
|
2
2
|
import { i as run$1, s as gkmHome } from "./run-BJLIerMM.mjs";
|
|
3
3
|
import { d as output, r as discover, u as ConstructGenerator } from "./discover-BPelzeGW.mjs";
|
|
4
4
|
import { t as appKey } from "./derive-B4vDpzgP.mjs";
|
|
5
|
-
import { O as TEST_STAGE, h as getPublicEnvPrefix, n as allConstructGlobs } from "./workspace-
|
|
5
|
+
import { F as UnknownSecretsStoreProvider, O as TEST_STAGE, h as getPublicEnvPrefix, m as PUBLIC_ENV_PREFIXES, n as allConstructGlobs } from "./workspace-QUTqYmVy.mjs";
|
|
6
6
|
import { ConfigNotFound, NotInAnApp, loadWorkspaceAppInfo, loadWorkspaceConfig } from "./config.mjs";
|
|
7
7
|
import { n as runtimeFor, r as generateTelemetryModule } from "./EndpointGenerator-DftalLYg.mjs";
|
|
8
|
-
import { c as runtimeOf } from "./resolve-
|
|
8
|
+
import { c as runtimeOf } from "./resolve-C1muFos5.mjs";
|
|
9
9
|
import { a as DEFAULT_STORAGE, i as DEFAULT_EVENTS$1, n as readFakes, o as holdsEveryCache, r as DEFAULT_CACHE, t as SubscriberGenerator } from "./SubscriberGenerator-5looQ3gB.mjs";
|
|
10
10
|
import { basename, dirname, isAbsolute, join, parse, relative, resolve, sep } from "node:path";
|
|
11
11
|
import { constants, existsSync, readFileSync } from "node:fs";
|
|
@@ -527,7 +527,8 @@ function decrypt(data, keyHex) {
|
|
|
527
527
|
var store_exports = /* @__PURE__ */ __exportAll({
|
|
528
528
|
FileSecretsStore: () => FileSecretsStore,
|
|
529
529
|
isRemoteStore: () => isRemoteStore,
|
|
530
|
-
secretsStoreFor: () => secretsStoreFor
|
|
530
|
+
secretsStoreFor: () => secretsStoreFor,
|
|
531
|
+
storeFromConfig: () => storeFromConfig
|
|
531
532
|
});
|
|
532
533
|
/**
|
|
533
534
|
* The store a stage's secrets are kept in — what every command reads and
|
|
@@ -539,13 +540,41 @@ var store_exports = /* @__PURE__ */ __exportAll({
|
|
|
539
540
|
async function secretsStoreFor(workspace, stage, options = {}) {
|
|
540
541
|
const configured = workspace.secrets.store ?? "file";
|
|
541
542
|
if (stage === workspace.stages.local || configured === "file") return new FileSecretsStore(workspace.root, keystoreProject(workspace, options.home));
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
543
|
+
return storeFromConfig(workspace, configured, options);
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* The store a `secrets.store` value describes, for any stage — what
|
|
547
|
+
* {@link secretsStoreFor} answers for a deployed stage, and what
|
|
548
|
+
* `gkm secrets:migrate` builds for the store it copies to.
|
|
549
|
+
*/
|
|
550
|
+
async function storeFromConfig(workspace, config, options = {}) {
|
|
551
|
+
if (config === "file") return new FileSecretsStore(workspace.root, keystoreProject(workspace, options.home));
|
|
552
|
+
const profile = options.profile ? { profile: options.profile } : {};
|
|
553
|
+
switch (config.provider) {
|
|
554
|
+
case "ssm": {
|
|
555
|
+
const { AwsSecretsStore } = await import("./aws-Bja4zGSs.mjs");
|
|
556
|
+
return new AwsSecretsStore({
|
|
557
|
+
project: workspace.name,
|
|
558
|
+
region: config.region,
|
|
559
|
+
...profile
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
case "secrets-manager": {
|
|
563
|
+
const { kmsKeyId } = config;
|
|
564
|
+
const { SecretsManagerSecretsStore } = await import("./secretsManager-Ti0oZwsS.mjs");
|
|
565
|
+
return new SecretsManagerSecretsStore({
|
|
566
|
+
project: workspace.name,
|
|
567
|
+
region: config.region,
|
|
568
|
+
...kmsKeyId ? { kmsKeyId } : {},
|
|
569
|
+
...profile
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
default: {
|
|
573
|
+
const provider = config.provider;
|
|
574
|
+
if (typeof provider === "object" && provider !== null) return provider;
|
|
575
|
+
throw new UnknownSecretsStoreProvider(provider);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
549
578
|
}
|
|
550
579
|
/** Whether a stage's secrets live somewhere other than this machine. */
|
|
551
580
|
function isRemoteStore(workspace, stage) {
|
|
@@ -1022,6 +1051,36 @@ function eventsBackendFor(on) {
|
|
|
1022
1051
|
return DEFAULT_EVENTS$1[on];
|
|
1023
1052
|
}
|
|
1024
1053
|
//#endregion
|
|
1054
|
+
//#region src/exec/imageBuild.ts
|
|
1055
|
+
/**
|
|
1056
|
+
* Set by a site's Dockerfile in its builder stage: this process is building
|
|
1057
|
+
* an image.
|
|
1058
|
+
*
|
|
1059
|
+
* Inside an image there is no stage to load secrets for and no local
|
|
1060
|
+
* container to resolve an address from — the public URLs the bundle inlines
|
|
1061
|
+
* arrived as the Dockerfile's build args, already in the environment. So
|
|
1062
|
+
* `gkm exec -- next build` there injects exactly those, and never the
|
|
1063
|
+
* `localhost` addresses a workspace resolves on a developer's machine.
|
|
1064
|
+
*/
|
|
1065
|
+
const IMAGE_BUILD_ENV = "GKM_IMAGE_BUILD";
|
|
1066
|
+
/** Whether this process is building an image. */
|
|
1067
|
+
function isImageBuild(env = process.env) {
|
|
1068
|
+
return env[IMAGE_BUILD_ENV] === "1";
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* What `gkm exec` injects inside an image build: the public values its build
|
|
1072
|
+
* args set — every `NEXT_PUBLIC_*`, `VITE_*` and `EXPO_PUBLIC_*` — and
|
|
1073
|
+
* nothing read from a secrets store, a file or a container.
|
|
1074
|
+
*/
|
|
1075
|
+
function imageBuildCredentials(env = process.env) {
|
|
1076
|
+
const credentials = {};
|
|
1077
|
+
for (const [key, value] of Object.entries(env)) {
|
|
1078
|
+
if (value === void 0) continue;
|
|
1079
|
+
if (PUBLIC_ENV_PREFIXES.some((prefix) => key.startsWith(prefix))) credentials[key] = value;
|
|
1080
|
+
}
|
|
1081
|
+
return credentials;
|
|
1082
|
+
}
|
|
1083
|
+
//#endregion
|
|
1025
1084
|
//#region src/docker/templates.ts
|
|
1026
1085
|
/**
|
|
1027
1086
|
* The turbo every image prunes and builds with when the build root resolves
|
|
@@ -1319,7 +1378,48 @@ function binPath(options) {
|
|
|
1319
1378
|
* were installed.
|
|
1320
1379
|
*/
|
|
1321
1380
|
function gkmCommand(args) {
|
|
1322
|
-
return `GKM_BIN="$(node -e '
|
|
1381
|
+
return `GKM_BIN="$(node -e '${FIND_GKM_BIN}')" && node "$GKM_BIN" ${args}`;
|
|
1382
|
+
}
|
|
1383
|
+
/** Prints the `bin/gkm.mjs` Node resolves from the cwd, or fails saying so. */
|
|
1384
|
+
const FIND_GKM_BIN = `let d=process.cwd();const{existsSync:e}=require("fs"),{dirname:u,join:j}=require("path");for(;;){const p=j(d,"node_modules/@geekmidas/cli/bin/gkm.mjs");if(e(p)){console.log(p);break}if(u(d)===d){console.error("@geekmidas/cli is not installed where the app can resolve it");process.exit(1)}d=u(d)}`;
|
|
1385
|
+
/**
|
|
1386
|
+
* What a site's builder does with the gkm workspace it carries, before its
|
|
1387
|
+
* framework builds it — all of it inside the image, nothing from the host:
|
|
1388
|
+
*
|
|
1389
|
+
* - `gkm` on the PATH: the CLI the workspace installs, so a build script that
|
|
1390
|
+
* is `gkm exec -- next build` runs. Resolved from the gkm root rather than
|
|
1391
|
+
* through `node_modules/.bin`, where a CLI that is a workspace package has
|
|
1392
|
+
* no bin linked.
|
|
1393
|
+
* - `GKM_IMAGE_BUILD`, which has `gkm exec` inject the build args above — the
|
|
1394
|
+
* stage's public URLs — and never load a secret or resolve a local address.
|
|
1395
|
+
* - each backend's typed client, generated from its endpoints at the
|
|
1396
|
+
* workspace root's `.gkm/client/`, where the site's tsconfig paths point.
|
|
1397
|
+
*/
|
|
1398
|
+
function siteWorkspaceSteps(options) {
|
|
1399
|
+
const { gkmRoot } = layout(options);
|
|
1400
|
+
const root = `/app/${gkmRoot}`.replace(/\/\.$/, "");
|
|
1401
|
+
const clients = options.clients ?? [];
|
|
1402
|
+
const generate = clients.length ? `
|
|
1403
|
+
|
|
1404
|
+
# The typed client of each API this site calls, generated from its endpoints
|
|
1405
|
+
# into ${gkmRoot === "." ? "" : `${gkmRoot}/`}.gkm/client/ — offline, with no secret and no container.
|
|
1406
|
+
RUN ${clients.map(({ app, path }) => `cd /app/${path} && gkm openapi --app ${app}`).join(" && \\\n ")}` : "";
|
|
1407
|
+
return `# The gkm CLI the workspace installs, as \`gkm\`
|
|
1408
|
+
RUN cd ${root} && GKM_BIN="$(node -e '${FIND_GKM_BIN}')" && \\
|
|
1409
|
+
{ echo '#!/bin/sh'; echo "exec node \\"$GKM_BIN\\" \\"\\$@\\""; } > /usr/local/bin/gkm && \\
|
|
1410
|
+
chmod +x /usr/local/bin/gkm
|
|
1411
|
+
|
|
1412
|
+
# \`gkm exec\` in this build injects the build args, never a stage's secrets
|
|
1413
|
+
ENV ${IMAGE_BUILD_ENV}=1${generate}`;
|
|
1414
|
+
}
|
|
1415
|
+
/**
|
|
1416
|
+
* Build the site with turbo. Loose env mode, so the task sees what the
|
|
1417
|
+
* Dockerfile set — the build args and `GKM_IMAGE_BUILD` — whatever the
|
|
1418
|
+
* project's turbo.json declares: the image's environment holds nothing else.
|
|
1419
|
+
*/
|
|
1420
|
+
function siteBuild(options) {
|
|
1421
|
+
const { turbo } = layout(options);
|
|
1422
|
+
return `RUN ${turbo} run build --filter='${options.turboPackage}' --env-mode=loose`;
|
|
1323
1423
|
}
|
|
1324
1424
|
/**
|
|
1325
1425
|
* The encrypted credentials, from a build secret — never an ARG, which is
|
|
@@ -1473,8 +1573,7 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \\
|
|
|
1473
1573
|
* @internal Exported for testing
|
|
1474
1574
|
*/
|
|
1475
1575
|
function generateNextjsDockerfile(options) {
|
|
1476
|
-
const { port, appPath,
|
|
1477
|
-
const { turbo } = layout(options);
|
|
1576
|
+
const { port, appPath, publicUrlArgs = ["NEXT_PUBLIC_API_URL", "NEXT_PUBLIC_AUTH_URL"] } = options;
|
|
1478
1577
|
return `# syntax=docker/dockerfile:1
|
|
1479
1578
|
# Next.js standalone Dockerfile, built from a turbo-pruned slice
|
|
1480
1579
|
|
|
@@ -1484,13 +1583,15 @@ ${depsStage(options)}
|
|
|
1484
1583
|
|
|
1485
1584
|
${builderStage(options, { args: publicUrlArgs })}
|
|
1486
1585
|
|
|
1586
|
+
${siteWorkspaceSteps(options)}
|
|
1587
|
+
|
|
1487
1588
|
# Ensure public directory exists (may be empty for scaffolded projects)
|
|
1488
1589
|
RUN mkdir -p ${appPath}/public
|
|
1489
1590
|
|
|
1490
1591
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
1491
1592
|
|
|
1492
1593
|
# Build the application
|
|
1493
|
-
|
|
1594
|
+
${siteBuild(options)}
|
|
1494
1595
|
|
|
1495
1596
|
# The runner needs the standalone server; without it there is nothing to run.
|
|
1496
1597
|
RUN if [ ! -d ${appPath}/.next/standalone ]; then \\
|
|
@@ -1678,8 +1779,7 @@ CMD ["node", "index.mjs"]
|
|
|
1678
1779
|
* @internal Exported for testing
|
|
1679
1780
|
*/
|
|
1680
1781
|
function generateNodeWebDockerfile(options) {
|
|
1681
|
-
const { port, appPath
|
|
1682
|
-
const { turbo } = layout(options);
|
|
1782
|
+
const { port, appPath } = options;
|
|
1683
1783
|
return `# syntax=docker/dockerfile:1
|
|
1684
1784
|
# Node SSR web Dockerfile (TanStack Start / Remix), from a turbo-pruned slice
|
|
1685
1785
|
|
|
@@ -1688,7 +1788,10 @@ ${prunerStage(options)}
|
|
|
1688
1788
|
${depsStage(options)}
|
|
1689
1789
|
|
|
1690
1790
|
${builderStage(options, { args: options.publicUrlArgs ?? [] })}
|
|
1691
|
-
|
|
1791
|
+
|
|
1792
|
+
${siteWorkspaceSteps(options)}
|
|
1793
|
+
|
|
1794
|
+
${siteBuild(options)}
|
|
1692
1795
|
|
|
1693
1796
|
FROM ${options.baseImage} AS runner
|
|
1694
1797
|
WORKDIR /app
|
|
@@ -1722,8 +1825,7 @@ CMD ["sh", "-c", "cd ${appPath} && npm start"]
|
|
|
1722
1825
|
* @internal Exported for testing
|
|
1723
1826
|
*/
|
|
1724
1827
|
function generateViteStaticDockerfile(options) {
|
|
1725
|
-
const { port, appPath
|
|
1726
|
-
const { turbo } = layout(options);
|
|
1828
|
+
const { port, appPath } = options;
|
|
1727
1829
|
return `# syntax=docker/dockerfile:1
|
|
1728
1830
|
# Vite SPA Dockerfile — a turbo-pruned slice built to static files, served by Caddy
|
|
1729
1831
|
|
|
@@ -1732,7 +1834,10 @@ ${prunerStage(options)}
|
|
|
1732
1834
|
${depsStage(options)}
|
|
1733
1835
|
|
|
1734
1836
|
${builderStage(options, { args: options.publicUrlArgs ?? [] })}
|
|
1735
|
-
|
|
1837
|
+
|
|
1838
|
+
${siteWorkspaceSteps(options)}
|
|
1839
|
+
|
|
1840
|
+
${siteBuild(options)}
|
|
1736
1841
|
|
|
1737
1842
|
FROM ${STATIC_SITE_IMAGE} AS runner
|
|
1738
1843
|
|
|
@@ -1841,7 +1946,7 @@ function fromBuildRoot(layout, path) {
|
|
|
1841
1946
|
return joined === "" ? "." : joined;
|
|
1842
1947
|
}
|
|
1843
1948
|
/** Everything a template needs about one app, relative to the build root. */
|
|
1844
|
-
function appImageOptions(layout, appName, app, workspaceRoot) {
|
|
1949
|
+
function appImageOptions(layout, appName, app, workspaceRoot, apps = {}) {
|
|
1845
1950
|
const turboPackage = packageName(isAbsolute(app.path) ? app.path : join(workspaceRoot, app.path)) ?? appName;
|
|
1846
1951
|
return {
|
|
1847
1952
|
imageName: appName,
|
|
@@ -1857,10 +1962,49 @@ function appImageOptions(layout, appName, app, workspaceRoot) {
|
|
|
1857
1962
|
...app.type === "backend" ? {
|
|
1858
1963
|
gkmPaths: layout.gkmPaths,
|
|
1859
1964
|
...layout.workspacePackage && layout.workspacePackage !== turboPackage ? { prunePackages: [layout.workspacePackage] } : {}
|
|
1860
|
-
} : {}
|
|
1965
|
+
} : app.type === "web" ? siteWorkspace(layout, app, apps, workspaceRoot, turboPackage) : {}
|
|
1861
1966
|
};
|
|
1862
1967
|
}
|
|
1863
1968
|
/**
|
|
1969
|
+
* What a site's image carries of the gkm workspace: its config and construct
|
|
1970
|
+
* directories, the workspace's own package where it is nested in a monorepo
|
|
1971
|
+
* (it holds the CLI), and each backend the site calls — whose endpoints its
|
|
1972
|
+
* client is generated from, and whose package their imports resolve in.
|
|
1973
|
+
*/
|
|
1974
|
+
function siteWorkspace(layout, site, apps, workspaceRoot, turboPackage) {
|
|
1975
|
+
const clients = siteClients(site, apps);
|
|
1976
|
+
const packages = /* @__PURE__ */ new Set();
|
|
1977
|
+
if (layout.workspacePackage) packages.add(layout.workspacePackage);
|
|
1978
|
+
for (const { app } of clients) {
|
|
1979
|
+
const backend = apps[app];
|
|
1980
|
+
const name = packageName(isAbsolute(backend.path) ? backend.path : join(workspaceRoot, backend.path));
|
|
1981
|
+
if (name) packages.add(name);
|
|
1982
|
+
}
|
|
1983
|
+
packages.delete(turboPackage);
|
|
1984
|
+
return {
|
|
1985
|
+
gkmPaths: layout.gkmPaths,
|
|
1986
|
+
...packages.size > 0 ? { prunePackages: [...packages].sort() } : {},
|
|
1987
|
+
...clients.length > 0 ? { clients: clients.map(({ app }) => ({
|
|
1988
|
+
app,
|
|
1989
|
+
path: fromBuildRoot(layout, apps[app].path)
|
|
1990
|
+
})) } : {}
|
|
1991
|
+
};
|
|
1992
|
+
}
|
|
1993
|
+
/**
|
|
1994
|
+
* The backends whose clients a site imports: each it depends on that gkm
|
|
1995
|
+
* builds from endpoints — not one with an entry of its own, and not one that
|
|
1996
|
+
* turned OpenAPI off.
|
|
1997
|
+
*/
|
|
1998
|
+
function siteClients(site, apps) {
|
|
1999
|
+
return site.dependencies.filter((name) => {
|
|
2000
|
+
const app = apps[name];
|
|
2001
|
+
if (!app || app.type !== "backend" || app.entry) return false;
|
|
2002
|
+
if (app.openapi === false) return false;
|
|
2003
|
+
if (typeof app.openapi === "object" && app.openapi.enabled === false) return false;
|
|
2004
|
+
return true;
|
|
2005
|
+
}).sort().map((app) => ({ app }));
|
|
2006
|
+
}
|
|
2007
|
+
/**
|
|
1864
2008
|
* The directories the workspace's construct globs start in, relative to its
|
|
1865
2009
|
* root: `./constructs/**\/*.ts` reads from `constructs`.
|
|
1866
2010
|
*/
|
|
@@ -5883,6 +6027,7 @@ async function workspaceDockerCommand(workspace, manifest, imageNames = {}, back
|
|
|
5883
6027
|
const dockerfile = appDockerfile(appName, app, {
|
|
5884
6028
|
layout,
|
|
5885
6029
|
workspaceRoot: workspace.root,
|
|
6030
|
+
apps: workspace.apps,
|
|
5886
6031
|
...manifest ? { manifest } : {}
|
|
5887
6032
|
});
|
|
5888
6033
|
const path = dockerfileOf(appName, app.path);
|
|
@@ -5938,7 +6083,7 @@ async function workspaceDockerCommand(workspace, manifest, imageNames = {}, back
|
|
|
5938
6083
|
* framework. The one choice every builder of images makes.
|
|
5939
6084
|
*/
|
|
5940
6085
|
function appDockerfile(appName, app, options) {
|
|
5941
|
-
const image = appImageOptions(options.layout, appName, app, options.workspaceRoot);
|
|
6086
|
+
const image = appImageOptions(options.layout, appName, app, options.workspaceRoot, options.apps);
|
|
5942
6087
|
if (app.type === "web") return siteDockerfile(appName, app, {
|
|
5943
6088
|
image,
|
|
5944
6089
|
...options.manifest ? { manifest: options.manifest } : {},
|
|
@@ -6352,6 +6497,6 @@ function setPostgresBackupId(state, backupId) {
|
|
|
6352
6497
|
if (state.backups) state.backups.postgresBackupId = backupId;
|
|
6353
6498
|
}
|
|
6354
6499
|
//#endregion
|
|
6355
|
-
export { LOCAL_CA_PATH as $,
|
|
6500
|
+
export { LOCAL_CA_PATH as $, applicationName as $t, ExternalServicesNotConfigured as A, providerOf as At, suppliedOnly as B, isPortAvailable as Bt, NoDomainForStage as C, WORKER_PORT as Ct, otelEnv as D, isImageBuild as Dt, isOtlpDestination as E, imageBuildCredentials as Et, externalServices as F, portKeys as Ft, QueueGenerator as G, secretsStoreFor as Gt, WorkerGenerator as H, loadSecretsForApp as Ht, manifestServiceDeclarations as I, primaryPortKey as It, backendsOf as J, FileSecretsStore as Jt, CronGenerator as K, storeFromConfig as Kt, parseDevServices as L, createCredentialsPreload as Lt, UnknownDevService as M, DEFAULT_IMAGES as Mt, assertExternalServices as N, describeServices as Nt, DEV_SERVICES as O, cacheBackendFor as Ot, devServicesUsed as P, fakeKey as Pt, workspace_exports as Q, readKey as Qt, reportDevServices as R, createEntryWrapper as Rt, validateImageRef as S, TURBO_VERSION as St, resolveHost as T, findBuildRoot as Tt, workerBundleName as U, prepareEntryCredentials as Ut, workerUnits as V, loadEnvFiles as Vt, workerEntryDir as W, isRemoteStore as Wt, derivedContainers as X, keystoreProject as Xt, constructGlobs as Y, getKeyPath as Yt, reconcileWorkspace as Z, projectKey as Zt, appDockerfile as _, planFor as _t, recordRelease as a, ownershipMarker as an, postgresDatabaseNames as at, workerDockerfile as b, composeBuildPaths as bt, setBackupState as c, maskPassword as cn, composeFor as ct, setGeneratedSecret as d, withCustomSecret as dn, appEnvKeys as dt, deployIdentity as en, forgetState as et, setPostgresBackupId as f, dockerfileOf as ft, DockerPushFailed as g, localRolePassword as gt, DockerBuildFailed as h, envFor as ht, isDnsVerified as i, markerOf as in, bucketPolicies as it, STORAGE_KEY_PAIR as j, storageBackendFor as jt, DevServicesNeedServerTarget as k, eventsBackendFor as kt, setDnsRecord as l, storage_exports as ln, bucketClient as lt, withGeneratedSecrets as m, workerEnvKeys as mt, getBackupState as n, imageRef as nn, applyPolicies as nt, recordRollback as o, projectName as on, postgresStatements as ot, DeployJournal as p, networkEnv as pt, FAKE_ENV as q, store_exports as qt, getGeneratedSecret as r, isOwnedBy as rn, applyPostgres as rt, setApplicationId as s, initStageSecrets as sn, quoteIdentifier as st, createEmptyState as t, imageName as tn, applyBuckets as tt, setDnsVerification as u, toEmbeddableSecrets as un, pgClient as ut, dockerCommand as v, resourceName as vt, isMainFrontendApp as w, detectPackageManager as wt, workerDockerfileOf as x, imageLayout as xt, ensureDockerignore as y, hostFor as yt, requiredStageKeys as z, findAvailablePort as zt };
|
|
6356
6501
|
|
|
6357
|
-
//# sourceMappingURL=state-
|
|
6502
|
+
//# sourceMappingURL=state-CUecOCNJ.mjs.map
|