@unbase-app/cli 0.3.0 → 0.4.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/lib/uninstall.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  // ============================================================================
2
2
  // unbase uninstall — init backwards. Refuses while unbase.pages.json holds a
3
- // draft (without the kit a draft is built and goes live). Then removes the
3
+ // draft (without the kit a draft is built and goes live), or a redirect
4
+ // (without the package an old address stops working). Then removes the
4
5
  // packages, what the framework's module names (on Astro: their lines in
5
6
  // astro.config, comment-modus.json, unbase.pages.json,
6
7
  // src/content/.schemas/), the analytics collector init allowed in the CSP of
@@ -38,6 +39,19 @@ export async function uninstall(flags, io) {
38
39
  message: `${core.PAGE_FILE} holds ${drafts.length} draft page(s). Without the kit they would be built and go live: publish or delete each in Unbase first.`,
39
40
  };
40
41
  }
42
+ // Redirects next: the package applies them, so without it a renamed or deleted page's old address breaks.
43
+ const redirects = pageFile.redirects ?? {};
44
+ if (Object.keys(redirects).length) {
45
+ return {
46
+ command: "uninstall",
47
+ ok: false,
48
+ exitCode: FAILED,
49
+ site: site.root,
50
+ refused: "redirects",
51
+ redirects,
52
+ message: `${core.PAGE_FILE} sends ${Object.keys(redirects).length} old address(es) on, which only the package applies. Put them in the site's own redirects (its framework's config, or the host's), take them out of ${core.PAGE_FILE}, and run uninstall again:`,
53
+ };
54
+ }
41
55
 
42
56
  if (!flags.yes) {
43
57
  if (!io.interactive) throw new CouldNotRun("choice_missing", "Pass --yes to remove Unbase from this site: there is no terminal to ask in.");
package/lib/versions.mjs CHANGED
@@ -14,13 +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.2.0", dev: false };
17
+ export const ASTRO = { name: "@unbase-app/astro", version: "0.3.0", dev: false };
18
18
 
19
19
  /** Comments on the live site (`?comment`), and the content schemas, page list and markers it writes. Inside ASTRO. */
20
20
  export const COMMENT_MODUS = { name: "@jens4m/comment-modus", version: "1.9.0", dev: false };
21
21
 
22
- /** Keeps draft pages out of production builds. Inside ASTRO. */
23
- export const PAGES = { name: "@unbase-app/pages", version: "0.3.0", dev: false };
22
+ /** Keeps draft pages out of production builds, and applies the redirects a moved page leaves. Inside ASTRO. */
23
+ export const PAGES = { name: "@unbase-app/pages", version: "0.4.0", dev: false };
24
24
 
25
25
  /** Unbase's analytics beacon (kit/analytics). Inside ASTRO, VITE and NEXT; never installed on its own. */
26
26
  export const ANALYTICS = { name: "@unbase-app/analytics", version: "0.1.0", dev: false };
@@ -32,10 +32,10 @@ export const ANALYTICS = { name: "@unbase-app/analytics", version: "0.1.0", dev:
32
32
  export const BEFORE = { pages: "@jens4m/unbase-pages", cli: "@jens4m/unbase" };
33
33
 
34
34
  /** 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
- export const VITE = { name: "@unbase-app/vite", version: "0.2.0", dev: true };
35
+ export const VITE = { name: "@unbase-app/vite", version: "0.3.0", dev: true };
36
36
 
37
37
  /** Next.js: draft pages kept out of production builds, comments on the live site and analytics (`withUnbase`). */
38
- export const NEXT = { name: "@unbase-app/next", version: "0.2.0", dev: false };
38
+ export const NEXT = { name: "@unbase-app/next", version: "0.3.0", dev: false };
39
39
 
40
40
  /**
41
41
  * The first version of each framework's package that brings the analytics beacon: doctor's
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unbase-app/cli",
3
- "version": "0.3.0",
4
- "description": "Adds Unbase to an Astro, Vite + React or Next.js site, checks it, and takes it out again: unbase init, unbase doctor, unbase uninstall.",
3
+ "version": "0.4.0",
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",
7
7
  "bin": {