@unbase-app/cli 0.4.1 → 0.5.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/README.md CHANGED
@@ -44,7 +44,7 @@ the framework's own file, [`agents/astro.md`](./agents/astro.md) or
44
44
 
45
45
  | Flag | |
46
46
  |---|---|
47
- | `--comments` / `--no-comments` | Comments on the live site, with `?comment` (`@jens4m/comment-modus`, inside `@unbase-app/astro`). Default: in, or as the site has it when Unbase is in it already |
47
+ | `--comments` / `--no-comments` | Comments on the live site, with `?comment` (`@unbase-app/layer`, inside `@unbase-app/astro`). Default: in, or as the site has it when Unbase is in it already |
48
48
  | `--project <id or slug>` | Link comment mode and analytics to an Unbase project now (see *Linking*) |
49
49
  | `--pointer[=AGENTS.md\|CLAUDE.md]` / `--no-pointer` | One line in the site's `AGENTS.md` (or `CLAUDE.md`) pointing its agent at this package's `AGENTS.md`. Default: no |
50
50
  | `--no-install` | Write `package.json` only; install yourself |
@@ -57,7 +57,7 @@ versions:
57
57
 
58
58
  | Package | Version | |
59
59
  |---|---|---|
60
- | `@unbase-app/astro` | 0.3.0 | Unbase in an Astro site, one integration: comment mode (`@jens4m/comment-modus` 1.9.0: comments on the live site; it writes the content schemas Unbase reads), the draft-pages kit (`@unbase-app/pages` 0.4.0: draft pages kept out of production builds, and the redirects a moved page leaves applied) and the analytics beacon (`@unbase-app/analytics` 0.1.0) |
60
+ | `@unbase-app/astro` | 0.4.0 | Unbase in an Astro site, one integration: comment mode (`@unbase-app/layer` 2.0.0: comments on the live site; it writes the content schemas Unbase reads), the draft-pages kit (`@unbase-app/pages` 0.4.1: draft pages kept out of production builds, and the redirects a moved page leaves applied) and the analytics beacon (`@unbase-app/analytics` 0.1.0) |
61
61
  | `@unbase-app/cli` | this one | devDependency: `AGENTS.md` and `doctor`, pinned |
62
62
 
63
63
  In `astro.config`, found and changed through its syntax tree, never by text substitution:
@@ -158,9 +158,12 @@ moves it across, and it is how Unbase's Update does it:
158
158
  - `unbase()` takes `commentModus()`'s place with its options as they are (a site's own `project`,
159
159
  `titles`, `language`…); the `commentModusConfig.project ? … : null` init wrote around it goes,
160
160
  since `unbase()` waits for the project itself. `unbasePages()` and its import go.
161
- - `@jens4m/comment-modus` goes too, unless the site uses it for itself: a name its config still
162
- imports from it, its CLI in a script or a workflow. Then it stays, moved to the version
163
- `@unbase-app/astro` brings, so there is one.
161
+ - Comment mode's own package goes too, under either name (`@unbase-app/layer`, or
162
+ `@jens4m/comment-modus` before 2.0), unless the site uses it for itself: a name its config still
163
+ imports from it, the package named in its code or a workflow, or the layer's CLI in a script.
164
+ The layer then stays, moved to the version `@unbase-app/astro` brings, so there is one;
165
+ `@jens4m/comment-modus` stays as it is, as the layer has no release under that name. Its CLI alone
166
+ keeps neither: the layer answers to `comment-modus` too.
164
167
  - The pointer line moves to `node_modules/@unbase-app/cli/AGENTS.md`.
165
168
  - With `--yes`, a site keeps its choice of comments. A second run changes nothing.
166
169
 
package/agents/astro.md CHANGED
@@ -20,7 +20,7 @@ first written.
20
20
  changes nothing, and a package that is older than the version init pins is moved up to it. It adds:
21
21
 
22
22
  - `@unbase-app/astro`, and one entry in `integrations`, `unbase({ … })`. It brings comment mode
