@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.
Files changed (157) hide show
  1. package/dist/{LegacyStateStore-BFnXUFlx.cjs → LegacyStateStore-DwngfJxr.cjs} +2 -2
  2. package/dist/{LegacyStateStore-BFnXUFlx.cjs.map → LegacyStateStore-DwngfJxr.cjs.map} +1 -1
  3. package/dist/{LegacyStateStore-cpt3K1vx.mjs → LegacyStateStore-dyq07_Ir.mjs} +2 -2
  4. package/dist/{LegacyStateStore-cpt3K1vx.mjs.map → LegacyStateStore-dyq07_Ir.mjs.map} +1 -1
  5. package/dist/{LocalStateStore-zQGZ9b4J.cjs → LocalStateStore-B0NCde8Z.cjs} +2 -2
  6. package/dist/{LocalStateStore-zQGZ9b4J.cjs.map → LocalStateStore-B0NCde8Z.cjs.map} +1 -1
  7. package/dist/{LocalStateStore-RH9F2ZEy.mjs → LocalStateStore-DLxCCatI.mjs} +2 -2
  8. package/dist/{LocalStateStore-RH9F2ZEy.mjs.map → LocalStateStore-DLxCCatI.mjs.map} +1 -1
  9. package/dist/{S3StateStore-CT-ZMlQY.cjs → S3StateStore-BOenb-3o.cjs} +2 -2
  10. package/dist/{S3StateStore-CT-ZMlQY.cjs.map → S3StateStore-BOenb-3o.cjs.map} +1 -1
  11. package/dist/{S3StateStore-DBeBc0c0.mjs → S3StateStore-CGK_4hlo.mjs} +2 -2
  12. package/dist/{S3StateStore-DBeBc0c0.mjs.map → S3StateStore-CGK_4hlo.mjs.map} +1 -1
  13. package/dist/{SSMStateStore-rnzNfOaV.mjs → SSMStateStore-B_5_RqY-.mjs} +2 -2
  14. package/dist/{SSMStateStore-rnzNfOaV.mjs.map → SSMStateStore-B_5_RqY-.mjs.map} +1 -1
  15. package/dist/{SSMStateStore-HmsH3c4v.cjs → SSMStateStore-DYeD__7p.cjs} +2 -2
  16. package/dist/{SSMStateStore-HmsH3c4v.cjs.map → SSMStateStore-DYeD__7p.cjs.map} +1 -1
  17. package/dist/{add-Cvzdw8cf.mjs → add-B7IMXzou.mjs} +3 -3
  18. package/dist/{add-Cvzdw8cf.mjs.map → add-B7IMXzou.mjs.map} +1 -1
  19. package/dist/{add-CHBin8TF.cjs → add-j2yI3cbS.cjs} +3 -3
  20. package/dist/{add-CHBin8TF.cjs.map → add-j2yI3cbS.cjs.map} +1 -1
  21. package/dist/{aws-DojzQnLd.mjs → aws-Bja4zGSs.mjs} +13 -9
  22. package/dist/aws-Bja4zGSs.mjs.map +1 -0
  23. package/dist/{aws-DkHdTV-p.cjs → aws-CQAuluiu.cjs} +13 -9
  24. package/dist/aws-CQAuluiu.cjs.map +1 -0
  25. package/dist/awsStore-7VmS_cZR.cjs +54 -0
  26. package/dist/awsStore-7VmS_cZR.cjs.map +1 -0
  27. package/dist/awsStore-B529csle.mjs +43 -0
  28. package/dist/awsStore-B529csle.mjs.map +1 -0
  29. package/dist/{bundler-_8AEZhrs.cjs → bundler-Cf6OgaOe.cjs} +5 -5
  30. package/dist/bundler-Cf6OgaOe.cjs.map +1 -0
  31. package/dist/{bundler-xjp5RwRS.mjs → bundler-DO6bHhnb.mjs} +5 -5
  32. package/dist/bundler-DO6bHhnb.mjs.map +1 -0
  33. package/dist/{cli-BTGfA0B7.mjs → cli-BCPOHmg9.mjs} +3 -3
  34. package/dist/{cli-BTGfA0B7.mjs.map → cli-BCPOHmg9.mjs.map} +1 -1
  35. package/dist/{cli-B4ktxAsM.cjs → cli-CNanUB7a.cjs} +3 -3
  36. package/dist/{cli-B4ktxAsM.cjs.map → cli-CNanUB7a.cjs.map} +1 -1
  37. package/dist/{compose-DdH2JQJD.mjs → compose-Dq4VCtu5.mjs} +4 -3
  38. package/dist/compose-Dq4VCtu5.mjs.map +1 -0
  39. package/dist/{compose-UKyv_1yU.cjs → compose-h_6oNnHC.cjs} +4 -3
  40. package/dist/compose-h_6oNnHC.cjs.map +1 -0
  41. package/dist/{config-B38YWicj.d.cts → config-CWyhLSY1.d.cts} +3 -3
  42. package/dist/{config-B38YWicj.d.cts.map → config-CWyhLSY1.d.cts.map} +1 -1
  43. package/dist/{config-DA0kRTQe.d.mts → config-CqAvPP-f.d.mts} +3 -3
  44. package/dist/{config-DA0kRTQe.d.mts.map → config-CqAvPP-f.d.mts.map} +1 -1
  45. package/dist/config.cjs +1 -1
  46. package/dist/config.d.cts +3 -3
  47. package/dist/config.d.mts +3 -3
  48. package/dist/config.mjs +1 -1
  49. package/dist/deploy/public.cjs +6 -6
  50. package/dist/deploy/public.d.cts +3 -3
  51. package/dist/deploy/public.d.cts.map +1 -1
  52. package/dist/deploy/public.d.mts +3 -3
  53. package/dist/deploy/public.d.mts.map +1 -1
  54. package/dist/deploy/public.mjs +6 -6
  55. package/dist/{deploy-XUZoA1us.cjs → deploy-CT3R9de9.cjs} +5 -5
  56. package/dist/{deploy-XUZoA1us.cjs.map → deploy-CT3R9de9.cjs.map} +1 -1
  57. package/dist/{deploy-CuSsiFIc.mjs → deploy-CVXEx7Nm.mjs} +5 -5
  58. package/dist/{deploy-CuSsiFIc.mjs.map → deploy-CVXEx7Nm.mjs.map} +1 -1
  59. package/dist/{dokploy-DZXTQX10.mjs → dokploy-CYm2ozFs.mjs} +2 -2
  60. package/dist/{dokploy-DZXTQX10.mjs.map → dokploy-CYm2ozFs.mjs.map} +1 -1
  61. package/dist/{dokploy-Cvgg_pID.cjs → dokploy-eSGmlhhj.cjs} +2 -2
  62. package/dist/{dokploy-Cvgg_pID.cjs.map → dokploy-eSGmlhhj.cjs.map} +1 -1
  63. package/dist/{encryption-JkeMPugf.mjs → encryption-DC0rsR1W.mjs} +3 -3
  64. package/dist/{encryption-JkeMPugf.mjs.map → encryption-DC0rsR1W.mjs.map} +1 -1
  65. package/dist/{encryption-w-Ehh9DW.cjs → encryption-vS3Qzw73.cjs} +3 -3
  66. package/dist/{encryption-w-Ehh9DW.cjs.map → encryption-vS3Qzw73.cjs.map} +1 -1
  67. package/dist/{engine-CmozkHxq.mjs → engine-BOO5TWZd.mjs} +4 -4
  68. package/dist/{engine-CmozkHxq.mjs.map → engine-BOO5TWZd.mjs.map} +1 -1
  69. package/dist/{engine-zpWBMsQq.cjs → engine-C0N2d1i5.cjs} +4 -4
  70. package/dist/{engine-zpWBMsQq.cjs.map → engine-C0N2d1i5.cjs.map} +1 -1
  71. package/dist/{github-BNngHoId.mjs → github-CEaFDL6t.mjs} +6 -6
  72. package/dist/github-CEaFDL6t.mjs.map +1 -0
  73. package/dist/{github-BGdJ-Lnm.cjs → github-ClkdCOL9.cjs} +6 -6
  74. package/dist/github-ClkdCOL9.cjs.map +1 -0
  75. package/dist/{index-vMidfqhU.d.cts → index-Ccu0f_2m.d.cts} +2 -2
  76. package/dist/{index-B-1lLGzy.d.mts.map → index-Ccu0f_2m.d.cts.map} +1 -1
  77. package/dist/{index-B-1lLGzy.d.mts → index-DOxmDKqv.d.mts} +2 -2
  78. package/dist/{index-vMidfqhU.d.cts.map → index-DOxmDKqv.d.mts.map} +1 -1
  79. package/dist/index.cjs +79 -50
  80. package/dist/index.cjs.map +1 -1
  81. package/dist/index.mjs +79 -50
  82. package/dist/index.mjs.map +1 -1
  83. package/dist/migrate-BRbYtFXG.cjs +93 -0
  84. package/dist/migrate-BRbYtFXG.cjs.map +1 -0
  85. package/dist/migrate-D3NAT7Ns.mjs +93 -0
  86. package/dist/migrate-D3NAT7Ns.mjs.map +1 -0
  87. package/dist/{migrate-CgjlYeun.cjs → migrate-D5_-ylI1.cjs} +3 -3
  88. package/dist/{migrate-CgjlYeun.cjs.map → migrate-D5_-ylI1.cjs.map} +1 -1
  89. package/dist/{migrate-BLL1RTAj.mjs → migrate-DrO2p9Rl.mjs} +3 -3
  90. package/dist/{migrate-BLL1RTAj.mjs.map → migrate-DrO2p9Rl.mjs.map} +1 -1
  91. package/dist/openapi.cjs +16 -6
  92. package/dist/openapi.cjs.map +1 -1
  93. package/dist/openapi.d.cts +1 -1
  94. package/dist/openapi.d.cts.map +1 -1
  95. package/dist/openapi.d.mts +1 -1
  96. package/dist/openapi.d.mts.map +1 -1
  97. package/dist/openapi.mjs +16 -6
  98. package/dist/openapi.mjs.map +1 -1
  99. package/dist/reconcile/public.d.cts +1 -1
  100. package/dist/reconcile/public.d.mts +1 -1
  101. package/dist/{resolve-DZNx7rLy.mjs → resolve-C1muFos5.mjs} +3 -3
  102. package/dist/{resolve-DZNx7rLy.mjs.map → resolve-C1muFos5.mjs.map} +1 -1
  103. package/dist/{resolve-fevXn-wZ.cjs → resolve-Fa1Ii0BK.cjs} +3 -3
  104. package/dist/{resolve-fevXn-wZ.cjs.map → resolve-Fa1Ii0BK.cjs.map} +1 -1
  105. package/dist/{rollback-Dw-FW3X2.cjs → rollback-C9N5lKVf.cjs} +5 -5
  106. package/dist/{rollback-Dw-FW3X2.cjs.map → rollback-C9N5lKVf.cjs.map} +1 -1
  107. package/dist/{rollback-CLi5Pln_.mjs → rollback-DeQzbRqM.mjs} +5 -5
  108. package/dist/{rollback-CLi5Pln_.mjs.map → rollback-DeQzbRqM.mjs.map} +1 -1
  109. package/dist/{runtime-BzZD5HHi.d.cts → runtime-BSvzPqXW.d.mts} +2 -2
  110. package/dist/{runtime-BzZD5HHi.d.cts.map → runtime-BSvzPqXW.d.mts.map} +1 -1
  111. package/dist/{runtime-Cm6J6L7n.d.mts → runtime-Cm7QA53H.d.cts} +2 -2
  112. package/dist/{runtime-Cm6J6L7n.d.mts.map → runtime-Cm7QA53H.d.cts.map} +1 -1
  113. package/dist/secretsManager-DUXW3fQt.cjs +70 -0
  114. package/dist/secretsManager-DUXW3fQt.cjs.map +1 -0
  115. package/dist/secretsManager-Ti0oZwsS.mjs +70 -0
  116. package/dist/secretsManager-Ti0oZwsS.mjs.map +1 -0
  117. package/dist/{sniffer-BmCvVyhq.mjs → sniffer-DR8AlRCk.mjs} +17 -17
  118. package/dist/sniffer-DR8AlRCk.mjs.map +1 -0
  119. package/dist/{sniffer-bMzrX4cO.cjs → sniffer-Y6GQOCXB.cjs} +17 -17
  120. package/dist/sniffer-Y6GQOCXB.cjs.map +1 -0
  121. package/dist/{state-kA4Fkufx.cjs → state-C2qi0iQw.cjs} +187 -24
  122. package/dist/state-C2qi0iQw.cjs.map +1 -0
  123. package/dist/{state-BrWIOce_.mjs → state-CUecOCNJ.mjs} +170 -25
  124. package/dist/state-CUecOCNJ.mjs.map +1 -0
  125. package/dist/target/public.cjs +1 -1
  126. package/dist/target/public.d.cts +2 -2
  127. package/dist/target/public.d.mts +2 -2
  128. package/dist/target/public.mjs +1 -1
  129. package/dist/{types-TzCChNrA.d.cts → types-BdptGBFS.d.cts} +59 -6
  130. package/dist/types-BdptGBFS.d.cts.map +1 -0
  131. package/dist/{types-Dp9lgx_S.d.mts → types-OxE0OAn2.d.mts} +59 -6
  132. package/dist/types-OxE0OAn2.d.mts.map +1 -0
  133. package/dist/workspace/index.cjs +1 -1
  134. package/dist/workspace/index.d.cts +2 -2
  135. package/dist/workspace/index.d.mts +2 -2
  136. package/dist/workspace/index.mjs +1 -1
  137. package/dist/{workspace-vdrcRI-m.cjs → workspace-DOm81oUo.cjs} +54 -1
  138. package/dist/workspace-DOm81oUo.cjs.map +1 -0
  139. package/dist/{workspace-C7NqCsQF.mjs → workspace-QUTqYmVy.mjs} +43 -2
  140. package/dist/workspace-QUTqYmVy.mjs.map +1 -0
  141. package/package.json +16 -15
  142. package/dist/aws-DkHdTV-p.cjs.map +0 -1
  143. package/dist/aws-DojzQnLd.mjs.map +0 -1
  144. package/dist/bundler-_8AEZhrs.cjs.map +0 -1
  145. package/dist/bundler-xjp5RwRS.mjs.map +0 -1
  146. package/dist/compose-DdH2JQJD.mjs.map +0 -1
  147. package/dist/compose-UKyv_1yU.cjs.map +0 -1
  148. package/dist/github-BGdJ-Lnm.cjs.map +0 -1
  149. package/dist/github-BNngHoId.mjs.map +0 -1
  150. package/dist/sniffer-BmCvVyhq.mjs.map +0 -1
  151. package/dist/sniffer-bMzrX4cO.cjs.map +0 -1
  152. package/dist/state-BrWIOce_.mjs.map +0 -1
  153. package/dist/state-kA4Fkufx.cjs.map +0 -1
  154. package/dist/types-Dp9lgx_S.d.mts.map +0 -1
  155. package/dist/types-TzCChNrA.d.cts.map +0 -1
  156. package/dist/workspace-C7NqCsQF.mjs.map +0 -1
  157. package/dist/workspace-vdrcRI-m.cjs.map +0 -1
