Skip to content

Commit f5e90b7

Browse files
committed
Keep /zero for Zero 0.8 and add no redirects
No First app exists in production, so nothing documents First at a published URL today. /docs/zero now documents Zero 0.8 (the page moves from /zero-migrate, which was never published), First is at /first, and the redirect rules are unchanged from the base branch.
1 parent 8316f41 commit f5e90b7

10 files changed

Lines changed: 30 additions & 21 deletions

File tree

‎content/(dynamic)/first.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ sf first import emdash ../site --output app/first.config.ts
254254

255255
`sf first import` reads a Payload, EmDash, or Sanity schema and writes a new `first.config.ts`. It never runs code from the other CMS and never overwrites a file. Anything First cannot hold refuses the import, and nothing is written. Every write rule starts as denied, so set `access` before you publish.
256256

257-
Have a Zero app on Spacefast, one with `"runtime": { "kind": "zero" }` in `sf.jsonc`? Zero is retired. See [Zero 0.8](/zero-migrate).
257+
Have a Zero app on Spacefast, one with `"runtime": { "kind": "zero" }` in `sf.jsonc`? Zero is retired. See [Zero 0.8](/zero).
258258

259259
<CardGroup cols={2}>
260260
<Card title="Database" href="/database" icon="database">

‎content/(dynamic)/meta.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ export default defineMeta({
44
title: "Dynamic",
55
collapsed: false,
66
order: 5,
7-
pages: ["first", "functions", "database", "environment-variables", "crons", "object-storage", "logs", "wordpress", "zero-migrate"],
7+
pages: ["first", "functions", "database", "environment-variables", "crons", "object-storage", "logs", "wordpress", "zero"],
88
});
File renamed without changes.

‎content/(reference)/glossary.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ An immutable snapshot created when a publish produces a new version. A ready ver
5353

5454
## Zero
5555

56-
The retired runtime that First replaced: a `capsule()` in `server/index.ts`, declared in `sf.jsonc` as `"runtime": { "kind": "zero" }`. Existing Zero Spaces keep serving and publishing. Zero 0.9 is its last release apart from security fixes, and it moves apps to First. See [Zero 0.8](/zero-migrate).
56+
The retired runtime that First replaced: a `capsule()` in `server/index.ts`, declared in `sf.jsonc` as `"runtime": { "kind": "zero" }`. Existing Zero Spaces keep serving and publishing. Zero 0.9 is its last release apart from security fixes, and it moves apps to First. See [Zero 0.8](/zero).