23
- (`@jens4m/comment-modus`: comments on the live site with `?comment`; it also writes the content
23
+ (`@unbase-app/layer`: comments on the live site with `?comment`; it also writes the content
24
24
  schemas, step 4) and the draft-pages kit (`@unbase-app/pages`), and adds both after every other
25
25
  integration itself. Its options are comment mode's own. `--no-comments` writes
26
26
  `unbase({ comments: false })`, which leaves comment mode out, and with it page and site settings.
@@ -32,7 +32,8 @@ changes nothing, and a package that is older than the version init pins is moved
32
32
  A site installed before 03-11 has the pair instead (`@jens4m/comment-modus` and
33
33
  `@jens4m/unbase-pages`, `commentModus()` and `unbasePages()`) and the CLI as `@jens4m/unbase`. init
34
34
  moves it across: `unbase()` takes `commentModus()`'s place with its options as they are, and the old
35
- packages go. A site that imports something of comment-modus for itself, or runs its CLI, keeps it.
35
+ packages go. A site that imports something of comment mode for itself, or names its package in its
36
+ code or a workflow, keeps it.
36
37
 
37
38
  If init says it cannot edit `astro.config` safely, make the same change by hand: import `unbase`
38
39
  from `@unbase-app/astro` and `commentModusConfig` from `./comment-modus.json`, and add
@@ -20,18 +20,20 @@
20
20
 
21
21
  import { parse } from "@babel/parser";
22
22
  import { CouldNotRun } from "./errors.mjs";
23
- import { ASTRO, BEFORE, COMMENT_MODUS, LAYER_URL, PAGES, SELF } from "./versions.mjs";
23
+ import { ASTRO, BEFORE, COMMENT_NAMES, LAYER, LAYER_URL, PAGES, SELF } from "./versions.mjs";
24
24
 
25
25
  /** The modules init imports, and the entries it adds or moves. */
26
26
  export const SOURCES = {
27
27
  unbase: ASTRO.name,
28
- comments: COMMENT_MODUS.name,
28
+ comments: LAYER.name,
29
29
  pages: `${PAGES.name}/astro`,
30
30
  link: "./comment-modus.json",
31
31
  sitemap: "@astrojs/sitemap",
32
32
  };
33
33
  /** The kit's integration, under its name now and before K5, as a site may import it. */
34
34
  const PAGES_ALSO = new Set([`${PAGES.name}/astro`, PAGES.name, `${BEFORE.pages}/astro`, BEFORE.pages]);
35
+ /** Comment mode, under its name now and before 2.0. */
36
+ const COMMENTS_ALSO = new Set(COMMENT_NAMES);
35
37
  const NAMES = { unbase: "unbase", comments: "commentModus", pages: "unbasePages", link: "commentModusConfig" };
36
38
  /** The line init writes above unbase({ … }), with comments and without. */
37
39
  export const UNBASE_LINE = "// Unbase: comments with ?comment once comment-modus.json names the project, and drafts kept off Live.";
@@ -98,7 +100,7 @@ function importsOf(ast) {
98
100
  for (const n of ast.program.body) {
99
101
  if (n.type !== "ImportDeclaration") continue;
100
102
  const src = n.source.value;
101
- const kind = src === SOURCES.unbase ? "unbase" : src === SOURCES.comments ? "comments" : PAGES_ALSO.has(src) ? "pages" : src === SOURCES.link ? "link" : src === SOURCES.sitemap ? "sitemap" : null;
103
+ const kind = src === SOURCES.unbase ? "unbase" : COMMENTS_ALSO.has(src) ? "comments" : PAGES_ALSO.has(src) ? "pages" : src === SOURCES.link ? "link" : src === SOURCES.sitemap ? "sitemap" : null;
102
104
  if (!kind) continue;
103
105
  found.nodes.push({ kind, node: n });
104
106
  for (const s of n.specifiers) {
@@ -307,7 +309,7 @@ function reindent(text, indent) {
307
309
 
308
310
  /**
309
311
  * Splices that take a package's imports out: a declaration whose names all go is removed with its
310
- * line; one that keeps a name the site uses for itself (`import commentModus, { sleutelVanPad }`)
312
+ * line; one that keeps a name the site uses for itself (`import commentModus, { keyFromPath }`)
311
313
  * loses only the entry's name. Returns the splices and the first declaration removed whole, where
312
314
  * the new import can stand.
313
315
  */
@@ -20,7 +20,7 @@ import { CouldNotRun } from "../errors.mjs";
20
20
  import { check, featureState } from "../feature.mjs";
21
21
  import { core, readSettings, registryFiles, registryOf } from "../readers.mjs";
22
22
  import { depsOf, installedVersion, uncommitted } from "../site.mjs";
23
- import { ASTRO, BEFORE, COMMENT_MODUS, compareVersions, MARKERS_PREVIEW, PAGES, SELF, UNLISTED_BUILD_FAILURE } from "../versions.mjs";
23
+ import { ASTRO, BEFORE, COMMENT_NAMES, compareVersions, LAYER, MARKERS_PREVIEW, PAGES, SELF, UNLISTED_BUILD_FAILURE, versionIn } from "../versions.mjs";
24
24
 
25
25
  /** The file with the steps init leaves, in this package. */
26
26
  const AGENTS = "agents/astro.md";
@@ -141,30 +141,44 @@ function analyticsOption(site) {
141
141
 
142
142
  // ── The move (K5) ──────────────────────────────────────────────────────────
143
143
 
144
- /** Files that may name comment-modus for the site's own use: code, scripts and CI, not docs or lockfiles. */
144
+ /** Files that may name comment mode's package for the site's own use: code, scripts and CI, not docs or lockfiles. */
145
145
  const OWN_USE = /\.(astro|ts|tsx|js|jsx|mjs|cjs|mts|cts|yml|yaml)$/;
146
146
 
147
147
  /**
148
148
  * What init takes out of a site from before K5, once the one package is in: the kit and the CLI
149
- * under their old names, the kit under its own name (unbase() brings it), and comment-modus unless
150
- * the site still uses it for itself (a name its config imports, its CLI in a script or a workflow).
151
- * A comment-modus the site keeps is moved to the version the one package brings, so there is one.
149
+ * under their old names, the kit under its own name (unbase() brings it), and comment mode under
150
+ * either name unless the site still uses it for itself (a name its config imports, the package
151
+ * named in its code or CI, the layer's CLI in a script). The layer a site keeps is moved to the
152
+ * version the one package brings, so there is one. comment-modus under its name before 2.0 is left
153
+ * as the site has it when the site uses it for itself (the layer has no release under that name),
154
+ * and goes when only its CLI is used: the layer answers to `comment-modus` too.
152
155
  * `planned`: init's plan for the config, which tells what the config still imports.
153
156
  */
154
157
  function planReplaced(site, planned) {
155
158
  const deps = depsOf(site.pkg);
156
159
  const remove = [BEFORE.pages, BEFORE.cli, PAGES.name].filter((n) => deps[n] !== undefined);
157
160
  const keep = [];
158
- if (deps[COMMENT_MODUS.name] !== undefined) {
161
+ const listed = COMMENT_NAMES.filter((n) => deps[n] !== undefined);
162
+ if (listed.length) {
159
163
  const config = planned.find((f) => f.file === site.configFile)?.text ?? site.text(site.configFile) ?? "";
160
- let imported = false;
164
+ /** The comment mode packages the planned config still imports from. */
165
+ const imports = new Set();
161
166
  try {
162
- imported = inspectConfig(config, site.configFile).imports.nodes.some((n) => n.kind === "comments");
167
+ for (const { kind, node } of inspectConfig(config, site.configFile).imports.nodes) if (kind === "comments") imports.add(node.source.value);
163
168
  } catch {}
164
- const scripts = Object.values(site.pkg.scripts ?? {}).some((c) => /\bcomment-modus\b/.test(String(c)));
165
- const elsewhere = site.appPaths.some((p) => p !== site.configFile && OWN_USE.test(p) && !p.startsWith("node_modules/") && (site.text(p) ?? "").includes(COMMENT_MODUS.name));
166
- if (imported || scripts || elsewhere) keep.push(COMMENT_MODUS);
167
- else remove.push(COMMENT_MODUS.name);
169
+ const scripts = Object.values(site.pkg.scripts ?? {}).some((c) => /\b(comment-modus|unbase-layer)\b/.test(String(c)));
170
+ for (const name of listed) {
171
+ const ownUse = imports.has(name) || site.appPaths.some((p) => p !== site.configFile && OWN_USE.test(p) && !p.startsWith("node_modules/") && (site.text(p) ?? "").includes(name));
172
+ if (name === LAYER.name) {
173
+ if (ownUse || scripts) keep.push(LAYER);
174
+ else remove.push(name);
175
+ } else if (!ownUse) remove.push(name);
176
+ else {
177
+ // Kept at the version it has, so init's report names it.
178
+ const have = installedVersion(site, name) ?? versionIn(deps[name]);
179
+ if (have) keep.push({ name, version: have, dev: false });
180
+ }
181
+ }
168
182
  }
169
183
  return { remove, keep, by: ASTRO.name };
170
184
  }
@@ -172,7 +186,7 @@ function planReplaced(site, planned) {
172
186
  /** What of Unbase the site has now, for init's defaults: null without any of it; else whether comment mode is set up. */
173
187
  function currentOf(site) {
174
188
  const deps = depsOf(site.pkg);
175
- if (![ASTRO.name, COMMENT_MODUS.name, PAGES.name, BEFORE.pages].some((n) => deps[n] !== undefined) || !site.configFile) return null;
189
+ if (![ASTRO.name, ...COMMENT_NAMES, PAGES.name, BEFORE.pages].some((n) => deps[n] !== undefined) || !site.configFile) return null;
176
190
  try {
177
191
  return { comments: inspectConfig(site.text(site.configFile), site.configFile).has.commentMode };
178
192
  } catch {
@@ -184,7 +198,7 @@ function currentOf(site) {
184
198
  function planUninstall(site) {
185
199
  const config = site.configFile ? removeFromConfig(site.text(site.configFile), site.configFile) : { code: null, changes: [] };
186
200
  return {
187
- packages: [ASTRO.name, COMMENT_MODUS.name, PAGES.name, BEFORE.pages, SELF.name, BEFORE.cli],
201
+ packages: [ASTRO.name, ...COMMENT_NAMES, PAGES.name, BEFORE.pages, SELF.name, BEFORE.cli],
188
202
  files: config.changes.length ? [{ file: site.configFile, action: "changed", changes: config.changes, text: config.code }] : [],
189
203
  remove: [LINK_FILE, core.PAGE_FILE, SCHEMAS],
190
204
  };
@@ -251,6 +265,14 @@ async function doctorFeatures(site, { build }) {
251
265
  const known = build && !build.ok ? knownFailure(site, deps, build.output) : null;
252
266
  /** The one package (K5): comment mode and the kit come inside it, in node_modules without being listed. */
253
267
  const one = deps[ASTRO.name] !== undefined;
268
+ /**
269
+ * Comment mode's package as the site has it: inside the one package, the layer when it is there
270
+ * (@unbase-app/astro 0.4.0 on) and else comment-modus; otherwise the name package.json lists, or
271
+ * the one in node_modules.
272
+ */
273
+ const commentName = one
274
+ ? (COMMENT_NAMES.find((n) => installedVersion(site, n)) ?? LAYER.name)
275
+ : (COMMENT_NAMES.find((n) => deps[n] !== undefined) ?? COMMENT_NAMES.find((n) => installedVersion(site, n)) ?? LAYER.name);
254
276
  /** A package in node_modules (or in the config) that package.json does not list: Unbase reads package.json, and the build may not find it. */
255
277
  const unlisted = (p, usedInConfig) =>
256
278
  !one && !deps[p.name] && (installedVersion(site, p.name) || usedInConfig)
@@ -266,7 +288,7 @@ async function doctorFeatures(site, { build }) {
266
288
  const checks = [check("astro", "ok", `Astro ${installedVersion(site, "astro") ?? detection.framework.version ?? ""}, which Unbase reads with its Astro adapter: texts are edited where they are written, nothing installed.`)];
267
289
  if (!build) checks.push(check("build", "skipped", "Not built (--no-build)."));
268
290
  else if (built) checks.push(check("build", "ok", `A production build works (${build.html.size} pages).`));
269
- else if (known) checks.push(check("build", "missing", `The production build fails: ${known}`, { missing: `${COMMENT_MODUS.name} listed in package.json`, file: "package.json", step: STEPS.install, detail: tailOf(build.output, 6) }));
291
+ else if (known) checks.push(check("build", "missing", `The production build fails: ${known}`, { missing: `${UNLISTED_BUILD_FAILURE.package} listed in package.json`, file: "package.json", step: STEPS.install, detail: tailOf(build.output, 6) }));
270
292
  else checks.push(check("build", "missing", "The production build fails, so Unbase cannot start or check the site.", { missing: "a site that builds", file: site.configFile, detail: tailOf(build.output) }));
271
293
  const names = detection.settings.map((s) => s.name);
272
294
  if (names.length) checks.push(check("settings", "info", `The code reads ${names.length} setting(s) (${names.slice(0, 6).join(", ")}${names.length > 6 ? ", …" : ""}). If the site needs them to start, give them development values in Unbase.`));
@@ -294,13 +316,13 @@ async function doctorFeatures(site, { build }) {
294
316
  ? `No data-c markers in the production build (${setting}): they are in the dev server and previews only, so a pin on the live site is named after its section.`
295
317
  : `No data-c markers in the production build (${setting}).`,
296
318
  );
297
- const have = commentsInstalled ? installedVersion(site, COMMENT_MODUS.name) : null;
298
- const tooOld = when === "preview" && have && compareVersions(have, MARKERS_PREVIEW.since) < 0;
319
+ const have = commentsInstalled ? installedVersion(site, commentName) : null;
320
+ const tooOld = when === "preview" && commentName === MARKERS_PREVIEW.package && have && compareVersions(have, MARKERS_PREVIEW.since) < 0;
299
321
  const found = `${htmlWithMarkers.length} built page(s) carry data-c markers`;
300
322
  const where = `(e.g. ${htmlWithMarkers[0]})`;
301
323
  if (tooOld)
302
- return check("markers", "missing", `${found} ${where}: ${site.configFile} says ${setting}, which ${COMMENT_MODUS.name} ${have} does not know; ${MARKERS_PREVIEW.since} keeps them out of production builds.`, {
303
- missing: `${COMMENT_MODUS.name} ${MARKERS_PREVIEW.since} or later`,
324
+ return check("markers", "missing", `${found} ${where}: ${site.configFile} says ${setting}, which ${commentName} ${have} does not know; ${MARKERS_PREVIEW.since} keeps them out of production builds, and so does ${LAYER.name}.`, {
325
+ missing: `${LAYER.name}, or ${MARKERS_PREVIEW.package} ${MARKERS_PREVIEW.since} or later`,
304
326
  file: "package.json",
305
327
  step: STEPS.install,
306
328
  });
@@ -314,7 +336,7 @@ async function doctorFeatures(site, { build }) {
314
336
  ? check("markers", "ok", `${htmlWithMarkers.length} of ${build.html.size} built pages carry comment mode's data-c markers: a pin's title and source file come from them.`)
315
337
  : check("markers", "info", "No data-c markers in the build: comment mode marks the components in src/components, and found none on these pages.");
316
338
  };
317
- const notListed = unlisted(COMMENT_MODUS, !!config?.has.comments);
339
+ const notListed = unlisted({ name: commentName }, !!config?.has.comments);
318
340
  /** Where comment mode is set up: unbase() (K5), or commentModus() of its own. */
319
341
  const call = config?.has.unbase && config.unbaseComments !== false ? "unbase()" : "commentModus()";
320
342
  if (!commentsInstalled && notListed) {
@@ -327,7 +349,7 @@ async function doctorFeatures(site, { build }) {
327
349
  "info",
328
350
  one && config?.unbaseComments === false
329
351
  ? `Left out: unbase({ comments: false }); \`unbase init --comments\` turns it on. Comments on the canvas in Unbase work without it.`
330
- : `Not in the code: \`unbase init --comments\` adds it (${ASTRO.name}, with ${COMMENT_MODUS.name}). Comments on the canvas in Unbase work without it.`,
352
+ : `Not in the code: \`unbase init --comments\` adds it (${ASTRO.name}, with ${LAYER.name}). Comments on the canvas in Unbase work without it.`,
331
353
  ),
332
354
  );
333
355
  checks.push(markersCheck(false));
@@ -338,8 +360,8 @@ async function doctorFeatures(site, { build }) {
338
360
  "package",
339
361
  "ok",
340
362
  one
341
- ? `${ASTRO.name} ${installedVersion(site, ASTRO.name) ?? deps[ASTRO.name]} is a dependency, with ${[COMMENT_MODUS.name, installedVersion(site, COMMENT_MODUS.name)].filter(Boolean).join(" ")} in it.`
342
- : `${COMMENT_MODUS.name} ${installedVersion(site, COMMENT_MODUS.name) ?? deps[COMMENT_MODUS.name]} is a dependency.`,
363
+ ? `${ASTRO.name} ${installedVersion(site, ASTRO.name) ?? deps[ASTRO.name]} is a dependency, with ${[commentName, installedVersion(site, commentName)].filter(Boolean).join(" ")} in it.`
364
+ : `${commentName} ${installedVersion(site, commentName) ?? deps[commentName]} is a dependency.`,
343
365
  ),
344
366
  );
345
367
  if (configError) checks.push(check("config", "missing", configError, { file: site.configFile, step: STEPS.install }));
@@ -397,7 +419,7 @@ async function doctorFeatures(site, { build }) {
397
419
  }),
398
420
  );
399
421
  // A site from before K5 works as it is; the one package is where Update goes.
400
- const before = [COMMENT_MODUS.name, BEFORE.pages].filter((n) => deps[n] !== undefined);
422
+ const before = [...COMMENT_NAMES, BEFORE.pages].filter((n) => deps[n] !== undefined);
401
423
  if (!one && before.includes(BEFORE.pages))
402
424
  checks.push(check("moved", "info", `${before.join(" and ")} ${before.length > 1 ? "are" : "is"} one package since 03-11, ${ASTRO.name}: \`npx ${SELF.name} init\` moves the site across (one dependency, one line in ${site.configFile ?? "astro.config"}).`));
403
425
  if (config && config.has.pages && !config.orderOk)
@@ -501,7 +523,7 @@ async function doctorFeatures(site, { build }) {
501
523
  configured: !!config?.has.unbase,
502
524
  option: config ? config.unbaseAnalytics : null,
503
525
  project: readLink(site) ?? config?.unbaseProject ?? null,
504
- before: !one && [COMMENT_MODUS.name, BEFORE.pages].some((n) => deps[n] !== undefined),
526
+ before: !one && [...COMMENT_NAMES, BEFORE.pages].some((n) => deps[n] !== undefined),
505
527
  step: STEPS.analytics,
506
528
  install: STEPS.install,
507
529
  config: site.configFile ?? "astro.config.mjs",
package/lib/readers.mjs CHANGED
@@ -144,6 +144,8 @@ var astro = {
144
144
 
145
145
  // supabase/functions/_shared/framework-packages.ts
146
146
  var COMMENT_MODE = "@jens4m/comment-modus";
147
+ var COMMENT_LAYER = "@unbase-app/layer";
148
+ var COMMENT_MODES = [COMMENT_LAYER, COMMENT_MODE];
147
149
  var FRAMEWORK_PACKAGES = [
148
150
  {
149
151
  id: "astro",
@@ -152,7 +154,7 @@ var FRAMEWORK_PACKAGES = [
152
154
  config: "astro.config",
153
155
  call: "unbase()",
154
156
  agents: "agents/astro.md",
155
- replaces: [COMMENT_MODE, "@jens4m/unbase-pages"],
157
+ replaces: [COMMENT_LAYER, COMMENT_MODE, "@jens4m/unbase-pages"],
156
158
  // unbase({ project: commentModusConfig.project, … }): the config imports comment-modus.json.
157
159
  comments: { calls: ["unbase"], options: true, readsLink: false },
158
160
  schemas: "src/content/.schemas/"
@@ -409,7 +411,8 @@ async function detect(repo, branch, truncated, appPath) {
409
411
  const fw = frameworkOf(chosen.deps);
410
412
  const adapter = fw ? ADAPTERS.find((a) => a.framework === fw.id) ?? null : null;
411
413
  const found = adapter ? await adapter.detect(repo, chosen) : { text: null, site: null, project: null };
412
- const cmRange = chosen.deps[COMMENT_MODE] ?? root?.deps[COMMENT_MODE];
414
+ const cmName = COMMENT_MODES.find((n) => chosen.deps[n] ?? root?.deps[n]);
415
+ const cmRange = cmName ? chosen.deps[cmName] ?? root?.deps[cmName] : void 0;
413
416
  const carrier = fw && frameworkPackage(fw.id)?.comments ? frameworkPackage(fw.id).packages[0] ?? null : null;
414
417
  const carried = !!carrier && !!(chosen.deps[carrier] ?? root?.deps[carrier]) && !found.commentsOff;
415
418
  const { settings, truncated: settingsTruncated } = await settingsOf(repo, chosen.path, fw?.id ?? null);
package/lib/versions.mjs CHANGED
@@ -14,10 +14,13 @@ export const SELF = { name: own.name, version: own.version, dev: true };
14
14
  * Unbase in an Astro site, one package (K5): comment mode, the draft-pages kit and the analytics
15
15
  * beacon below, at the versions its own package.json pins (kit/astro; a test holds the two equal).
16
16
  */
17
- export const ASTRO = { name: "@unbase-app/astro", version: "0.3.1", dev: false };
17
+ export const ASTRO = { name: "@unbase-app/astro", version: "0.4.0", dev: false };
18
18
 
19
- /** Comments on the live site (`?comment`), and the content schemas, page list and markers it writes. Inside ASTRO. */
20
- export const COMMENT_MODUS = { name: "@jens4m/comment-modus", version: "1.11.0", dev: false };
19
+ /**
20
+ * Comment mode, the layer: comments on the live site (`?comment`), and the content schemas, page
21
+ * list and markers it writes. Inside ASTRO. Called @jens4m/comment-modus before 2.0 (BEFORE.comments).
22
+ */
23
+ export const LAYER = { name: "@unbase-app/layer", version: "2.0.0", dev: false };
21
24
 
22
25
  /** Keeps draft pages out of production builds, and applies the redirects a moved page leaves. Inside ASTRO. */
23
26
  export const PAGES = { name: "@unbase-app/pages", version: "0.4.1", dev: false };
@@ -26,10 +29,14 @@ export const PAGES = { name: "@unbase-app/pages", version: "0.4.1", dev: false }
26
29
  export const ANALYTICS = { name: "@unbase-app/analytics", version: "0.1.0", dev: false };
27
30
 
28
31
  /**
29
- * The names before K5 (03-11): a site installed then has the pair (comment-modus and the kit) and
30
- * the CLI under these. init replaces them; doctor and uninstall know them.
32
+ * The names before: K5 (03-11) made the pair (comment mode and the kit) one package and moved the
33
+ * CLI; comment mode became @unbase-app/layer at 2.0 (16-11). init replaces them; doctor and
34
+ * uninstall know them.
31
35
  */
32
- export const BEFORE = { pages: "@jens4m/unbase-pages", cli: "@jens4m/unbase" };
36
+ export const BEFORE = { pages: "@jens4m/unbase-pages", cli: "@jens4m/unbase", comments: "@jens4m/comment-modus" };
37
+
38
+ /** Comment mode under either of its names, the current one first. */
39
+ export const COMMENT_NAMES = [LAYER.name, BEFORE.comments];
33
40
 
34
41
  /** Vite + React Router: the draft-pages kit and comment mode's loader, in one Vite plugin (kit/vite). A build tool, so a devDependency, beside vite. */
35
42
  export const VITE = { name: "@unbase-app/vite", version: "0.3.1", dev: true };
@@ -52,14 +59,14 @@ export const LAYER_URL = "https://layer.unbase.app/v1/loader.js";
52
59
  * route when it is in node_modules but not listed in package.json (npm install --no-save, or
53
60
  * through another package). Listing it fixes it; 1.8.1 builds either way.
54
61
  */
55
- export const UNLISTED_BUILD_FAILURE = { package: COMMENT_MODUS.name, upTo: "1.8.0", fixedIn: "1.8.1", output: /Invalid URL/ };
62
+ export const UNLISTED_BUILD_FAILURE = { package: BEFORE.comments, upTo: "1.8.0", fixedIn: "1.8.1", output: /Invalid URL/ };
56
63
 
57
64
  /**
58
65
  * The first comment-modus that knows `componentMarker: "preview"`: data-c in the dev server and
59
66
  * previews, none in a production build (plan-packages *Open* 5). An older one ignores the value
60
67
  * and marks every build. init does not write the option, so the pin above stays where it is.
61
68
  */
62
- export const MARKERS_PREVIEW = { package: COMMENT_MODUS.name, since: "1.9.0" };
69
+ export const MARKERS_PREVIEW = { package: BEFORE.comments, since: "1.9.0" };
63
70
 
64
71
  /** "1.8.1" from a version or a range ("^1.7.0" → 1.7.0); null for a tag, a URL or a file. */
65
72
  export function versionIn(spec) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unbase-app/cli",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Adds Unbase to an Astro, Vite + React or Next.js site, checks it, takes it out again, and renames, duplicates and deletes its pages: unbase init, doctor, uninstall and page.",
5
5
  "license": "MIT",
6
6
  "type": "module",