@@ -2,10 +2,10 @@ const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
2
2
  const require_run = require("./run-fVZ-rLnc.cjs");
3
3
  const require_discover = require("./discover-D1It5r_h.cjs");
4
4
  const require_derive = require("./derive-DAbo49sm.cjs");
5
- const require_workspace = require("./workspace-vdrcRI-m.cjs");
5
+ const require_workspace = require("./workspace-DOm81oUo.cjs");
6
6
  const require_config = require("./config.cjs");
7
7
  const require_EndpointGenerator = require("./EndpointGenerator-CP6sBvQV.cjs");
8
- const require_resolve = require("./resolve-fevXn-wZ.cjs");
8
+ const require_resolve = require("./resolve-Fa1Ii0BK.cjs");
9
9
  const require_SubscriberGenerator = require("./SubscriberGenerator-CajwOa5W.cjs");
10
10
  let node_path = require("node:path");
11
11
  let node_fs = require("node:fs");
@@ -529,7 +529,8 @@ function decrypt(data, keyHex) {
529
529
  var store_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
530
530
  FileSecretsStore: () => FileSecretsStore,
531
531
  isRemoteStore: () => isRemoteStore,
532
- secretsStoreFor: () => secretsStoreFor
532
+ secretsStoreFor: () => secretsStoreFor,
533
+ storeFromConfig: () => storeFromConfig
533
534
  });