‎content/cli/db.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Every command here takes the global flags (`--api-url`, `--profile`, `--token`,
1111

1212
There is no connection string anywhere in the CLI or the API. `sf db console` is how you reach the database directly.
1313

14-
A Zero 0.8 app that declares `"runtime": { "kind": "zero" }` in `sf.jsonc` also has `sf db`, `sf db list`, `sf db dump`, `sf db export`, and `sf db migrate`. See [Zero 0.8](/zero-migrate#read-and-migrate-its-database).
14+
A Zero 0.8 app that declares `"runtime": { "kind": "zero" }` in `sf.jsonc` also has `sf db`, `sf db list`, `sf db dump`, `sf db export`, and `sf db migrate`. See [Zero 0.8](/zero#read-and-migrate-its-database).
1515

1616
## sf db console
1717

‎content/cli/first.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ sf first migrate app ...
133133
| --- | --- |
134134
| `config` | The same schema import as [`sf first import`](#sf-first-import), with its own flags |
135135
| `site` | Moves a Zero 0.8 site's content into the app's collections on a standalone WordPress, through WP-CLI. It does not touch a Space. `--dry-run` previews it. Needs the native compiler, like `sf first build` |
136-
| `app` | Converts a Zero 0.8 app's source. See [Zero 0.8](/zero-migrate) |
136+
| `app` | Converts a Zero 0.8 app's source. See [Zero 0.8](/zero) |
137137

138138
```bash
139139
sf first migrate config --from payload payload.config.ts --out app/first.config.ts

‎content/cli/publish.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ Start the local dev server.
295295
sf dev
296296
```
297297

298-
In a Pages project, `sf dev` serves a Pages preview with sample data and the publish-time expander at `/_spacefast/pages/<id>`. It is not a local mirror of what publish serves, and there is no static file server for your site on that path. For a [First](/first) app, run `sf first dev`. A Zero 0.8 app, one that declares `"runtime": { "kind": "zero" }` in `sf.jsonc`, gets its own Zero 0.8 dev server from `sf dev` instead of a Pages preview. See [Zero 0.8](/zero-migrate#keep-working-on-a-08-app). For a framework project, use that framework's own dev server (`next dev`, `vite`), then run `sf publish` when you're ready.
298+
In a Pages project, `sf dev` serves a Pages preview with sample data and the publish-time expander at `/_spacefast/pages/<id>`. It is not a local mirror of what publish serves, and there is no static file server for your site on that path. For a [First](/first) app, run `sf first dev`. A Zero 0.8 app, one that declares `"runtime": { "kind": "zero" }` in `sf.jsonc`, gets its own Zero 0.8 dev server from `sf dev` instead of a Pages preview. See [Zero 0.8](/zero#keep-working-on-a-08-app). For a framework project, use that framework's own dev server (`next dev`, `vite`), then run `sf publish` when you're ready.
299299

300300
| Flag | Default | What it does |
301301
| --- | --- | --- |

‎redirects.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,10 @@ export const redirects: { from: string; to: string; status: 301 }[] = [
6161
{ from: "/recipes/preview-channels", to: "/versions", status: 301 },
6262
{ from: "/recipes/redirects", to: "/routing", status: 301 },
6363
{ from: "/redirects", to: "/routing", status: 301 },
64-
{ from: "/runtimes", to: "/first", status: 301 },
64+
{ from: "/runtimes", to: "/zero", status: 301 },
6565
{ from: "/runtimes/functions", to: "/functions", status: 301 },
66-
{ from: "/runtimes/zero", to: "/first", status: 301 },
66+
{ from: "/runtimes/zero", to: "/zero", status: 301 },
6767
{ from: "/sdk", to: "/api/sdk", status: 301 },
68-
{ from: "/zero", to: "/first", status: 301 },
6968
{ from: "/spaces/rename", to: "/spaces", status: 301 },
7069
{ from: "/versions-and-rollback", to: "/versions", status: 301 },
7170
{ from: "/workflow/agent-auth", to: "/agents/permissions", status: 301 },

‎scripts/redirect-rules.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ const authoredRedirectRules = [
2323
{
2424
from: `${deploymentBase}/apps/zero`,
2525
status: 301,
26-
to: `${deploymentBase}/first/`,
26+
to: `${deploymentBase}/zero/`,
2727
},
2828
{
2929
from: `${deploymentBase}/zero-runtime`,
3030
status: 301,
31-
to: `${deploymentBase}/first/`,
31+
to: `${deploymentBase}/zero/`,
3232
},
3333
{
3434
from: `${deploymentBase}/storage`,

‎scripts/rename-to-first.mjs‎

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ import path from "node:path";
1010

1111
const root = process.cwd();
1212

13-
// 1. File moves. The v2 page and the CLI page become /first and /cli/first.
14-
// zero-migrate stays: it is the page about Zero 0.8.
13+
// 1. File moves, in order. The v2 page and its CLI page become /first and
14+
// /cli/first; then the Zero 0.8 page takes over /zero, which documents Zero.
15+
// A move runs only while its source exists and its target does not.
1516
const moves = [
1617
["content/(dynamic)/zero.mdx", "content/(dynamic)/first.mdx"],
1718
["content/cli/zero.mdx", "content/cli/first.mdx"],
19+
["content/(dynamic)/zero-migrate.mdx", "content/(dynamic)/zero.mdx"],
1820
];
21+
const zero08Page = path.join("content", "(dynamic)", "zero.mdx");
1922

2023
// 2. Names that must survive the text pass untouched, because Zero 0.8 or the
2124
// production API and engine already ship them. Each is swapped for a token
@@ -28,8 +31,8 @@ const kept = [
2831
"@spacefast/zero/client",
2932
"@spacefast/zero",
3033
"--from zero-0.8",
31-
"/zero-migrate",
32-
"zero-migrate",
34+
// Links to the Zero 0.8 page at /zero; longer entries before shorter ones.
35+
"Zero 0.8](/zero",
3336
"Zero 0.8",
3437
"Zero 0.9",
3538
"older Zero app",
@@ -86,6 +89,10 @@ const replacements = [
8689
["(/cli/zero#", "(/cli/first#"],
8790
['href="/cli/zero"', 'href="/cli/first"'],
8891
["#sf-zero-", "#sf-first-"],
92+
// Navigation entries in meta.ts.
93+
['["zero", "functions"', '["first", "functions"'],
94+
['"wordpress", "zero-migrate"]', '"wordpress", "zero"]'],
95+
[' "zero",\n', ' "first",\n'],
8996
// Files, folders and wire names of a First app.
9097
["zero.config.ts", "first.config.ts"],
9198
["zero.gen.ts", "first.gen.ts"],
@@ -113,8 +120,6 @@ const replacements = [
113120
["static\\|zero\\|functions", "static\\|first\\|functions"],
114121
["`zero` writes a starter", "`first` writes a starter"],
115122
["Zero compiler", "First compiler"],
116-
// Navigation entries in meta.ts.
117-
['"zero"', '"first"'],
118123
// Product name in prose, after every 0.8 phrase is protected above.
119124
["Zero v2", "First"],
120125
["Zero's", "First's"],
@@ -158,30 +163,35 @@ async function files(entry) {
158163
return out;
159164
}
160165

166+
// Links to the Zero 0.8 page, rewritten before any name is protected: the page
167+
// moved from /zero-migrate to /zero, and its title is now "Zero 0.8".
168+
const prepass = [["[Migrate an older Zero app](/zero-migrate", "[Zero 0.8](/zero"]];
169+
161170
function renameText(source, file) {
162171
// The Zero 0.8 page names the old runtime throughout; only its links to the
163172
// First pages and First's own names change there.
164-
const zero08Page = file.endsWith(path.join("(dynamic)", "zero-migrate.mdx"));
173+
const isZero08Page = file === path.join(root, zero08Page);
165174
const tokens = [];
166175
let text = source;
176+
for (const [from, to] of prepass) text = text.split(from).join(to);
167177
const protect = (value) => {
168178
text = text.split(value).join(`\u0000${tokens.length}\u0000`);
169179
tokens.push(value);
170180
};
171181
for (const value of kept) protect(value);
172-
if (zero08Page) {
182+
if (isZero08Page) {
173183
for (const value of ["Zero app", "Zero apps", "a Zero", "Zero's", "Zero 0.9", "Zero."]) protect(value);
174184
}
175185
for (const [from, to] of replacements) {
176-
if (zero08Page && (from === "Zero" || from === "Zero's")) continue;
186+
if (isZero08Page && (from === "Zero" || from === "Zero's")) continue;
177187
text = text.split(from).join(to);
178188
}
179189
return text.replace(/\u0000(\d+)\u0000/gu, (_, index) => tokens[Number(index)]);
180190
}
181191

182192
let moved = 0;
183193
for (const [from, to] of moves) {
184-
if (await exists(path.join(root, from))) {
194+
if ((await exists(path.join(root, from))) && !(await exists(path.join(root, to)))) {
185195
await rename(path.join(root, from), path.join(root, to));
186196
moved += 1;
187197
}

0 commit comments

Comments
 (0)