@m-kopa/launchpad-cli 0.66.0 → 0.67.0
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/CHANGELOG.md +10 -0
- package/dist/bundle/upload.d.ts +4 -0
- package/dist/bundle/upload.d.ts.map +1 -1
- package/dist/cli.js +269 -66
- package/dist/commands/deploy.d.ts +15 -4
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/migrate.d.ts +15 -0
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/status.d.ts +14 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/manifest/migrate-dispatch.d.ts +7 -3
- package/dist/manifest/migrate-dispatch.d.ts.map +1 -1
- package/dist/manifest/wrangler-config.d.ts +9 -2
- package/dist/manifest/wrangler-config.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/skills/launchpad-content-pr/SKILL.md +130 -50
- package/skills/launchpad-deploy/SKILL.md +7 -4
- package/skills/launchpad-deploy-status/SKILL.md +1 -1
- package/skills/launchpad-destroy/SKILL.md +1 -1
- package/skills/launchpad-identity/SKILL.md +125 -39
- package/skills/launchpad-onboard/SKILL.md +3 -2
- package/skills/launchpad-report/SKILL.md +1 -1
- package/skills/launchpad-status/SKILL.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,12 +6,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
6
6
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html);
|
|
7
7
|
pre-1.0 minor bumps may carry breaking changes per ADR 0005.
|
|
8
8
|
|
|
9
|
+
## 0.67.0 - 2026-10-05
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- `launchpad deploy`: a new app that cannot convert to Workers dispatch now stops before provisioning with the reason, instead of quietly deploying to Pages. Fix the named setting, or set `origin: pages` (v1) / `spec.origin: pages` (v2) to choose Pages on purpose. Registered apps and explicit origins are unchanged; if the registry can't be read, an app that can't convert deploys on Pages with a warning.
|
|
14
|
+
- `launchpad migrate` and first-deploy conversion carry plain wrangler `[vars]` into `spec.env_vars` as plain-text env vars. Vars named like platform env (`GATEWAY_*`, `CF_ACCESS_*`, `JWKS_URL`), `*_TOKEN` / `*_SECRET` names, the D1 binding, or a different-valued manifest env var are refused by name. Other credential-looking names carry over with a warning.
|
|
15
|
+
- The `launchpad-content-pr` and `launchpad-identity` skills now cover Workers dispatch apps first, with Pages as the legacy path: how to tell which origin an app is on, how dispatch delivery is verified, that dispatch secrets are live on push, and the dispatch rules for API functions.
|
|
16
|
+
|
|
9
17
|
## 0.66.0 - 2026-10-04
|
|
10
18
|
|
|
11
19
|
### Added
|
|
12
20
|
|
|
13
21
|
- Container apps can sign in through the Entra auth gateway with `auth: gateway` (AIO-811, ADR 0057). `validate` and `plan` accept it, and a gateway container app uses no Cloudflare Access app or Zero Trust seat.
|
|
14
22
|
- The platform now operates a one-minute, platform-owned health sweep against live container apps, default-off behind a kill-switch and shipped with no manifest, CLI, or `launchpad.yaml` changes (AIO-269). The sweep authenticates as a dedicated Cloudflare Access service token the platform team provisions and rotates — see `docs/runbooks/container-health-monitoring.md`. App authors take no action; this note exists only so the new, platform-operated probe traffic to the generated Worker's `/__platform/health/container` route and the platform-level Access policy addition on each container app's custom-hostname application are documented, not undocumented infrastructure. See `docs/concepts/containers.md` for a short pointer.
|
|
23
|
+
- A second `launchpad deploy` of a live container app now runs as a bot-run container redeploy (regenerated platform files, commit, run authorization and verification) and prints `Container redeploy started` (AIO-811).
|
|
24
|
+
- `launchpad status` shows the latest container content-redeploy outcome (running, failed with stage and reason, or verified) as one line, and as `containerRedeploy` in `--json` (AIO-811).
|
|
15
25
|
|
|
16
26
|
### Changed
|
|
17
27
|
|
package/dist/bundle/upload.d.ts
CHANGED
|
@@ -92,6 +92,10 @@ export interface DeployBundleProvisioningStarted {
|
|
|
92
92
|
readonly appType: string;
|
|
93
93
|
readonly message: string;
|
|
94
94
|
readonly statusPageUrl?: string | null;
|
|
95
|
+
/** AIO-811: set for a content redeploy of a LIVE container app (no first-deploy flow). */
|
|
96
|
+
readonly mode?: "container_redeploy";
|
|
97
|
+
/** AIO-811: the app's original submission id (what `launchpad status` reads). */
|
|
98
|
+
readonly statusSubmissionId?: string;
|
|
95
99
|
}
|
|
96
100
|
/** Any success shape (202 accepted / 202 provisioning / 200 no-op). */
|
|
97
101
|
export type DeployBundleSuccess = DeployBundleAccepted | DeployBundleProvisioningStarted | DeployBundleNothingToDeploy;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/bundle/upload.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD,eAAO,MAAM,6BAA6B,kCACT,CAAC;AAClC,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAE3D,MAAM,MAAM,oBAAoB,GAC5B,UAAU,GACV,WAAW,GACX,SAAS,GACT,SAAS,GACT,SAAS,CAAC;AAEd,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,kEAAkE;AAClE,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC;CAC/B;AAgBD;;;oCAGoC;AACpC,MAAM,WAAW,yBAAyB;IACx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GAAG,IAAI,CAAC;CACxC;AAED,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,mBAAmB,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,iBAAiB,CAAA;CAAE,CAAC;AAEnE;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,UAAU,EACvB,cAAc,CAAC,EAAE,cAAc;AAC/B;gEACgE;AAChE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;AACvB;0EAC0E;AAC1E,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI;AAC7B,+EAA+E;AAC/E,cAAc,GAAE,OAAe,GAC9B,OAAO,CAAC,kBAAkB,CAAC,CA+H7B"}
|
package/dist/cli.js
CHANGED
|
@@ -19,7 +19,7 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
19
19
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
20
20
|
|
|
21
21
|
// src/version.ts
|
|
22
|
-
var CLI_VERSION = "0.
|
|
22
|
+
var CLI_VERSION = "0.67.0";
|
|
23
23
|
|
|
24
24
|
// src/config.ts
|
|
25
25
|
import { readFileSync } from "node:fs";
|
|
@@ -3829,7 +3829,7 @@ function emit(capability) {
|
|
|
3829
3829
|
const isGateway = capability.authMode === "gateway";
|
|
3830
3830
|
const environmentFields = capability.environmentNames.map((name) => ` ${name}: string;`);
|
|
3831
3831
|
const environmentValues = capability.environmentNames.map((name) => ` ${name}: this.env.${name} ?? "",`);
|
|
3832
|
-
const envAuthFields = isGateway ? [" GATEWAY_ISSUER: string;", " GATEWAY_AUD: string;", " GATEWAY_JWKS_URL: string;"] : [" CF_ACCESS_AUD: string;", " CF_ACCESS_TEAM_DOMAIN: string;"];
|
|
3832
|
+
const envAuthFields = isGateway ? [" GATEWAY_ISSUER: string;", " GATEWAY_AUD: string;", " GATEWAY_JWKS_URL: string;", " GATEWAY_JWKS_JSON?: string;"] : [" CF_ACCESS_AUD: string;", " CF_ACCESS_TEAM_DOMAIN: string;"];
|
|
3833
3833
|
const monitorEnvField = isGateway ? [" MONITOR_SHARED_SECRET: string;"] : [];
|
|
3834
3834
|
const lines = [
|
|
3835
3835
|
"/**",
|
|
@@ -3864,10 +3864,44 @@ function emit(capability) {
|
|
|
3864
3864
|
"",
|
|
3865
3865
|
"let jwksCache: ReturnType<typeof createJwksCache> | null = null;",
|
|
3866
3866
|
"",
|
|
3867
|
+
...isGateway ? [
|
|
3868
|
+
"/**",
|
|
3869
|
+
" * AIO-811 / ADR 0057 amendment 2: this Worker runs inside the chain",
|
|
3870
|
+
" * gateway -> router -> container Worker, so a live fetch of the",
|
|
3871
|
+
" * gateway's own JWKS URL is a subrequest back to the originating",
|
|
3872
|
+
" * gateway and Cloudflare loop protection can reject it. Try the live",
|
|
3873
|
+
" * fetch first; on a throw or non-2xx fall back to the deploy-time",
|
|
3874
|
+
" * snapshot (GATEWAY_JWKS_JSON). With no snapshot the original failure",
|
|
3875
|
+
" * is surfaced so verification still fails closed.",
|
|
3876
|
+
" */",
|
|
3877
|
+
"async function jwksFetch(",
|
|
3878
|
+
" env: Env,",
|
|
3879
|
+
" input: Parameters<typeof fetch>[0],",
|
|
3880
|
+
" init?: Parameters<typeof fetch>[1],",
|
|
3881
|
+
"): Promise<Response> {",
|
|
3882
|
+
" let failure: unknown;",
|
|
3883
|
+
" try {",
|
|
3884
|
+
" const live = await fetch(input, init);",
|
|
3885
|
+
" if (live.ok) return live;",
|
|
3886
|
+
" failure = live;",
|
|
3887
|
+
" } catch (error) {",
|
|
3888
|
+
" failure = error;",
|
|
3889
|
+
" }",
|
|
3890
|
+
' if (typeof env.GATEWAY_JWKS_JSON === "string" && env.GATEWAY_JWKS_JSON.length > 0) {',
|
|
3891
|
+
" return new Response(env.GATEWAY_JWKS_JSON, {",
|
|
3892
|
+
' headers: { "content-type": "application/json" },',
|
|
3893
|
+
" });",
|
|
3894
|
+
" }",
|
|
3895
|
+
" if (failure instanceof Response) return failure;",
|
|
3896
|
+
" throw failure;",
|
|
3897
|
+
"}",
|
|
3898
|
+
""
|
|
3899
|
+
] : [],
|
|
3867
3900
|
"function jwks(env: Env): ReturnType<typeof createJwksCache> {",
|
|
3868
3901
|
" if (jwksCache === null) {",
|
|
3869
3902
|
" jwksCache = createJwksCache(",
|
|
3870
3903
|
isGateway ? " env.GATEWAY_JWKS_URL," : " `https://${env.CF_ACCESS_TEAM_DOMAIN}/cdn-cgi/access/certs`,",
|
|
3904
|
+
...isGateway ? [" { fetchFn: (input, init) => jwksFetch(env, input, init) },"] : [],
|
|
3871
3905
|
" );",
|
|
3872
3906
|
" }",
|
|
3873
3907
|
" return jwksCache;",
|
|
@@ -4425,6 +4459,11 @@ function emit3(capability) {
|
|
|
4425
4459
|
...secretNames(capability).map((name) => ` ${name}: \${{ secrets.${name} }}`),
|
|
4426
4460
|
" run: |",
|
|
4427
4461
|
" set -euo pipefail",
|
|
4462
|
+
...isGateway ? [
|
|
4463
|
+
' GATEWAY_JWKS_JSON="$(curl -fsS --max-time 20 "$GATEWAY_JWKS_URL")"',
|
|
4464
|
+
` printf '%s' "$GATEWAY_JWKS_JSON" | jq -e '.keys | length > 0' > /dev/null`,
|
|
4465
|
+
" export GATEWAY_JWKS_JSON"
|
|
4466
|
+
] : [],
|
|
4428
4467
|
' secrets_file="$(mktemp "${RUNNER_TEMP}/launchpad-secrets.XXXXXX")"',
|
|
4429
4468
|
` trap 'rm -f "$secrets_file"' EXIT`,
|
|
4430
4469
|
` jq -n '${secretsJqFilter(capability)}' > "$secrets_file"`,
|
|
@@ -4443,7 +4482,8 @@ function secretNames(capability) {
|
|
|
4443
4482
|
return capability.authMode === "gateway" ? ["BINDINGS_PROXY_SECRET", "MONITOR_SHARED_SECRET", ...capability.environmentNames] : ["BINDINGS_PROXY_SECRET", ...capability.environmentNames];
|
|
4444
4483
|
}
|
|
4445
4484
|
function secretsJqFilter(capability) {
|
|
4446
|
-
|
|
4485
|
+
const names = capability.authMode === "gateway" ? [...secretNames(capability), "GATEWAY_JWKS_JSON"] : secretNames(capability);
|
|
4486
|
+
return `{${names.map((name) => `${name}: env.${name}`).join(", ")}}`;
|
|
4447
4487
|
}
|
|
4448
4488
|
// ../launchpad-engine/dist/per-app-lock.js
|
|
4449
4489
|
var PER_APP_LOCK_HCL = `# This file is maintained automatically by "terraform init".
|
|
@@ -6306,7 +6346,7 @@ async function runStatus(args, io) {
|
|
|
6306
6346
|
};
|
|
6307
6347
|
}
|
|
6308
6348
|
}
|
|
6309
|
-
emit4(output, parsed.json, io);
|
|
6349
|
+
emit4(output, parsed.json, io, lifecycle?.containerRedeploy);
|
|
6310
6350
|
return 0;
|
|
6311
6351
|
}
|
|
6312
6352
|
let localYaml = null;
|
|
@@ -6383,7 +6423,7 @@ async function runStatus(args, io) {
|
|
|
6383
6423
|
}),
|
|
6384
6424
|
...lifecycle?.statusPageUrl !== undefined ? { statusPageUrl: lifecycle.statusPageUrl } : {}
|
|
6385
6425
|
};
|
|
6386
|
-
emit4(out, parsed.json, io);
|
|
6426
|
+
emit4(out, parsed.json, io, lifecycle?.containerRedeploy);
|
|
6387
6427
|
return 0;
|
|
6388
6428
|
}
|
|
6389
6429
|
if (local === null) {
|
|
@@ -6400,7 +6440,7 @@ async function runStatus(args, io) {
|
|
|
6400
6440
|
}),
|
|
6401
6441
|
...lifecycle?.statusPageUrl !== undefined ? { statusPageUrl: lifecycle.statusPageUrl } : {}
|
|
6402
6442
|
};
|
|
6403
|
-
emit4(out, parsed.json, io);
|
|
6443
|
+
emit4(out, parsed.json, io, lifecycle?.containerRedeploy);
|
|
6404
6444
|
if (parsed.strict) {
|
|
6405
6445
|
if (deployment?.liveDeployment?.buildStatus === "failure" || deployment?.v2?.state === "refused") {
|
|
6406
6446
|
io.err(`launchpad status: --strict: live build FAILED ` + `(drift not evaluated — no local launchpad.yaml here).`);
|
|
@@ -6438,7 +6478,7 @@ async function runStatus(args, io) {
|
|
|
6438
6478
|
...standingExceptions !== null ? { standingExceptions } : {}
|
|
6439
6479
|
})
|
|
6440
6480
|
};
|
|
6441
|
-
emit4(out, parsed.json, io);
|
|
6481
|
+
emit4(out, parsed.json, io, lifecycle?.containerRedeploy);
|
|
6442
6482
|
return 0;
|
|
6443
6483
|
}
|
|
6444
6484
|
const localGroups = await resolveStatusGroups({
|
|
@@ -6501,7 +6541,7 @@ async function runStatus(args, io) {
|
|
|
6501
6541
|
...groupIssues.length === 0 ? {} : { groupIssues },
|
|
6502
6542
|
...lifecycle?.statusPageUrl !== undefined ? { statusPageUrl: lifecycle.statusPageUrl } : {}
|
|
6503
6543
|
};
|
|
6504
|
-
emit4(result, parsed.json, io);
|
|
6544
|
+
emit4(result, parsed.json, io, lifecycle?.containerRedeploy);
|
|
6505
6545
|
if (parsed.strict && (result.state === "drift" || accessDrift?.inSync === false || groupIssues.length > 0)) {
|
|
6506
6546
|
return 1;
|
|
6507
6547
|
}
|
|
@@ -6750,7 +6790,14 @@ function lifecycleOutput(slug, lc) {
|
|
|
6750
6790
|
...lc.statusPageUrl !== undefined ? { statusPageUrl: lc.statusPageUrl } : {}
|
|
6751
6791
|
};
|
|
6752
6792
|
}
|
|
6753
|
-
function
|
|
6793
|
+
function containerRedeployLine(view) {
|
|
6794
|
+
if (view.state === "failed") {
|
|
6795
|
+
return `Container redeploy: failed at ${view.stage ?? "unknown"}` + (view.message ? ` — ${view.message}` : "") + ` (attempt ${view.attemptId}, ${view.at})`;
|
|
6796
|
+
}
|
|
6797
|
+
return `Container redeploy: ${view.state} (attempt ${view.attemptId})`;
|
|
6798
|
+
}
|
|
6799
|
+
function emit4(base, asJson, io, containerRedeploy) {
|
|
6800
|
+
const out = containerRedeploy === undefined ? base : { ...base, containerRedeploy };
|
|
6754
6801
|
if (asJson) {
|
|
6755
6802
|
io.out(JSON.stringify(out, null, 2));
|
|
6756
6803
|
return;
|
|
@@ -6758,6 +6805,8 @@ function emit4(out, asJson, io) {
|
|
|
6758
6805
|
if (out.statusPageUrl !== undefined) {
|
|
6759
6806
|
io.out(`Status page: ${out.statusPageUrl}`);
|
|
6760
6807
|
}
|
|
6808
|
+
if (containerRedeploy !== undefined)
|
|
6809
|
+
io.out(containerRedeployLine(containerRedeploy));
|
|
6761
6810
|
switch (out.state) {
|
|
6762
6811
|
case "provisioning":
|
|
6763
6812
|
io.out(`${out.slug}: provisioning (stage: ${out.stage ?? "starting"})` + (out.submissionId ? ` — submission ${out.submissionId}` : ""));
|
|
@@ -9019,7 +9068,8 @@ var PLATFORM_ENV_NAMES = new Set([
|
|
|
9019
9068
|
"CF_ACCESS_AUD",
|
|
9020
9069
|
"JWKS_URL"
|
|
9021
9070
|
]);
|
|
9022
|
-
|
|
9071
|
+
var PLATFORM_ENV_PREFIXES = ["GATEWAY_", "CF_ACCESS_"];
|
|
9072
|
+
function dispatchManifest(manifest, wrangler = {}) {
|
|
9023
9073
|
const v2 = manifest.apiVersion === "launchpad.m-kopa.us/v2";
|
|
9024
9074
|
const source = v2 ? manifest.spec : manifest;
|
|
9025
9075
|
const appType = v2 ? manifest.spec.appType : manifest.deployment.type;
|
|
@@ -9028,8 +9078,9 @@ function dispatchManifest(manifest, wranglerD1) {
|
|
|
9028
9078
|
}
|
|
9029
9079
|
if (!v2)
|
|
9030
9080
|
assertConvertibleV1(manifest);
|
|
9031
|
-
const d1 = d1Binding(v2 ? manifest.spec.bindings?.d1 : pagesTargetD1(manifest),
|
|
9032
|
-
const
|
|
9081
|
+
const d1 = d1Binding(v2 ? manifest.spec.bindings?.d1 : pagesTargetD1(manifest), wrangler.d1);
|
|
9082
|
+
const manifestEnv = v2 ? manifest.spec.env_vars : plainTextEnv(manifest.production_env);
|
|
9083
|
+
const plainEnv = withWranglerVars(manifestEnv, wrangler.vars ?? {}, d1);
|
|
9033
9084
|
const envVars = { ...plainEnv, ...secretEnv(source.secrets, plainEnv) };
|
|
9034
9085
|
const spec = v2 ? { ...manifest.spec, secrets: undefined } : {
|
|
9035
9086
|
appType,
|
|
@@ -9087,6 +9138,31 @@ function d1Binding(declared, wranglerD1) {
|
|
|
9087
9138
|
}
|
|
9088
9139
|
return declared ?? wranglerD1;
|
|
9089
9140
|
}
|
|
9141
|
+
function withWranglerVars(env, vars, d1) {
|
|
9142
|
+
const entries = Object.entries(vars);
|
|
9143
|
+
if (entries.length === 0)
|
|
9144
|
+
return env;
|
|
9145
|
+
const out = { ...env };
|
|
9146
|
+
for (const [name, value] of entries) {
|
|
9147
|
+
if (isPlatformEnvName(name)) {
|
|
9148
|
+
throw new Error(`The wrangler var ${name} is set by the platform on dispatch apps. Rename it before converting.`);
|
|
9149
|
+
}
|
|
9150
|
+
if (/_(TOKEN|SECRET)$/.test(name)) {
|
|
9151
|
+
throw new Error(`The wrangler var ${name} is named like a secret. Declare it as an \`env-file\` secret in launchpad.yaml and remove it from the wrangler vars.`);
|
|
9152
|
+
}
|
|
9153
|
+
if (name === d1)
|
|
9154
|
+
throw new Error(`The wrangler var ${name} has the same name as the D1 binding. Rename one of them.`);
|
|
9155
|
+
const existing = out[name];
|
|
9156
|
+
if (existing !== undefined && !(existing.type === "plain_text" && existing.value === value)) {
|
|
9157
|
+
throw new Error(`The wrangler var ${name} differs from the ${name} environment variable in launchpad.yaml. Keep one value.`);
|
|
9158
|
+
}
|
|
9159
|
+
out[name] = { type: "plain_text", value };
|
|
9160
|
+
}
|
|
9161
|
+
return out;
|
|
9162
|
+
}
|
|
9163
|
+
function isPlatformEnvName(name) {
|
|
9164
|
+
return PLATFORM_ENV_NAMES.has(name) || PLATFORM_ENV_PREFIXES.some((prefix) => name.startsWith(prefix));
|
|
9165
|
+
}
|
|
9090
9166
|
function plainTextEnv(env) {
|
|
9091
9167
|
if (env === undefined)
|
|
9092
9168
|
return;
|
|
@@ -9125,19 +9201,36 @@ var ALLOWED_KEYS = new Set([
|
|
|
9125
9201
|
"compatibility_date",
|
|
9126
9202
|
"compatibility_flags",
|
|
9127
9203
|
"pages_build_output_dir",
|
|
9128
|
-
"d1_databases"
|
|
9204
|
+
"d1_databases",
|
|
9205
|
+
"vars"
|
|
9129
9206
|
]);
|
|
9130
9207
|
var PLATFORM_FLAGS = new Set(["nodejs_compat"]);
|
|
9131
9208
|
|
|
9132
9209
|
class UnsupportedWranglerConfigError extends Error {
|
|
9133
9210
|
}
|
|
9134
|
-
function
|
|
9211
|
+
function wranglerRuntime(file, text) {
|
|
9135
9212
|
const toml = file.endsWith(".toml");
|
|
9136
9213
|
const config = toml ? readToml(file, text) : readJsonc(file, text);
|
|
9137
9214
|
for (const key of Object.keys(config)) {
|
|
9138
9215
|
if (!ALLOWED_KEYS.has(key) && (toml || key !== "$schema"))
|
|
9139
9216
|
throw unsupportedKey(file, key);
|
|
9140
9217
|
}
|
|
9218
|
+
const vars = config.vars === undefined ? {} : plainVars(file, config.vars);
|
|
9219
|
+
const d1 = d1Binding2(file, config);
|
|
9220
|
+
return d1 === undefined ? { vars } : { d1, vars };
|
|
9221
|
+
}
|
|
9222
|
+
function plainVars(file, value) {
|
|
9223
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
9224
|
+
throw new UnsupportedWranglerConfigError(`${file} sets \`vars\` to something other than a table`);
|
|
9225
|
+
}
|
|
9226
|
+
for (const [name, item] of Object.entries(value)) {
|
|
9227
|
+
if (typeof item !== "string") {
|
|
9228
|
+
throw new UnsupportedWranglerConfigError(`${file} sets \`vars.${name}\` to something other than a string; dispatch env vars are plain strings`);
|
|
9229
|
+
}
|
|
9230
|
+
}
|
|
9231
|
+
return value;
|
|
9232
|
+
}
|
|
9233
|
+
function d1Binding2(file, config) {
|
|
9141
9234
|
if (config.compatibility_flags !== undefined) {
|
|
9142
9235
|
const extra = asArray(file, "compatibility_flags", config.compatibility_flags).find((flag) => !PLATFORM_FLAGS.has(String(flag)));
|
|
9143
9236
|
if (extra !== undefined) {
|
|
@@ -9190,8 +9283,9 @@ function readToml(file, text) {
|
|
|
9190
9283
|
let table = config;
|
|
9191
9284
|
for (const line of logicalTomlLines(text)) {
|
|
9192
9285
|
if (line.startsWith("[")) {
|
|
9193
|
-
table =
|
|
9194
|
-
|
|
9286
|
+
table = openTable(file, line, config, databases);
|
|
9287
|
+
} else if (table === config.vars) {
|
|
9288
|
+
assignVar(file, table, line);
|
|
9195
9289
|
} else {
|
|
9196
9290
|
assign(file, table, line, table === config);
|
|
9197
9291
|
}
|
|
@@ -9202,20 +9296,55 @@ function readToml(file, text) {
|
|
|
9202
9296
|
throw new UnsupportedWranglerConfigError(`${file} declares d1_databases twice`);
|
|
9203
9297
|
return { ...config, d1_databases: databases };
|
|
9204
9298
|
}
|
|
9205
|
-
function
|
|
9299
|
+
function openTable(file, line, config, databases) {
|
|
9206
9300
|
const name = /^\[\[?\s*([^\]]*?)\s*\]\]?$/.exec(line)?.[1] ?? line;
|
|
9207
|
-
if (
|
|
9208
|
-
|
|
9209
|
-
|
|
9301
|
+
if (line.startsWith("[[") && name === "d1_databases") {
|
|
9302
|
+
const table = {};
|
|
9303
|
+
databases.push(table);
|
|
9304
|
+
return table;
|
|
9305
|
+
}
|
|
9306
|
+
if (!line.startsWith("[[") && name === "vars")
|
|
9307
|
+
return varsTable(config);
|
|
9308
|
+
throw unsupportedKey(file, topKey(name));
|
|
9309
|
+
}
|
|
9310
|
+
function varsTable(config) {
|
|
9311
|
+
config.vars ??= {};
|
|
9312
|
+
return config.vars;
|
|
9210
9313
|
}
|
|
9211
9314
|
function assign(file, table, line, topLevel) {
|
|
9315
|
+
const [, key, value] = tomlAssignment(file, line);
|
|
9316
|
+
if (topLevel && key.includes(".")) {
|
|
9317
|
+
const [head, name, ...rest] = key.split(".");
|
|
9318
|
+
if (head !== "vars" || rest.length > 0)
|
|
9319
|
+
throw unsupportedKey(file, topKey(key));
|
|
9320
|
+
assignVar(file, varsTable(table), `${name} = ${value}`);
|
|
9321
|
+
return;
|
|
9322
|
+
}
|
|
9323
|
+
table[topKey(key)] = tomlValue(value.trim());
|
|
9324
|
+
}
|
|
9325
|
+
function assignVar(file, vars, line) {
|
|
9326
|
+
const [, key, value] = tomlAssignment(file, line);
|
|
9327
|
+
const quoted = /^"((?:[^"\\]|\\.)*)"$|^'([^']*)'$/.exec(value.trim());
|
|
9328
|
+
const text = quoted === null ? null : quoted[1] === undefined ? quoted[2] : basicString(file, key, quoted[1]);
|
|
9329
|
+
vars[key.replace(/"/g, "").trim()] = text;
|
|
9330
|
+
}
|
|
9331
|
+
var TOML_ESCAPES = { b: "\b", t: "\t", n: `
|
|
9332
|
+
`, f: "\f", r: "\r", '"': '"', "\\": "\\" };
|
|
9333
|
+
function basicString(file, key, raw) {
|
|
9334
|
+
return raw.replace(/\\(u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|.)/g, (escape, code) => {
|
|
9335
|
+
const point = code.length > 1 ? parseInt(code.slice(1), 16) : -1;
|
|
9336
|
+
const scalar = point <= 1114111 && (point < 55296 || point > 57343);
|
|
9337
|
+
const decoded = code.length > 1 ? scalar ? String.fromCodePoint(point) : undefined : TOML_ESCAPES[code];
|
|
9338
|
+
if (decoded === undefined)
|
|
9339
|
+
throw new UnsupportedWranglerConfigError(`${file} sets \`vars.${key.trim()}\` with an invalid escape \`${escape}\``);
|
|
9340
|
+
return decoded;
|
|
9341
|
+
});
|
|
9342
|
+
}
|
|
9343
|
+
function tomlAssignment(file, line) {
|
|
9212
9344
|
const assignment = /^([\w\-."]+)\s*=\s*(.*)$/.exec(line);
|
|
9213
9345
|
if (assignment === null)
|
|
9214
9346
|
throw new UnsupportedWranglerConfigError(`${file} could not be read as TOML near \`${line.slice(0, 40)}\``);
|
|
9215
|
-
|
|
9216
|
-
if (topLevel && assignment[1].includes("."))
|
|
9217
|
-
throw unsupportedKey(file, key);
|
|
9218
|
-
table[key] = tomlValue(assignment[2].trim());
|
|
9347
|
+
return [assignment[0], assignment[1], assignment[2]];
|
|
9219
9348
|
}
|
|
9220
9349
|
function topKey(dotted) {
|
|
9221
9350
|
return dotted.split(".")[0].replace(/"/g, "").trim();
|
|
@@ -9312,25 +9441,38 @@ async function runMigrate(args, io) {
|
|
|
9312
9441
|
return 64;
|
|
9313
9442
|
}
|
|
9314
9443
|
try {
|
|
9315
|
-
|
|
9316
|
-
if (result.kind === "already") {
|
|
9317
|
-
io.out("launchpad.yaml already selects Workers dispatch. Run `launchpad deploy`.");
|
|
9318
|
-
} else if (result.kind === "eligible") {
|
|
9319
|
-
io.out(`${result.slug}: eligible for v2 Workers dispatch with gateway authentication. No files changed.`);
|
|
9320
|
-
} else {
|
|
9321
|
-
io.out(`${result.slug}: launchpad.yaml now uses v2 Workers dispatch with gateway authentication.`);
|
|
9322
|
-
io.out(`Audience, owner and application settings are preserved. Original: ${BACKUP_PATH}`);
|
|
9323
|
-
io.out("Run `launchpad deploy`. No Pages project is needed.");
|
|
9324
|
-
const next = secretsNextStep(result.secrets);
|
|
9325
|
-
if (next !== null)
|
|
9326
|
-
io.out(next);
|
|
9327
|
-
}
|
|
9444
|
+
reportMigration(io, await convertToDispatch(process.cwd(), args.includes("--dry-run")));
|
|
9328
9445
|
return 0;
|
|
9329
9446
|
} catch (error) {
|
|
9330
9447
|
io.err(`launchpad migrate: ${error instanceof Error ? error.message : String(error)}`);
|
|
9331
9448
|
return 1;
|
|
9332
9449
|
}
|
|
9333
9450
|
}
|
|
9451
|
+
function reportMigration(io, result) {
|
|
9452
|
+
if (result.kind === "already") {
|
|
9453
|
+
io.out("launchpad.yaml already selects Workers dispatch. Run `launchpad deploy`.");
|
|
9454
|
+
return;
|
|
9455
|
+
}
|
|
9456
|
+
if (result.kind === "eligible") {
|
|
9457
|
+
io.out(`${result.slug}: eligible for v2 Workers dispatch with gateway authentication. No files changed.`);
|
|
9458
|
+
} else {
|
|
9459
|
+
io.out(`${result.slug}: launchpad.yaml now uses v2 Workers dispatch with gateway authentication.`);
|
|
9460
|
+
io.out(`Audience, owner and application settings are preserved. Original: ${BACKUP_PATH}`);
|
|
9461
|
+
io.out("Run `launchpad deploy`. No Pages project is needed.");
|
|
9462
|
+
const next = secretsNextStep(result.secrets);
|
|
9463
|
+
if (next !== null)
|
|
9464
|
+
io.out(next);
|
|
9465
|
+
}
|
|
9466
|
+
const warning = plainSecretWarning(result.plainSecretLike);
|
|
9467
|
+
if (warning !== null)
|
|
9468
|
+
io.err(`warning: ${warning}`);
|
|
9469
|
+
}
|
|
9470
|
+
var SECRET_LIKE_NAME = /SECRET|TOKEN|PASSWORD|PASSWD|PRIVATE|CREDENTIAL|APIKEY|AUTH_CONFIG|(^|_)(API_)?KEY(_|$)/i;
|
|
9471
|
+
function plainSecretWarning(names) {
|
|
9472
|
+
if (names.length === 0)
|
|
9473
|
+
return null;
|
|
9474
|
+
return `${names.join(", ")} ${names.length === 1 ? "looks" : "look"} like a secret but carried over as plain text, readable in launchpad.yaml. ` + "If it is one, declare it as an `env-file` secret, set it with `launchpad secrets push`, and rotate it.";
|
|
9475
|
+
}
|
|
9334
9476
|
var BACKUP_PATH = ".launchpad/manifest-before-dispatch.yaml";
|
|
9335
9477
|
function secretsNextStep(secrets) {
|
|
9336
9478
|
if (secrets.length === 0)
|
|
@@ -9339,33 +9481,37 @@ function secretsNextStep(secrets) {
|
|
|
9339
9481
|
}
|
|
9340
9482
|
async function convertToDispatch(cwd, dryRun) {
|
|
9341
9483
|
const file = path8.join(cwd, "launchpad.yaml");
|
|
9342
|
-
|
|
9343
|
-
throw new Error("launchpad.yaml must be a regular file, not a symlink.");
|
|
9484
|
+
const regularFile = lstatSync4(file).isFile();
|
|
9344
9485
|
const original = readFileSync11(file, "utf8");
|
|
9345
9486
|
const loaded = parseManifestAnyVersion(original, file);
|
|
9346
9487
|
if (loaded.kind !== "ok")
|
|
9347
|
-
throw new
|
|
9488
|
+
throw new InvalidManifestError;
|
|
9348
9489
|
const manifest = loaded.manifest;
|
|
9349
9490
|
if (manifest.apiVersion === "launchpad.m-kopa.us/v2" && manifest.spec.origin === "dispatch")
|
|
9350
9491
|
return { kind: "already" };
|
|
9351
9492
|
const slug = manifest.apiVersion === "launchpad.m-kopa.us/v2" ? manifest.metadata.slug : manifest.metadata.name;
|
|
9352
9493
|
let converted;
|
|
9353
9494
|
try {
|
|
9495
|
+
if (!regularFile)
|
|
9496
|
+
throw new Error("launchpad.yaml must be a regular file, not a symlink.");
|
|
9354
9497
|
converted = convertLocally(cwd, manifest);
|
|
9355
9498
|
} catch (error) {
|
|
9356
|
-
await refuseIfRegistered(slug)
|
|
9499
|
+
if (!await refuseIfRegistered(slug))
|
|
9500
|
+
throw new IneligibleUnconfirmedError(error);
|
|
9357
9501
|
throw error;
|
|
9358
9502
|
}
|
|
9359
9503
|
await assertUnregistered(slug);
|
|
9360
|
-
const
|
|
9504
|
+
const env = Object.entries(converted.spec.env_vars ?? {});
|
|
9505
|
+
const secrets = env.filter(([, value]) => value.type === "secret_text").map(([name]) => name);
|
|
9506
|
+
const plainSecretLike = env.filter(([name, value]) => value.type === "plain_text" && SECRET_LIKE_NAME.test(name)).map(([name]) => name);
|
|
9361
9507
|
if (dryRun)
|
|
9362
|
-
return { kind: "eligible", slug, secrets };
|
|
9508
|
+
return { kind: "eligible", slug, secrets, plainSecretLike };
|
|
9363
9509
|
try {
|
|
9364
9510
|
saveMigration(file, original, converted);
|
|
9365
9511
|
} catch (error) {
|
|
9366
9512
|
throw new MigrationSaveError(error);
|
|
9367
9513
|
}
|
|
9368
|
-
return { kind: "converted", slug, secrets };
|
|
9514
|
+
return { kind: "converted", slug, secrets, plainSecretLike };
|
|
9369
9515
|
}
|
|
9370
9516
|
function convertLocally(cwd, manifest) {
|
|
9371
9517
|
const v2 = manifest.apiVersion === "launchpad.m-kopa.us/v2";
|
|
@@ -9376,9 +9522,11 @@ function convertLocally(cwd, manifest) {
|
|
|
9376
9522
|
async function refuseIfRegistered(slug) {
|
|
9377
9523
|
try {
|
|
9378
9524
|
await assertUnregistered(slug);
|
|
9525
|
+
return true;
|
|
9379
9526
|
} catch (error) {
|
|
9380
|
-
if (error instanceof
|
|
9381
|
-
|
|
9527
|
+
if (error instanceof RegistryUnavailableError)
|
|
9528
|
+
return false;
|
|
9529
|
+
throw error;
|
|
9382
9530
|
}
|
|
9383
9531
|
}
|
|
9384
9532
|
async function assertUnregistered(slug) {
|
|
@@ -9394,6 +9542,18 @@ async function assertUnregistered(slug) {
|
|
|
9394
9542
|
throw new RegisteredAppError;
|
|
9395
9543
|
}
|
|
9396
9544
|
|
|
9545
|
+
class IneligibleUnconfirmedError extends Error {
|
|
9546
|
+
constructor(cause) {
|
|
9547
|
+
super(cause instanceof Error ? cause.message : String(cause));
|
|
9548
|
+
}
|
|
9549
|
+
}
|
|
9550
|
+
|
|
9551
|
+
class InvalidManifestError extends Error {
|
|
9552
|
+
constructor() {
|
|
9553
|
+
super("launchpad.yaml is invalid. Run `launchpad validate` and correct it first.");
|
|
9554
|
+
}
|
|
9555
|
+
}
|
|
9556
|
+
|
|
9397
9557
|
class MigrationSaveError extends Error {
|
|
9398
9558
|
constructor(cause) {
|
|
9399
9559
|
super(`Could not save the converted manifest: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
@@ -9414,10 +9574,14 @@ class RegisteredAppError extends Error {
|
|
|
9414
9574
|
var WRANGLER_FILES = ["wrangler.toml", "wrangler.json", "wrangler.jsonc"];
|
|
9415
9575
|
function inspectRuntime(cwd, appType, appRootDir, build) {
|
|
9416
9576
|
const d1 = new Set;
|
|
9577
|
+
const vars = {};
|
|
9417
9578
|
for (const root of runtimeRoots(cwd, appRootDir, build)) {
|
|
9418
9579
|
assertNoUncompiledCode(root, appType);
|
|
9419
|
-
for (const
|
|
9420
|
-
d1
|
|
9580
|
+
for (const runtime of wranglerRuntimes(cwd, root)) {
|
|
9581
|
+
if (runtime.d1 !== undefined)
|
|
9582
|
+
d1.add(runtime.d1);
|
|
9583
|
+
mergeVars(vars, runtime.vars);
|
|
9584
|
+
}
|
|
9421
9585
|
}
|
|
9422
9586
|
if (d1.size > 1)
|
|
9423
9587
|
throw new Error(`The wrangler configs bind D1 under different names (${[...d1].join(", ")}). Use one name.`);
|
|
@@ -9425,7 +9589,15 @@ function inspectRuntime(cwd, appType, appRootDir, build) {
|
|
|
9425
9589
|
if (binding !== undefined && appType !== "react+api") {
|
|
9426
9590
|
throw new Error("The wrangler config declares a D1 database, which only react+api apps can use on dispatch.");
|
|
9427
9591
|
}
|
|
9428
|
-
return binding;
|
|
9592
|
+
return { ...binding === undefined ? {} : { d1: binding }, vars };
|
|
9593
|
+
}
|
|
9594
|
+
function mergeVars(into, vars) {
|
|
9595
|
+
for (const [name, value] of Object.entries(vars)) {
|
|
9596
|
+
if (into[name] !== undefined && into[name] !== value) {
|
|
9597
|
+
throw new Error(`The wrangler configs set var ${name} to different values. Use one value.`);
|
|
9598
|
+
}
|
|
9599
|
+
into[name] = value;
|
|
9600
|
+
}
|
|
9429
9601
|
}
|
|
9430
9602
|
function runtimeRoots(cwd, appRootDir, build) {
|
|
9431
9603
|
const appRoot = path8.resolve(cwd, appRootDir ?? ".");
|
|
@@ -9448,8 +9620,8 @@ function assertNoUncompiledCode(root, appType) {
|
|
|
9448
9620
|
if (api)
|
|
9449
9621
|
assertWorkerRoutesFit(root);
|
|
9450
9622
|
}
|
|
9451
|
-
function
|
|
9452
|
-
return WRANGLER_FILES.map((name) => path8.join(root, name)).filter((file) => existsSync7(file)).map((file) =>
|
|
9623
|
+
function wranglerRuntimes(cwd, root) {
|
|
9624
|
+
return WRANGLER_FILES.map((name) => path8.join(root, name)).filter((file) => existsSync7(file)).map((file) => wranglerRuntime(path8.relative(cwd, file), readFileSync11(file, "utf8")));
|
|
9453
9625
|
}
|
|
9454
9626
|
function assertWorkerRoutesFit(root) {
|
|
9455
9627
|
const functions = path8.join(root, "functions");
|
|
@@ -9896,14 +10068,19 @@ async function runModelADeploy(args) {
|
|
|
9896
10068
|
let slug;
|
|
9897
10069
|
let appType = "static";
|
|
9898
10070
|
let declaredOrigin;
|
|
9899
|
-
let pagesNote;
|
|
9900
10071
|
try {
|
|
9901
|
-
|
|
10072
|
+
await defaultToDispatch(cwd, manifestPath, io);
|
|
9902
10073
|
} catch (e) {
|
|
9903
10074
|
if (e instanceof UpgradeRequiredError) {
|
|
9904
10075
|
io.err(e.message);
|
|
9905
10076
|
return EXIT_CLI_UPGRADE_REQUIRED;
|
|
9906
10077
|
}
|
|
10078
|
+
if (e instanceof DispatchIneligibleError) {
|
|
10079
|
+
for (const line of e.message.split(`
|
|
10080
|
+
`))
|
|
10081
|
+
io.err(line);
|
|
10082
|
+
return 1;
|
|
10083
|
+
}
|
|
9907
10084
|
io.err(`launchpad deploy: ${describe17(e)}. Nothing was deployed.`);
|
|
9908
10085
|
if (e instanceof UnauthenticatedError)
|
|
9909
10086
|
io.err(" run `launchpad login` to refresh your session.");
|
|
@@ -9977,8 +10154,6 @@ async function runModelADeploy(args) {
|
|
|
9977
10154
|
io.out(`Bundling ${cwd} for ${slug} (Model A) …`);
|
|
9978
10155
|
if (declaredOrigin !== "dispatch" && appType !== "container") {
|
|
9979
10156
|
io.out("Deployment target: Cloudflare Pages, selected by launchpad.yaml.");
|
|
9980
|
-
if (pagesNote !== null)
|
|
9981
|
-
io.out(pagesNote);
|
|
9982
10157
|
}
|
|
9983
10158
|
let cfg;
|
|
9984
10159
|
try {
|
|
@@ -10187,6 +10362,16 @@ async function runModelADeploy(args) {
|
|
|
10187
10362
|
const submissionId = typeof success.submissionId === "string" ? success.submissionId : "(missing)";
|
|
10188
10363
|
const echoedAppType = typeof success.appType === "string" ? success.appType : "(missing)";
|
|
10189
10364
|
const message = typeof success.message === "string" ? success.message : "Bot accepted the upload and started provisioning.";
|
|
10365
|
+
if (success.mode === "container_redeploy") {
|
|
10366
|
+
io.out(`✓ Container redeploy started for ${slug}`);
|
|
10367
|
+
io.out(` submission: ${submissionId}`);
|
|
10368
|
+
io.out("");
|
|
10369
|
+
io.out(message);
|
|
10370
|
+
io.out("");
|
|
10371
|
+
io.out("Next steps:");
|
|
10372
|
+
io.out(` launchpad status ${slug} # watch the redeploy`);
|
|
10373
|
+
return 0;
|
|
10374
|
+
}
|
|
10190
10375
|
io.out(`✓ First-time deploy — provisioning workflow started for ${slug}`);
|
|
10191
10376
|
io.out(` submission: ${submissionId}`);
|
|
10192
10377
|
io.out(` appType: ${echoedAppType}`);
|
|
@@ -10271,24 +10456,39 @@ function isIneligible(e) {
|
|
|
10271
10456
|
return !(e instanceof RegistryUnavailableError || e instanceof MigrationSaveError || e instanceof UpgradeRequiredError || e instanceof UnauthenticatedError);
|
|
10272
10457
|
}
|
|
10273
10458
|
async function defaultToDispatch(cwd, manifestPath, io) {
|
|
10274
|
-
|
|
10275
|
-
|
|
10459
|
+
const fields = originFields(manifestPath);
|
|
10460
|
+
if (!impliesPagesForGateway(fields))
|
|
10461
|
+
return;
|
|
10276
10462
|
try {
|
|
10277
10463
|
const result = await convertToDispatch(cwd, false);
|
|
10278
10464
|
if (result.kind === "converted")
|
|
10279
|
-
reportConversion(io, result.secrets);
|
|
10280
|
-
return null;
|
|
10465
|
+
reportConversion(io, result.secrets, result.plainSecretLike);
|
|
10281
10466
|
} catch (e) {
|
|
10282
|
-
if (e instanceof RegisteredAppError)
|
|
10283
|
-
return
|
|
10467
|
+
if (e instanceof RegisteredAppError || e instanceof InvalidManifestError)
|
|
10468
|
+
return;
|
|
10469
|
+
if (e instanceof IneligibleUnconfirmedError) {
|
|
10470
|
+
io.err(`launchpad deploy: warning: could not confirm whether this app is registered, so it stays on Cloudflare Pages. It cannot move to Workers dispatch: ${e.message}`);
|
|
10471
|
+
return;
|
|
10472
|
+
}
|
|
10284
10473
|
if (!(e instanceof Error) || !isIneligible(e))
|
|
10285
10474
|
throw e;
|
|
10286
|
-
|
|
10475
|
+
throw new DispatchIneligibleError(describe17(e), fields.v2 === true);
|
|
10476
|
+
}
|
|
10477
|
+
}
|
|
10478
|
+
|
|
10479
|
+
class DispatchIneligibleError extends Error {
|
|
10480
|
+
constructor(reason, v2) {
|
|
10481
|
+
const origin = v2 ? "spec.origin: pages" : "origin: pages";
|
|
10482
|
+
super([
|
|
10483
|
+
`launchpad deploy: this new app cannot move to Workers dispatch, the default for new apps: ${reason}`,
|
|
10484
|
+
" Nothing was deployed. Pages is opt-in for new apps, and new Pages projects fail while the account is at its Pages limit.",
|
|
10485
|
+
` Fix that setting and run \`launchpad deploy\` again, or set \`${origin}\` in launchpad.yaml to choose Pages on purpose.`
|
|
10486
|
+
].join(`
|
|
10487
|
+
`));
|
|
10287
10488
|
}
|
|
10288
10489
|
}
|
|
10289
10490
|
var CONVERTIBLE_APP_TYPES = new Set(["static", "react", "react+api"]);
|
|
10290
|
-
function impliesPagesForGateway(
|
|
10291
|
-
const fields = originFields(manifestPath);
|
|
10491
|
+
function impliesPagesForGateway(fields) {
|
|
10292
10492
|
return CONVERTIBLE_APP_TYPES.has(fields.appType) && fields.origin === undefined && fields.auth === "gateway";
|
|
10293
10493
|
}
|
|
10294
10494
|
function originFields(manifestPath) {
|
|
@@ -10299,16 +10499,19 @@ function originFields(manifestPath) {
|
|
|
10299
10499
|
return {};
|
|
10300
10500
|
}
|
|
10301
10501
|
if (raw.apiVersion === "launchpad.m-kopa.us/v2")
|
|
10302
|
-
return raw.spec
|
|
10502
|
+
return { ...raw.spec, v2: true };
|
|
10303
10503
|
return { origin: raw.origin, auth: raw.auth, appType: raw.deployment?.type };
|
|
10304
10504
|
}
|
|
10305
|
-
function reportConversion(io, secrets) {
|
|
10505
|
+
function reportConversion(io, secrets, plainSecretLike) {
|
|
10306
10506
|
io.out("New apps deploy on Workers dispatch by default, so launchpad.yaml was converted (no Pages project needed).");
|
|
10307
10507
|
io.out(` Audience, owner and build settings are preserved. Original: ${BACKUP_PATH}`);
|
|
10308
10508
|
io.out(` To stay on Pages instead, restore ${BACKUP_PATH} as launchpad.yaml, set \`origin: pages\` (v1) or \`spec.origin: pages\` (v2) and deploy again.`);
|
|
10309
10509
|
const next = secretsNextStep(secrets);
|
|
10310
10510
|
if (next !== null)
|
|
10311
10511
|
io.out(` ${next}`);
|
|
10512
|
+
const warning = plainSecretWarning(plainSecretLike);
|
|
10513
|
+
if (warning !== null)
|
|
10514
|
+
io.err(` warning: ${warning}`);
|
|
10312
10515
|
}
|
|
10313
10516
|
function declaredOriginOf(isV22, origin) {
|
|
10314
10517
|
if (!isV22)
|