534
535
  /**
535
536
  * The store a stage's secrets are kept in — what every command reads and
@@ -541,13 +542,41 @@ var store_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
541
542
  async function secretsStoreFor(workspace, stage, options = {}) {
542
543
  const configured = workspace.secrets.store ?? "file";
543
544
  if (stage === workspace.stages.local || configured === "file") return new FileSecretsStore(workspace.root, keystoreProject(workspace, options.home));
544
- if (configured.provider !== "ssm") return configured.provider;
545
- const { AwsSecretsStore } = await Promise.resolve().then(() => require("./aws-DkHdTV-p.cjs"));
546
- return new AwsSecretsStore({
547
- project: workspace.name,
548
- region: configured.region,
549
- ...options.profile ? { profile: options.profile } : {}
550
- });
545
+ return storeFromConfig(workspace, configured, options);
546
+ }
547
+ /**
548
+ * The store a `secrets.store` value describes, for any stage — what
549
+ * {@link secretsStoreFor} answers for a deployed stage, and what
550
+ * `gkm secrets:migrate` builds for the store it copies to.
551
+ */
552
+ async function storeFromConfig(workspace, config, options = {}) {
553
+ if (config === "file") return new FileSecretsStore(workspace.root, keystoreProject(workspace, options.home));
554
+ const profile = options.profile ? { profile: options.profile } : {};
555
+ switch (config.provider) {
556
+ case "ssm": {
557
+ const { AwsSecretsStore } = await Promise.resolve().then(() => require("./aws-CQAuluiu.cjs"));
558
+ return new AwsSecretsStore({
559
+ project: workspace.name,
560
+ region: config.region,
561
+ ...profile
562
+ });
563
+ }
564
+ case "secrets-manager": {
565
+ const { kmsKeyId } = config;
566
+ const { SecretsManagerSecretsStore } = await Promise.resolve().then(() => require("./secretsManager-DUXW3fQt.cjs"));
567
+ return new SecretsManagerSecretsStore({
568
+ project: workspace.name,
569
+ region: config.region,
570
+ ...kmsKeyId ? { kmsKeyId } : {},
571
+ ...profile
572
+ });
573
+ }
574
+ default: {
575
+ const provider = config.provider;
576
+ if (typeof provider === "object" && provider !== null) return provider;
577
+ throw new require_workspace.UnknownSecretsStoreProvider(provider);
578
+ }
579
+ }
551
580
  }
