@supacloud/cli 0.121.8 → 0.121.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/index.js +31 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -743,6 +743,8 @@ supacloud supabase migration_new --name add_accounts
|
|
|
743
743
|
supacloud supabase db_diff --schema public --name add_accounts
|
|
744
744
|
supacloud supabase push --ref abc123 --dir supabase/migrations --dry_run
|
|
745
745
|
supacloud frontend list --ref abc123
|
|
746
|
+
supacloud frontend set_env --ref abc123 --id web \
|
|
747
|
+
--env_vars '{"VITE_API_URL":"https://api.example.com"}'
|
|
746
748
|
supacloud branch create --name feature-orders --data_mode schema_only
|
|
747
749
|
supacloud branch promotion_plan --branch_ref preview123
|
|
748
750
|
supacloud branch promote --branch_ref preview123 --plan_checksum <sha256>
|
package/dist/index.js
CHANGED
|
@@ -18032,6 +18032,27 @@ async function activationReadback(http, input, mutationId, activationStatus) {
|
|
|
18032
18032
|
}
|
|
18033
18033
|
|
|
18034
18034
|
// src/shared/tools/frontend-tools.ts
|
|
18035
|
+
function parseEnvironmentVariables(value) {
|
|
18036
|
+
if (value === undefined)
|
|
18037
|
+
return;
|
|
18038
|
+
const candidate = typeof value === "string" ? (() => {
|
|
18039
|
+
try {
|
|
18040
|
+
return JSON.parse(value);
|
|
18041
|
+
} catch {
|
|
18042
|
+
throw new Error("'env_vars' must be a valid JSON object");
|
|
18043
|
+
}
|
|
18044
|
+
})() : value;
|
|
18045
|
+
if (!candidate || typeof candidate !== "object" || Array.isArray(candidate)) {
|
|
18046
|
+
throw new Error("'env_vars' must be a JSON object");
|
|
18047
|
+
}
|
|
18048
|
+
const environment = {};
|
|
18049
|
+
for (const [name, entry] of Object.entries(candidate)) {
|
|
18050
|
+
if (typeof entry !== "string")
|
|
18051
|
+
throw new Error(`'env_vars.${name}' must be a string`);
|
|
18052
|
+
environment[name] = entry;
|
|
18053
|
+
}
|
|
18054
|
+
return environment;
|
|
18055
|
+
}
|
|
18035
18056
|
function registerFrontendTools(server, http) {
|
|
18036
18057
|
registerTool(server, "frontend", `Frontend hosting and immutable prebuilt releases. Supports: static, react, vue, svelte, sveltekit, sveltekit-static, nextjs, nuxt, astro.
|
|
18037
18058
|
Actions: list, get, create, update, delete, build_logs, add_domain, remove_domain, set_env, list_frameworks, list_records, list_releases, get_active_release, get_release, verify_release, rollback. Publish with supacloud deploy.`, {
|
|
@@ -18063,7 +18084,10 @@ Actions: list, get, create, update, delete, build_logs, add_domain, remove_domai
|
|
|
18063
18084
|
install_command: optional(String2(), "[create/update] Install command override"),
|
|
18064
18085
|
node_version: optional(String2(), "[create/update] Node.js version"),
|
|
18065
18086
|
health_check_path: optional(String2(), "[create/update] SSR readiness path (default: /)"),
|
|
18066
|
-
env_vars: optional(
|
|
18087
|
+
env_vars: optional(Union([
|
|
18088
|
+
Record(String2(), String2()),
|
|
18089
|
+
String2({ minLength: 2, maxLength: 262144 })
|
|
18090
|
+
]), '[create/update/set_env] JSON object, for example {"VITE_API_URL":"https://..."}'),
|
|
18067
18091
|
release_id: optional(String2(), "[get_release] SHA-256 release ID; [rollback] optional, defaults to journal-verified previous release"),
|
|
18068
18092
|
cursor: optional(String2(), "[list_releases] Last release SHA-256 cursor"),
|
|
18069
18093
|
limit: optional(Number2(), "[list_releases] Page size, 1-100 (default 50)")
|
|
@@ -18089,6 +18113,7 @@ Actions: list, get, create, update, delete, build_logs, add_domain, remove_domai
|
|
|
18089
18113
|
if (value === undefined || value === null || value === "")
|
|
18090
18114
|
throw new Error(`'${field}' required for '${action}'`);
|
|
18091
18115
|
};
|
|
18116
|
+
const environment = parseEnvironmentVariables(env_vars);
|
|
18092
18117
|
const ok = (res) => res.ok ? JSON.stringify(res.data, null, 2) : `❌ Failed (${res.status}): ${JSON.stringify(res.data)}`;
|
|
18093
18118
|
let text;
|
|
18094
18119
|
switch (action) {
|
|
@@ -18114,7 +18139,7 @@ Actions: list, get, create, update, delete, build_logs, add_domain, remove_domai
|
|
|
18114
18139
|
install_command,
|
|
18115
18140
|
node_version,
|
|
18116
18141
|
health_check_path,
|
|
18117
|
-
env_vars
|
|
18142
|
+
env_vars: environment
|
|
18118
18143
|
}));
|
|
18119
18144
|
break;
|
|
18120
18145
|
case "update":
|
|
@@ -18128,7 +18153,7 @@ Actions: list, get, create, update, delete, build_logs, add_domain, remove_domai
|
|
|
18128
18153
|
install_command,
|
|
18129
18154
|
node_version,
|
|
18130
18155
|
health_check_path,
|
|
18131
|
-
env_vars
|
|
18156
|
+
env_vars: environment
|
|
18132
18157
|
}));
|
|
18133
18158
|
break;
|
|
18134
18159
|
case "delete":
|
|
@@ -18157,8 +18182,8 @@ Actions: list, get, create, update, delete, build_logs, add_domain, remove_domai
|
|
|
18157
18182
|
case "set_env":
|
|
18158
18183
|
need("ref", ref);
|
|
18159
18184
|
need("id", id);
|
|
18160
|
-
need("env_vars",
|
|
18161
|
-
text = (await http.put(`/v1/projects/${ref}/frontend/deployments/${id}/env`, { env_vars })).ok ? `✅ Set ${Object.keys(
|
|
18185
|
+
need("env_vars", environment);
|
|
18186
|
+
text = (await http.put(`/v1/projects/${ref}/frontend/deployments/${id}/env`, { env_vars: environment })).ok ? `✅ Set ${Object.keys(environment).length} env vars` : `❌ Failed`;
|
|
18162
18187
|
break;
|
|
18163
18188
|
case "list_frameworks":
|
|
18164
18189
|
text = ok(await http.get("/v1/projects/_/frontend/frameworks"));
|
|
@@ -34872,7 +34897,7 @@ async function runProjectDeployment(http, args) {
|
|
|
34872
34897
|
// package.json
|
|
34873
34898
|
var package_default = {
|
|
34874
34899
|
name: "@supacloud/cli",
|
|
34875
|
-
version: "0.121.
|
|
34900
|
+
version: "0.121.9",
|
|
34876
34901
|
description: "Project-scoped CLI for SupaCloud users",
|
|
34877
34902
|
type: "module",
|
|
34878
34903
|
main: "./dist/index.js",
|