@thecms/cli 0.20.2-dev.128 → 0.20.2-dev.129

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.
@@ -175,7 +175,7 @@ function realContext(env = process.env) {
175
175
  import { parseArgs } from "util";
176
176
 
177
177
  // src/context.ts
178
- var CLI_VERSION = "0.20.2-dev.128";
178
+ var CLI_VERSION = "0.20.2-dev.129";
179
179
  function call(ctx, path, init = {}) {
180
180
  const { token, client = "cli", ...rest } = init;
181
181
  const headers = new Headers(rest.headers);
@@ -9073,6 +9073,7 @@ function imagesIn(html) {
9073
9073
  return images;
9074
9074
  }
9075
9075
  var decorative = (img) => ["presentation", "none"].includes((img.role ?? "").trim().toLowerCase()) || (img["aria-hidden"] ?? "").trim().toLowerCase() === "true";
9076
+ var SECRET_FILES = [".env.local", ".env.development.local", ".env.production.local"];
9076
9077
  async function verify(ctx, opts = {}) {
9077
9078
  let render;
9078
9079
  let siteBase;
@@ -9218,10 +9219,11 @@ async function verifyOne(ctx, only, ref, render, siteBase) {
9218
9219
  const writing = (sets ?? []).flatMap((w) => (w.shapes ?? []).flatMap((sh) => sh.writes ? [{ set: w.entity ?? w.name ?? w.slug, shape: sh.id, schema: sh.writes.schema }] : []));
9219
9220
  if (!sets) note(`The shapes that write are not readable with ${ctx.key ? "this API key" : "your account"} (${setsRes?.status ?? "no answer"}): their key is not tried`);
9220
9221
  else if (writing.length) {
9221
- const env = existsSync19(join22(ctx.cwd, ".env.local")) ? readFileSync20(join22(ctx.cwd, ".env.local"), "utf8") : "";
9222
- const secret = new RegExp(`^${SECRET_VARIABLE}=(.+)$`, "m").exec(env)?.[1]?.trim() || process.env[SECRET_VARIABLE]?.trim();
9223
- if (!secret && siteBase) note(`A shape writes (${writing.map((w) => `${w.set} \xB7 ${w.shape} \u2192 ${w.schema}`).join(", ")}): its key is tried where .env.local or ${SECRET_VARIABLE} has it, not on the started build`);
9224
- else if (!secret) problem2(`A shape writes (${writing.map((w) => `${w.set} \xB7 ${w.shape} \u2192 ${w.schema}`).join(", ")}) but .env.local has no ${SECRET_VARIABLE}: apply_set with the shape's writes makes the key`);
9222
+ const secretIn = (file) => existsSync19(join22(ctx.cwd, file)) ? new RegExp(`^${SECRET_VARIABLE}=(.+)$`, "m").exec(readFileSync20(join22(ctx.cwd, file), "utf8"))?.[1]?.trim().replace(/^(["'])(.*)\1$/, "$2") : void 0;
9223
+ const secret = SECRET_FILES.map(secretIn).find(Boolean) || process.env[SECRET_VARIABLE]?.trim();
9224
+ const files = SECRET_FILES.join(", ");
9225
+ if (!secret && siteBase) note(`A shape writes (${writing.map((w) => `${w.set} \xB7 ${w.shape} \u2192 ${w.schema}`).join(", ")}): its key is tried where ${files} or ${SECRET_VARIABLE} has it, not on the started build`);
9226
+ else if (!secret) problem2(`A shape writes (${writing.map((w) => `${w.set} \xB7 ${w.shape} \u2192 ${w.schema}`).join(", ")}) but none of ${files} has ${SECRET_VARIABLE}: apply_set with the shape's writes makes the key`);
9225
9227
  else for (const w of writing) {
9226
9228
  const tried = await call(ctx, `/v1/${encodeURIComponent(workspace)}/records/${encodeURIComponent(w.schema)}/import`, { method: "POST", headers: { "X-Api-Key": secret }, body: JSON.stringify({ mode: "preview", rows: [{}] }) }).catch(() => null);
9227
9229
  const answer2 = tried?.ok ? await tried.json() : null;
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  run
4
- } from "./chunk-3XYLUUS6.js";
4
+ } from "./chunk-I24UVFZ7.js";
5
5
 
6
6
  // src/cli.ts
7
7
  run(process.argv.slice(2)).then((code) => process.exit(code)).catch((err) => {
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  personalToken,
4
4
  run
5
- } from "./chunk-3XYLUUS6.js";
5
+ } from "./chunk-I24UVFZ7.js";
6
6
  export {
7
7
  personalToken,
8
8
  run
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecms/cli",
3
- "version": "0.20.2-dev.128",
3
+ "version": "0.20.2-dev.129",
4
4
  "license": "UNLICENSED",
5
5
  "description": "theCMS. command line: the standard's starter, checks, brand, the method's docs, sign-in with a personal token",
6
6
  "type": "module",
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "@modelcontextprotocol/sdk": "1.32.1",
38
38
  "@resvg/resvg-wasm": "2.6.2",
39
- "@thecms/sdk": "0.20.2-dev.128",
39
+ "@thecms/sdk": "0.20.2-dev.129",
40
40
  "libpg-query": "18.2.0",
41
41
  "zod": "4.6.5"
42
42
  },