552
581
  /** Whether a stage's secrets live somewhere other than this machine. */
553
582
  function isRemoteStore(workspace, stage) {
@@ -1024,6 +1053,36 @@ function eventsBackendFor(on) {
1024
1053
  return require_SubscriberGenerator.DEFAULT_EVENTS[on];
1025
1054
  }
1026
1055
  //#endregion
1056
+ //#region src/exec/imageBuild.ts
1057
+ /**
1058
+ * Set by a site's Dockerfile in its builder stage: this process is building
1059
+ * an image.
1060
+ *
1061
+ * Inside an image there is no stage to load secrets for and no local
1062
+ * container to resolve an address from — the public URLs the bundle inlines
1063
+ * arrived as the Dockerfile's build args, already in the environment. So
1064
+ * `gkm exec -- next build` there injects exactly those, and never the
1065
+ * `localhost` addresses a workspace resolves on a developer's machine.
1066
+ */
1067
+ const IMAGE_BUILD_ENV = "GKM_IMAGE_BUILD";
1068
+ /** Whether this process is building an image. */
1069
+ function isImageBuild(env = process.env) {
1070
+ return env[IMAGE_BUILD_ENV] === "1";
1071
+ }
1072
+ /**
1073
+ * What `gkm exec` injects inside an image build: the public values its build
1074
+ * args set — every `NEXT_PUBLIC_*`, `VITE_*` and `EXPO_PUBLIC_*` — and
1075
+ * nothing read from a secrets store, a file or a container.
1076
+ */
1077
+ function imageBuildCredentials(env = process.env) {
1078
+ const credentials = {};
1079
+ for (const [key, value] of Object.entries(env)) {
1080
+ if (value === void 0) continue;
1081
+ if (require_workspace.PUBLIC_ENV_PREFIXES.some((prefix) => key.startsWith(prefix))) credentials[key] = value;
1082
+ }
1083
+ return credentials;
1084
+ }
1085
+ //#endregion
1027
1086
  //#region src/docker/templates.ts
1028
1087
  /**
1029
1088
  * The turbo every image prunes and builds with when the build root resolves
@@ -1321,7 +1380,48 @@ function binPath(options) {
1321
1380
  * were installed.
1322
1381
  */
1323
1382
  function gkmCommand(args) {
1324
- return `GKM_BIN="$(node -e '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)}')" && node "$GKM_BIN" ${args}`;
1383
+ return `GKM_BIN="$(node -e '${FIND_GKM_BIN}')" && node "$GKM_BIN" ${args}`;
1384
+ }
1385
+ /** Prints the `bin/gkm.mjs` Node resolves from the cwd, or fails saying so. */
1386
+ 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)}`;
1387
+ /**
1388
+ * What a site's builder does with the gkm workspace it carries, before its
1389
+ * framework builds it — all of it inside the image, nothing from the host:
1390
+ *
1391
+ * - `gkm` on the PATH: the CLI the workspace installs, so a build script that
1392
+ * is `gkm exec -- next build` runs. Resolved from the gkm root rather than
1393
+ * through `node_modules/.bin`, where a CLI that is a workspace package has
1394
+ * no bin linked.
1395
+ * - `GKM_IMAGE_BUILD`, which has `gkm exec` inject the build args above — the
1396
+ * stage's public URLs — and never load a secret or resolve a local address.
1397
+ * - each backend's typed client, generated from its endpoints at the
1398
+ * workspace root's `.gkm/client/`, where the site's tsconfig paths point.
1399
+ */
1400
+ function siteWorkspaceSteps(options) {
1401
+ const { gkmRoot } = layout(options);
1402
+ const root = `/app/${gkmRoot}`.replace(/\/\.$/, "");
1403
+ const clients = options.clients ?? [];
1404
+ const generate = clients.length ? `
1405
+
1406
+ # The typed client of each API this site calls, generated from its endpoints
1407
+ # into ${gkmRoot === "." ? "" : `${gkmRoot}/`}.gkm/client/ — offline, with no secret and no container.
1408
+ RUN ${clients.map(({ app, path }) => `cd /app/${path} && gkm openapi --app ${app}`).join(" && \\\n ")}` : "";
1409
+ return `# The gkm CLI the workspace installs, as \`gkm\`
1410
+ RUN cd ${root} && GKM_BIN="$(node -e '${FIND_GKM_BIN}')" && \\
1411
+ { echo '#!/bin/sh'; echo "exec node \\"$GKM_BIN\\" \\"\\$@\\""; } > /usr/local/bin/gkm && \\
1412
+ chmod +x /usr/local/bin/gkm
1413
+
1414
+ # \`gkm exec\` in this build injects the build args, never a stage's secrets
1415
+ ENV ${IMAGE_BUILD_ENV}=1${generate}`;
1416
+ }
1417
+ /**
1418
+ * Build the site with turbo. Loose env mode, so the task sees what the
1419
+ * Dockerfile set — the build args and `GKM_IMAGE_BUILD` — whatever the
1420
+ * project's turbo.json declares: the image's environment holds nothing else.
1421
+ */
1422
+ function siteBuild(options) {
1423
+ const { turbo } = layout(options);
1424
+ return `RUN ${turbo} run build --filter='${options.turboPackage}' --env-mode=loose`;
1325
1425
  }
1326
1426
  /**
1327
1427
  * The encrypted credentials, from a build secret — never an ARG, which is
@@ -1475,8 +1575,7 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \\
1475
1575
  * @internal Exported for testing
1476
1576
  */
1477
1577
  function generateNextjsDockerfile(options) {
1478
- const { port, appPath, turboPackage, publicUrlArgs = ["NEXT_PUBLIC_API_URL", "NEXT_PUBLIC_AUTH_URL"] } = options;
1479
- const { turbo } = layout(options);
1578
+ const { port, appPath, publicUrlArgs = ["NEXT_PUBLIC_API_URL", "NEXT_PUBLIC_AUTH_URL"] } = options;
1480
1579
  return `# syntax=docker/dockerfile:1
1481
1580
  # Next.js standalone Dockerfile, built from a turbo-pruned slice
1482
1581
 
@@ -1486,13 +1585,15 @@ ${depsStage(options)}
1486
1585
 
1487
1586
  ${builderStage(options, { args: publicUrlArgs })}
1488
1587
 
1588
+ ${siteWorkspaceSteps(options)}
1589
+
1489
1590
  # Ensure public directory exists (may be empty for scaffolded projects)
1490
1591
  RUN mkdir -p ${appPath}/public
1491
1592
 
1492
1593
  ENV NEXT_TELEMETRY_DISABLED=1
1493
1594
 
1494
1595
  # Build the application
1495
- RUN ${turbo} run build --filter='${turboPackage}'
1596
+ ${siteBuild(options)}
1496
1597
 
1497
1598
  # The runner needs the standalone server; without it there is nothing to run.
1498
1599
  RUN if [ ! -d ${appPath}/.next/standalone ]; then \\
@@ -1680,8 +1781,7 @@ CMD ["node", "index.mjs"]
1680
1781
  * @internal Exported for testing
1681
1782
  */
1682
1783
  function generateNodeWebDockerfile(options) {
1683
- const { port, appPath, turboPackage } = options;
1684
- const { turbo } = layout(options);
1784
+ const { port, appPath } = options;
1685
1785
  return `# syntax=docker/dockerfile:1
1686
1786
  # Node SSR web Dockerfile (TanStack Start / Remix), from a turbo-pruned slice
1687
1787
 
@@ -1690,7 +1790,10 @@ ${prunerStage(options)}
1690
1790
  ${depsStage(options)}
1691
1791
 
1692
1792
  ${builderStage(options, { args: options.publicUrlArgs ?? [] })}
1693
- RUN ${turbo} run build --filter='${turboPackage}'
1793
+
1794
+ ${siteWorkspaceSteps(options)}
1795
+
1796
+ ${siteBuild(options)}
1694
1797
 
1695
1798
  FROM ${options.baseImage} AS runner
1696
1799
  WORKDIR /app
@@ -1724,8 +1827,7 @@ CMD ["sh", "-c", "cd ${appPath} && npm start"]
1724
1827
  * @internal Exported for testing
1725
1828
  */
1726
1829
  function generateViteStaticDockerfile(options) {
1727
- const { port, appPath, turboPackage } = options;
1728
- const { turbo } = layout(options);
1830
+ const { port, appPath } = options;
1729
1831
  return `# syntax=docker/dockerfile:1
1730
1832
  # Vite SPA Dockerfile — a turbo-pruned slice built to static files, served by Caddy
1731
1833
 
@@ -1734,7 +1836,10 @@ ${prunerStage(options)}
1734
1836
  ${depsStage(options)}
1735
1837
 
1736
1838
  ${builderStage(options, { args: options.publicUrlArgs ?? [] })}
1737
- RUN ${turbo} run build --filter='${turboPackage}'
1839
+
1840
+ ${siteWorkspaceSteps(options)}
1841
+
1842
+ ${siteBuild(options)}
1738
1843
 
1739
1844
  FROM ${STATIC_SITE_IMAGE} AS runner
1740
1845
 
@@ -1843,7 +1948,7 @@ function fromBuildRoot(layout, path) {
1843
1948
  return joined === "" ? "." : joined;
1844
1949
  }
1845
1950
  /** Everything a template needs about one app, relative to the build root. */
1846
- function appImageOptions(layout, appName, app, workspaceRoot) {
1951
+ function appImageOptions(layout, appName, app, workspaceRoot, apps = {}) {
1847
1952
  const turboPackage = packageName((0, node_path.isAbsolute)(app.path) ? app.path : (0, node_path.join)(workspaceRoot, app.path)) ?? appName;
1848
1953
  return {
1849
1954
  imageName: appName,
@@ -1859,10 +1964,49 @@ function appImageOptions(layout, appName, app, workspaceRoot) {
1859
1964
  ...app.type === "backend" ? {
1860
1965
  gkmPaths: layout.gkmPaths,
1861
1966
  ...layout.workspacePackage && layout.workspacePackage !== turboPackage ? { prunePackages: [layout.workspacePackage] } : {}
1862
- } : {}
1967
+ } : app.type === "web" ? siteWorkspace(layout, app, apps, workspaceRoot, turboPackage) : {}
1968
+ };
1969
+ }
1970
+ /**
1971
+ * What a site's image carries of the gkm workspace: its config and construct
1972
+ * directories, the workspace's own package where it is nested in a monorepo
1973
+ * (it holds the CLI), and each backend the site calls — whose endpoints its
1974
+ * client is generated from, and whose package their imports resolve in.
1975
+ */
1976
+ function siteWorkspace(layout, site, apps, workspaceRoot, turboPackage) {
1977
+ const clients = siteClients(site, apps);
1978
+ const packages = /* @__PURE__ */ new Set();
1979
+ if (layout.workspacePackage) packages.add(layout.workspacePackage);
1980
+ for (const { app } of clients) {
1981
+ const backend = apps[app];
1982
+ const name = packageName((0, node_path.isAbsolute)(backend.path) ? backend.path : (0, node_path.join)(workspaceRoot, backend.path));
1983
+ if (name) packages.add(name);
1984
+ }
1985
+ packages.delete(turboPackage);
1986
+ return {
1987
+ gkmPaths: layout.gkmPaths,
1988
+ ...packages.size > 0 ? { prunePackages: [...packages].sort() } : {},
1989
+ ...clients.length > 0 ? { clients: clients.map(({ app }) => ({
1990
+ app,
1991
+ path: fromBuildRoot(layout, apps[app].path)
1992
+ })) } : {}
1863
1993
  };
1864
1994
  }
1865
1995
  /**
1996
+ * The backends whose clients a site imports: each it depends on that gkm
1997
+ * builds from endpoints — not one with an entry of its own, and not one that
1998
+ * turned OpenAPI off.
1999
+ */
2000
+ function siteClients(site, apps) {
2001
+ return site.dependencies.filter((name) => {
2002
+ const app = apps[name];
2003
+ if (!app || app.type !== "backend" || app.entry) return false;
2004
+ if (app.openapi === false) return false;
2005
+ if (typeof app.openapi === "object" && app.openapi.enabled === false) return false;
2006
+ return true;
2007
+ }).sort().map((app) => ({ app }));
2008
+ }
2009
+ /**
1866
2010
  * The directories the workspace's construct globs start in, relative to its
1867
2011
  * root: `./constructs/**\/*.ts` reads from `constructs`.
1868
2012
  */
@@ -5885,6 +6029,7 @@ async function workspaceDockerCommand(workspace, manifest, imageNames = {}, back
5885
6029
  const dockerfile = appDockerfile(appName, app, {
5886
6030
  layout,
5887
6031
  workspaceRoot: workspace.root,
6032
+ apps: workspace.apps,
5888
6033
  ...manifest ? { manifest } : {}
5889
6034
  });
5890
6035
  const path = dockerfileOf(appName, app.path);
@@ -5940,7 +6085,7 @@ async function workspaceDockerCommand(workspace, manifest, imageNames = {}, back
5940
6085
  * framework. The one choice every builder of images makes.
5941
6086
  */
5942
6087
  function appDockerfile(appName, app, options) {
5943
- const image = appImageOptions(options.layout, appName, app, options.workspaceRoot);
6088
+ const image = appImageOptions(options.layout, appName, app, options.workspaceRoot, options.apps);
5944
6089
  if (app.type === "web") return siteDockerfile(appName, app, {
5945
6090
  image,
5946
6091
  ...options.manifest ? { manifest: options.manifest } : {},
@@ -6684,6 +6829,12 @@ Object.defineProperty(exports, "hostFor", {
6684
6829
  return hostFor;
6685
6830
  }
6686
6831
  });
6832
+ Object.defineProperty(exports, "imageBuildCredentials", {
6833
+ enumerable: true,
6834
+ get: function() {
6835
+ return imageBuildCredentials;
6836
+ }
6837
+ });
6687
6838
  Object.defineProperty(exports, "imageLayout", {
6688
6839
  enumerable: true,
6689
6840
  get: function() {
@@ -6714,6 +6865,12 @@ Object.defineProperty(exports, "isDnsVerified", {
6714
6865
  return isDnsVerified;
6715
6866
  }
6716
6867
  });
6868
+ Object.defineProperty(exports, "isImageBuild", {
6869
+ enumerable: true,
6870
+ get: function() {
6871
+ return isImageBuild;
6872
+ }
6873
+ });
6717
6874
  Object.defineProperty(exports, "isMainFrontendApp", {
6718
6875
  enumerable: true,
6719
6876
  get: function() {
@@ -6978,6 +7135,12 @@ Object.defineProperty(exports, "storage_exports", {
6978
7135
  return storage_exports;
6979
7136
  }
6980
7137
  });
7138
+ Object.defineProperty(exports, "storeFromConfig", {
7139
+ enumerable: true,
7140
+ get: function() {
7141
+ return storeFromConfig;
7142
+ }
7143
+ });
6981
7144
  Object.defineProperty(exports, "store_exports", {
6982
7145
  enumerable: true,
6983
7146
  get: function() {
@@ -7057,4 +7220,4 @@ Object.defineProperty(exports, "workspace_exports", {
7057
7220
  }
7058
7221
  });
7059
7222
 
7060
- //# sourceMappingURL=state-kA4Fkufx.cjs.map
7223
+ //# sourceMappingURL=state-C2qi0iQw.cjs.map