create-spillway 0.1.26 → 0.1.28
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 +3 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/templates/astro/.env.example +6 -0
- package/templates/astro/README.md +29 -6
- package/templates/astro/astro.config.mjs +46 -5
- package/templates/astro/package.json +3 -0
- package/templates/astro/public/spillway-search.js +85 -0
- package/templates/astro/public/spillway-suggest.js +10 -3
- package/templates/astro/src/layouts/Layout.astro +19 -7
- package/templates/astro/src/lib/output.ts +28 -0
- package/templates/astro/src/lib/spillway.ts +10 -4
- package/templates/astro/src/lib/static-paths.ts +26 -0
- package/templates/astro/src/middleware.ts +4 -2
- package/templates/astro/src/pages/[...path].astro +26 -8
- package/templates/next/.env.example +6 -0
- package/templates/next/README.md +30 -7
- package/templates/next/app/[[...slug]]/page.static.tsx +103 -0
- package/templates/next/app/layout.tsx +8 -4
- package/templates/next/app/not-found.tsx +3 -2
- package/templates/next/app/robots.ts +3 -0
- package/templates/next/app/sitemap.ts +3 -0
- package/templates/next/components/MembersOnly.tsx +10 -1
- package/templates/next/components/Nav.tsx +7 -4
- package/templates/next/components/SiteShell.tsx +24 -7
- package/templates/next/components/StaticSearchPage.tsx +35 -0
- package/templates/next/lib/output.ts +36 -0
- package/templates/next/lib/spillway.ts +7 -9
- package/templates/next/next.config.ts +37 -4
- package/templates/next/package.json +3 -0
- package/templates/next/public/spillway-search.js +85 -0
- package/templates/next/public/spillway-suggest.js +10 -3
- package/templates/nuxt/README.md +2 -0
- package/templates/nuxt/package.json +3 -0
- package/templates/nuxt/public/spillway-suggest.js +10 -3
- package/templates/sveltekit/README.md +2 -0
- package/templates/sveltekit/package.json +3 -0
- package/templates/sveltekit/static/spillway-suggest.js +10 -3
- /package/templates/astro/src/{pages → server-routes}/api/preview/exit.ts +0 -0
- /package/templates/astro/src/{pages → server-routes}/api/preview/index.ts +0 -0
- /package/templates/astro/src/{pages → server-routes}/api/revalidate.ts +0 -0
- /package/templates/astro/src/{pages → server-routes}/api/search/suggest.ts +0 -0
- /package/templates/astro/src/{pages → server-routes}/auth/callback.ts +0 -0
- /package/templates/astro/src/{pages → server-routes}/auth/login.ts +0 -0
- /package/templates/astro/src/{pages → server-routes}/auth/logout.ts +0 -0
- /package/templates/next/app/[[...slug]]/{page.tsx → page.server.tsx} +0 -0
- /package/templates/next/app/api/preview/exit/{route.ts → route.server.ts} +0 -0
- /package/templates/next/app/api/preview/{route.ts → route.server.ts} +0 -0
- /package/templates/next/app/api/revalidate/{route.ts → route.server.ts} +0 -0
- /package/templates/next/app/api/search/suggest/{route.ts → route.server.ts} +0 -0
- /package/templates/next/app/auth/callback/{route.ts → route.server.ts} +0 -0
- /package/templates/next/app/auth/login/{route.ts → route.server.ts} +0 -0
- /package/templates/next/app/auth/logout/{route.ts → route.server.ts} +0 -0
- /package/templates/next/app/member/[[...slug]]/{page.tsx → page.server.tsx} +0 -0
- /package/templates/next/app/search/{page.tsx → page.server.tsx} +0 -0
- /package/templates/next/{proxy.ts → proxy.server.ts} +0 -0
package/README.md
CHANGED
|
@@ -15,7 +15,9 @@ It asks for the framework, your Spillway site's address and, optionally, an API
|
|
|
15
15
|
- **Nuxt** (Nuxt 4): the block area as Spillway renders it in HTML, inside Vue pages; an in-memory cache the webhook purges, cookie previews.
|
|
16
16
|
- **SvelteKit** (SvelteKit 3, Node adapter): the block area as Spillway renders it in HTML, inside Svelte pages; an in-memory cache the webhook purges, cookie previews.
|
|
17
17
|
|
|
18
|
-
Each has one catch-all route for every published path and a 404 for the rest, Spillway's redirects, the SEO data (title, description, canonical, hreflang alternates, Open Graph, JSON-LD), the main and footer menus, a search page with suggestions while visitors type, a language switcher on a site with several languages, the site's brand through [`@spillway-cms/brand`](https://github.com/kwall-llc/spillway-cms/tree/main/packages/brand), previews from release share links or drafts, a revalidation route that verifies the webhook signature, `sitemap.xml` and `robots.txt`. Each starter's README lists its files and the setup steps. Members
|
|
18
|
+
Each has one catch-all route for every published path and a 404 for the rest, Spillway's redirects, the SEO data (title, description, canonical, hreflang alternates, Open Graph, JSON-LD), the main and footer menus, a search page with suggestions while visitors type, a language switcher on a site with several languages, the site's brand through [`@spillway-cms/brand`](https://github.com/kwall-llc/spillway-cms/tree/main/packages/brand), previews from release share links or drafts, a revalidation route that verifies the webhook signature, `sitemap.xml` and `robots.txt`. Each starter's README lists its files and the setup steps. Members sign in on the front end through Spillway's OpenID Connect provider.
|
|
19
|
+
|
|
20
|
+
The Next.js and Astro starters also build as plain files for a host that only serves files: `SPILLWAY_OUTPUT=static npm run build`, with `SPILLWAY_BASE_PATH` for a site served under a path (each starter's README, Static output). The generated `package.json` names its starter (`"spillway": { "starter": "next" }`), so a host that builds front ends can tell which one it is.
|
|
19
21
|
|
|
20
22
|
## Options
|
|
21
23
|
|
package/dist/index.d.ts
CHANGED
|
@@ -114,8 +114,12 @@ export interface ScaffoldResult {
|
|
|
114
114
|
* Writes the starter. Refuses (with `UsageError`) a target that exists and is not empty, so it never overwrites anything.
|
|
115
115
|
*/
|
|
116
116
|
export declare function scaffold(opts: ScaffoldOptions): ScaffoldResult;
|
|
117
|
-
/**
|
|
118
|
-
|
|
117
|
+
/**
|
|
118
|
+
* The template's package.json with the project's name, the `@spillway-cms/*` packages at `^version` and, given the
|
|
119
|
+
* template, the starter it was made from (`"spillway": { "starter": "next" }`), so a host that builds front ends can tell
|
|
120
|
+
* a repository made with `npm create spillway` and which starter it is.
|
|
121
|
+
*/
|
|
122
|
+
export declare function packageJsonFor(source: string, name: string, version: string, starter?: TemplateName): string;
|
|
119
123
|
/** The events a starter revalidates on: content, menus, redirects, the site settings and the brand. */
|
|
120
124
|
export declare const WEBHOOK_EVENTS: readonly ["entity.published", "entity.unpublished", "entity.deleted", "menu.updated", "redirects.updated", "site.updated", "brand.published"];
|
|
121
125
|
/** Where the starter receives the webhook: its revalidation route. */
|
package/dist/index.js
CHANGED
|
@@ -274,7 +274,7 @@ export function scaffold(opts) {
|
|
|
274
274
|
const src = path.join(root, opts.template, file);
|
|
275
275
|
const rel = outputName(file);
|
|
276
276
|
if (rel === 'package.json') {
|
|
277
|
-
write(rel, packageJsonFor(fs.readFileSync(src, 'utf8'), packageName, version));
|
|
277
|
+
write(rel, packageJsonFor(fs.readFileSync(src, 'utf8'), packageName, version, opts.template));
|
|
278
278
|
}
|
|
279
279
|
else if (rel === 'README.md') {
|
|
280
280
|
write(rel, fs.readFileSync(src, 'utf8').replaceAll('__PROJECT_NAME__', packageName));
|
|
@@ -293,8 +293,12 @@ export function scaffold(opts) {
|
|
|
293
293
|
write(info.envFile, envFileContents({ url: opts.url, token: opts.token, webhookSecret: secrets.webhook, previewSecret: secrets.preview, siteUrl: info.devUrl }));
|
|
294
294
|
return { dir, packageName, files: files.sort(), envFile: info.envFile };
|
|
295
295
|
}
|
|
296
|
-
/**
|
|
297
|
-
|
|
296
|
+
/**
|
|
297
|
+
* The template's package.json with the project's name, the `@spillway-cms/*` packages at `^version` and, given the
|
|
298
|
+
* template, the starter it was made from (`"spillway": { "starter": "next" }`), so a host that builds front ends can tell
|
|
299
|
+
* a repository made with `npm create spillway` and which starter it is.
|
|
300
|
+
*/
|
|
301
|
+
export function packageJsonFor(source, name, version, starter) {
|
|
298
302
|
const pkg = JSON.parse(source);
|
|
299
303
|
pkg.name = name;
|
|
300
304
|
for (const deps of [pkg.dependencies, pkg.devDependencies]) {
|
|
@@ -304,6 +308,8 @@ export function packageJsonFor(source, name, version) {
|
|
|
304
308
|
if (dep.startsWith('@spillway-cms/'))
|
|
305
309
|
deps[dep] = `^${version}`;
|
|
306
310
|
}
|
|
311
|
+
if (starter)
|
|
312
|
+
pkg.spillway = { ...pkg.spillway, starter };
|
|
307
313
|
return JSON.stringify(pkg, null, 2) + '\n';
|
|
308
314
|
}
|
|
309
315
|
// ---------- The webhook rules ----------
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
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QACL,GAAG,KAAK;QACR,+GAA+G;QAC/G,yHAAyH;QACzH,gDAAgD,MAAM,CAAC,OAAO,4DAA4D;KAC3H,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-spillway",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.28",
|
|
4
4
|
"description": "Scaffold a front end of your own on Spillway CMS: `npm create spillway@latest` writes a Next.js, Astro, Nuxt or SvelteKit starter with routing, SEO, menus, redirects, search, a language switcher, the brand, previews and webhook revalidation wired up.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"LICENSE"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@spillway-cms/brand": "0.1.
|
|
46
|
+
"@spillway-cms/brand": "0.1.28"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@astrojs/compiler-rs": "^0.5.2",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"typescript": "^5.9.0",
|
|
61
61
|
"vitest": "^3.0.0",
|
|
62
62
|
"vue": "^3.5.45",
|
|
63
|
-
"@spillway-cms/astro": "0.1.
|
|
64
|
-
"@spillway-cms/blocks": "0.1.
|
|
65
|
-
"@spillway-cms/client": "0.1.
|
|
66
|
-
"@spillway-cms/next": "0.1.
|
|
63
|
+
"@spillway-cms/astro": "0.1.28",
|
|
64
|
+
"@spillway-cms/blocks": "0.1.28",
|
|
65
|
+
"@spillway-cms/client": "0.1.28",
|
|
66
|
+
"@spillway-cms/next": "0.1.28"
|
|
67
67
|
},
|
|
68
68
|
"engines": {
|
|
69
69
|
"node": ">=20.16"
|
|
@@ -33,3 +33,9 @@ SITE_URL=http://localhost:4321
|
|
|
33
33
|
|
|
34
34
|
# How long a page read from Spillway stays in the in-memory cache when no webhook purges it, in seconds; 0 turns it off.
|
|
35
35
|
SPILLWAY_CACHE_SECONDS=300
|
|
36
|
+
|
|
37
|
+
# Optional. static: `npm run build` writes plain files to dist/ for any static host instead of a server (README.md,
|
|
38
|
+
# Static output). Every page is read from Spillway while it builds; leave it out for server output.
|
|
39
|
+
SPILLWAY_OUTPUT=
|
|
40
|
+
# Optional, with static output: the path the site is served under, such as /site; empty for the root of its address.
|
|
41
|
+
SPILLWAY_BASE_PATH=
|
|
@@ -19,16 +19,18 @@ An Astro front end on a [Spillway CMS](https://spillwaycms.com) site, made with
|
|
|
19
19
|
|
|
20
20
|
| File | What it does |
|
|
21
21
|
| --- | --- |
|
|
22
|
-
| `astro.config.mjs` | Server output on the Node adapter,
|
|
22
|
+
| `astro.config.mjs` | Server output on the Node adapter (or static output, below), the `spillway()` integration (the `spillway:client` module), and the routes in `src/server-routes/` |
|
|
23
|
+
| `src/lib/output.ts` | Server or static output (`SPILLWAY_OUTPUT`), the base path, and `href()` for links with static output |
|
|
23
24
|
| `src/lib/spillway.ts` | Pages, the site settings, the brand, menus and redirects read through the cache; canonical links on `SITE_URL`; the signed preview cookie |
|
|
24
25
|
| `src/lib/cache.ts` | The in-memory cache, tagged with Spillway's cache tags and the path; `SPILLWAY_CACHE_SECONDS` bounds it |
|
|
25
26
|
| `src/pages/[...path].astro` | Every path: the page's blocks (with the query string for exposed filters and pagers), the search page at `/search`, or a 404 |
|
|
26
27
|
| `src/layouts/Layout.astro` | The head from the page's SEO data (title, description, canonical, hreflang, Open Graph, JSON-LD), the brand, the block stylesheet, the `main` and `footer` menus, the language switcher, the preview bar |
|
|
27
|
-
| `src/
|
|
28
|
+
| `src/server-routes/api/search/suggest.ts`, `public/spillway-suggest.js` | Search suggestions while visitors type |
|
|
28
29
|
| `src/middleware.ts` | Spillway's redirects (301 and 302), before any page |
|
|
29
|
-
| `src/
|
|
30
|
-
| `src/
|
|
30
|
+
| `src/server-routes/api/revalidate.ts` | The webhook target: verifies `X-Spillway-Signature` and purges the paths and tags the event touched (`affectedByWebhook`) |
|
|
31
|
+
| `src/server-routes/api/preview/index.ts`, `exit.ts` | Starts a preview from a release share link or `?preview=1&secret=`, and ends it |
|
|
31
32
|
| `src/pages/sitemap.xml.ts`, `robots.txt.ts` | `/sitemap.xml` from the published paths, `/robots.txt` |
|
|
33
|
+
| `src/lib/static-paths.ts`, `public/spillway-search.js` | Static output only: the paths to write, and the search results read in the browser |
|
|
32
34
|
| `scripts/brand.mjs` | Writes the brand stylesheet (`src/styles/spillway-brand.css`) with `@spillway-cms/brand`; runs before every build |
|
|
33
35
|
|
|
34
36
|
Forms post straight to Spillway (the public form endpoint accepts posts from other origins) and media load from it.
|
|
@@ -49,7 +51,7 @@ Members of the Spillway site sign in on this front end through the site's own Op
|
|
|
49
51
|
2. Set `SPILLWAY_MEMBERS_CLIENT_ID` (and `SPILLWAY_MEMBERS_CLIENT_SECRET` for a confidential front end) in the env file. `MEMBER_SESSION_SECRET` seals the session cookie; create-spillway wrote a random one. `SPILLWAY_URL` must be the site's own address, the provider's issuer.
|
|
50
52
|
3. Restart. The header has **Sign in**; a members-only page asks visitors to sign in, and shows a member what Spillway shows them.
|
|
51
53
|
|
|
52
|
-
The session is one `HttpOnly` cookie, sealed with `MEMBER_SESSION_SECRET`, holding the member's tokens; the browser cannot read it, and over https it is named `__Host-spillway_member`, so no other site, not even a sibling subdomain, can plant one. `src/middleware.ts` reads the session into `Astro.locals.member` (refreshing it when its access token is about to expire), and a member's pages are read with their own access token, never through the cache. The routes are `src/
|
|
54
|
+
The session is one `HttpOnly` cookie, sealed with `MEMBER_SESSION_SECRET`, holding the member's tokens; the browser cannot read it, and over https it is named `__Host-spillway_member`, so no other site, not even a sibling subdomain, can plant one. `src/middleware.ts` reads the session into `Astro.locals.member` (refreshing it when its access token is about to expire), and a member's pages are read with their own access token, never through the cache. The routes are `src/server-routes/auth/login.ts`, `callback.ts` and `logout.ts`; `src/lib/members.ts` holds the rest. Sign out ends the sign-in at Spillway too. The flow is `@spillway-cms/client/members`: the authorization code flow with PKCE, `state` and `nonce`, and the ID token checked against the site's keys, with no other dependency.
|
|
53
55
|
|
|
54
56
|
## Previews
|
|
55
57
|
|
|
@@ -71,6 +73,27 @@ npm run build
|
|
|
71
73
|
npm start # node dist/server/entry.mjs with .env loaded; PORT and HOST set the address
|
|
72
74
|
```
|
|
73
75
|
|
|
74
|
-
Run it on any host with Node 22 (a container, Fly.io, Render, a VM) with the variables from `.env.example` and `SITE_URL` the public address, then point the webhook rules at it. The cache lives in the server process: with several instances or a CDN in front, purge those in `src/
|
|
76
|
+
Run it on any host with Node 22 (a container, Fly.io, Render, a VM) with the variables from `.env.example` and `SITE_URL` the public address, then point the webhook rules at it. The cache lives in the server process: with several instances or a CDN in front, purge those in `src/server-routes/api/revalidate.ts` too (`affected.tags` are the tags Spillway sends as `Cache-Tag`). For a serverless host, swap `@astrojs/node` for that host's adapter.
|
|
77
|
+
|
|
78
|
+
## Static output
|
|
79
|
+
|
|
80
|
+
With `SPILLWAY_OUTPUT=static`, `npm run build` writes plain files to `dist/` (Astro's static output, without the Node adapter) for a host that only serves files, such as a host that builds the front end and publishes what the build writes:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
SPILLWAY_OUTPUT=static SPILLWAY_BASE_PATH=/site npm run build # SPILLWAY_BASE_PATH is optional
|
|
84
|
+
npx serve dist # look at it locally
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Every page is read from Spillway while it builds, as a visitor sees it: one file for each published path (`about.html`, `es/about.html`), for each redirect in Spillway (a page that sends the browser on), for each language's search page, and `404.html` for the rest (`src/lib/static-paths.ts`). A page published later appears with the next build, so rebuild on a publish: point the webhook rules at your host's deploy hook instead of `/api/revalidate`. The build stops with the reason when Spillway cannot be read, rather than writing a site without pages. It does not use `SPILLWAY_TOKEN`, and `SPILLWAY_SITE` needs it, so set `SPILLWAY_URL` to the site's own address.
|
|
88
|
+
|
|
89
|
+
What changes:
|
|
90
|
+
|
|
91
|
+
- **The routes in `src/server-routes/` are left out**, since they need a server: `/api/revalidate`, `/api/preview`, `/api/search/suggest` and the sign-in routes under `/auth`. `astro.config.mjs` adds them with server output only; put routes of your own that need a server there too, and list them in it. `src/middleware.ts` does nothing while the pages are written.
|
|
92
|
+
- **`SPILLWAY_BASE_PATH`**: the path the site is served under (`/site`). Astro's `base` puts it on its own files; `href()` in `src/lib/output.ts` and `renderPage(page, { links })` put it on the menus, the language switcher and the links in Spillway's blocks. `SITE_URL` is the address with or without it.
|
|
93
|
+
- **Forms post to Spillway** and media load from it, as with server output; `renderPage(page, { links })` also points any link to Spillway's own paths (`/account`, `/media`) at `SPILLWAY_URL`.
|
|
94
|
+
- **Search runs in the browser.** `public/spillway-suggest.js` asks Spillway's public `GET /api/search/suggest` for suggestions, and `public/spillway-search.js` shows the results on the search page from `GET /api/search`; Spillway lets any origin read both, and they show published pages only. Without JavaScript, the search page links to the search on the Spillway site.
|
|
95
|
+
- **Members sign in on the Spillway site.** Members-only pages are not in the build (the public API leaves them out). On a site with accounts on (Site settings → Accounts), the header links **Sign in** and **Account** to the site's own account pages, and a members-only page links to the site's sign-in, which returns to that page on the site.
|
|
96
|
+
- **Blocks that read the address** (a Collection's filters and pager, a calendar's month) show their first view: a file is the same for every query string.
|
|
97
|
+
- **Previews stay with Spillway**: the admin's Preview and release share links show Spillway's own render.
|
|
75
98
|
|
|
76
99
|
See [the headless docs](https://github.com/kwall-llc/spillway-cms/blob/main/docs/adapters.md) for the API and the adapters.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineConfig } from 'astro/config';
|
|
2
2
|
import node from '@astrojs/node';
|
|
3
3
|
import { spillway } from '@spillway-cms/astro';
|
|
4
|
+
import { normalizeBasePath } from '@spillway-cms/client';
|
|
4
5
|
|
|
5
6
|
// .env holds SPILLWAY_URL, SPILLWAY_TOKEN and the secrets (create-spillway wrote it; .env.example explains each). They are
|
|
6
7
|
// read from process.env at run time and never written into the build: `npm start` loads .env, a host sets them itself.
|
|
@@ -10,12 +11,52 @@ try {
|
|
|
10
11
|
// no .env: the environment provides the values
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const output = (process.env.SPILLWAY_OUTPUT ?? '').trim().toLowerCase();
|
|
15
|
+
if (output && output !== 'server' && output !== 'static') {
|
|
16
|
+
throw new Error(`SPILLWAY_OUTPUT is "${process.env.SPILLWAY_OUTPUT}": set it to static for plain files, or leave it out (server) for a Node server.`);
|
|
17
|
+
}
|
|
18
|
+
const STATIC = output === 'static';
|
|
19
|
+
|
|
20
|
+
// The routes only a server answers: the webhook, previews, search suggestions and members' sign-in. They live in
|
|
21
|
+
// src/server-routes/, at the paths they answer, and are added with server output only.
|
|
22
|
+
const SERVER_ROUTES = { '/api/revalidate': 'api/revalidate', '/api/preview': 'api/preview/index', '/api/preview/exit': 'api/preview/exit', '/api/search/suggest': 'api/search/suggest', '/auth/login': 'auth/login', '/auth/callback': 'auth/callback', '/auth/logout': 'auth/logout' };
|
|
23
|
+
const serverRoutes = {
|
|
24
|
+
name: 'server-routes',
|
|
25
|
+
hooks: {
|
|
26
|
+
'astro:config:setup': ({ injectRoute }) => {
|
|
27
|
+
for (const [pattern, file] of Object.entries(SERVER_ROUTES)) injectRoute({ pattern, entrypoint: `./src/server-routes/${file}.ts` });
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
if (STATIC) await checkStaticBuild();
|
|
33
|
+
|
|
34
|
+
// Server output on the Node adapter (the default): every page is rendered on request from Spillway's content and cached
|
|
35
|
+
// in memory (src/lib/cache.ts) until a webhook says it changed. Static output (SPILLWAY_OUTPUT=static, README.md): every
|
|
36
|
+
// page is read from Spillway at build time and written to dist/ as <path>.html, under SPILLWAY_BASE_PATH.
|
|
37
|
+
// `spillway()` registers the `spillway:client` module.
|
|
15
38
|
export default defineConfig({
|
|
16
|
-
output: 'server',
|
|
17
|
-
adapter: node({ mode: 'standalone' }),
|
|
39
|
+
...(STATIC ? { output: 'static', base: normalizeBasePath(process.env.SPILLWAY_BASE_PATH) || undefined, build: { format: 'file' } } : { output: 'server', adapter: node({ mode: 'standalone' }) }),
|
|
18
40
|
site: process.env.SITE_URL || undefined,
|
|
19
41
|
// SPILLWAY_SITE picks one site of a multisite instance (with SPILLWAY_TOKEN); the site key is not a secret.
|
|
20
|
-
integrations: [spillway(process.env.SPILLWAY_SITE ? { site: process.env.SPILLWAY_SITE } : {})],
|
|
42
|
+
integrations: [spillway(process.env.SPILLWAY_SITE ? { site: process.env.SPILLWAY_SITE } : {}), ...(STATIC ? [] : [serverRoutes])],
|
|
21
43
|
});
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A static build reads every page from Spillway while it builds, so it stops at once, with the reason, when it cannot;
|
|
47
|
+
* and it names the settings only a server uses.
|
|
48
|
+
*/
|
|
49
|
+
async function checkStaticBuild() {
|
|
50
|
+
const url = (process.env.SPILLWAY_URL || 'http://localhost:3000').replace(/\/+$/, '');
|
|
51
|
+
if (process.env.SPILLWAY_SITE) {
|
|
52
|
+
throw new Error("Static output: SPILLWAY_SITE needs SPILLWAY_TOKEN, which a static build does not use. Set SPILLWAY_URL to the site's own address instead.");
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
const res = await fetch(`${url}/api/public/site`, { headers: { accept: 'application/json' }, signal: AbortSignal.timeout(15_000) });
|
|
56
|
+
if (!res.ok) throw new Error(`it answered ${res.status}`);
|
|
57
|
+
} catch (err) {
|
|
58
|
+
throw new Error(`Static output: the build reads every page from Spillway, and ${url} could not be read (${err instanceof Error ? err.message : String(err)}). Check SPILLWAY_URL.`);
|
|
59
|
+
}
|
|
60
|
+
if (process.env.SPILLWAY_TOKEN) console.warn('[spillway] static output: SPILLWAY_TOKEN is not used. The build reads what Spillway shows a visitor; previews need server output.');
|
|
61
|
+
if (process.env.SPILLWAY_MEMBERS_CLIENT_ID) console.warn('[spillway] static output: SPILLWAY_MEMBERS_CLIENT_ID is not used. Members sign in on the Spillway site; signing in here needs server output.');
|
|
62
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The search results with static output (README.md, Static output): the page is a file, so the browser reads the results
|
|
3
|
+
* itself from the Spillway site's public search (GET /api/search, published pages only, no cookies sent) for the words in
|
|
4
|
+
* the address (?q=, &page=), and shows them as the server-rendered search page does: the count, each page with the
|
|
5
|
+
* passage that matched (the matched words marked), and a pager. Text is set with textContent, never parsed as HTML.
|
|
6
|
+
*/
|
|
7
|
+
(function () {
|
|
8
|
+
var d = document;
|
|
9
|
+
function run() {
|
|
10
|
+
var box = d.querySelector('[data-sw-search-results]');
|
|
11
|
+
if (!box) return;
|
|
12
|
+
var endpoint = box.getAttribute('data-sw-endpoint') || '';
|
|
13
|
+
var locale = box.getAttribute('data-sw-locale') || '';
|
|
14
|
+
var base = box.getAttribute('data-sw-base') || '';
|
|
15
|
+
var params = new URLSearchParams(location.search);
|
|
16
|
+
var q = (params.get('q') || '').trim().slice(0, 200);
|
|
17
|
+
var page = Math.max(1, Math.min(100, parseInt(params.get('page') || '1', 10) || 1));
|
|
18
|
+
var field = box.parentNode && box.parentNode.querySelector('input[name="q"]');
|
|
19
|
+
if (field && q) field.value = q;
|
|
20
|
+
if (!q || !endpoint) return;
|
|
21
|
+
var url = endpoint + '?q=' + encodeURIComponent(q) + '&page=' + page + '&limit=10' + (locale ? '&locale=' + encodeURIComponent(locale) : '');
|
|
22
|
+
fetch(url, { headers: { accept: 'application/json' }, credentials: 'omit' })
|
|
23
|
+
.then(function (res) {
|
|
24
|
+
if (!res.ok) throw new Error(String(res.status));
|
|
25
|
+
return res.json();
|
|
26
|
+
})
|
|
27
|
+
.then(function (body) {
|
|
28
|
+
show(box, q, page, base, body || {});
|
|
29
|
+
})
|
|
30
|
+
.catch(function () {
|
|
31
|
+
box.textContent = '';
|
|
32
|
+
var p = d.createElement('p');
|
|
33
|
+
p.setAttribute('role', 'alert');
|
|
34
|
+
p.textContent = 'Search is not available right now. Please try again later.';
|
|
35
|
+
box.appendChild(p);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function el(tag, attrs, text) {
|
|
39
|
+
var node = d.createElement(tag);
|
|
40
|
+
for (var k in attrs) node.setAttribute(k, attrs[k]);
|
|
41
|
+
if (text !== undefined) node.textContent = text;
|
|
42
|
+
return node;
|
|
43
|
+
}
|
|
44
|
+
function show(box, q, page, base, body) {
|
|
45
|
+
var items = (body.items || []).filter(function (r) {
|
|
46
|
+
return typeof r.path === 'string' && r.path.charAt(0) === '/';
|
|
47
|
+
});
|
|
48
|
+
var total = body.total || 0;
|
|
49
|
+
var pages = Math.ceil(total / (body.limit || 10));
|
|
50
|
+
box.textContent = '';
|
|
51
|
+
box.appendChild(el('p', { role: 'status' }, (total === 1 ? '1 result' : total + ' results') + ' for “' + q + '”'));
|
|
52
|
+
if (items.length) {
|
|
53
|
+
var list = el('ol', { class: 'search-results' });
|
|
54
|
+
items.forEach(function (r) {
|
|
55
|
+
var li = d.createElement('li');
|
|
56
|
+
var h = d.createElement('h2');
|
|
57
|
+
h.appendChild(el('a', { href: base + r.path }, r.title));
|
|
58
|
+
li.appendChild(h);
|
|
59
|
+
// Spillway marks the matched words in a snippet «like this».
|
|
60
|
+
var parts = String(r.snippet || '').split(/[«»]/);
|
|
61
|
+
if (parts.join('')) {
|
|
62
|
+
var p = d.createElement('p');
|
|
63
|
+
parts.forEach(function (text, i) {
|
|
64
|
+
if (text) p.appendChild(i % 2 === 1 ? el('mark', {}, text) : d.createTextNode(text));
|
|
65
|
+
});
|
|
66
|
+
li.appendChild(p);
|
|
67
|
+
}
|
|
68
|
+
list.appendChild(li);
|
|
69
|
+
});
|
|
70
|
+
box.appendChild(list);
|
|
71
|
+
}
|
|
72
|
+
if (pages > 1) {
|
|
73
|
+
var nav = el('nav', { class: 'search-pager', 'aria-label': 'Result pages' });
|
|
74
|
+
var link = function (n) {
|
|
75
|
+
return location.pathname + '?q=' + encodeURIComponent(q) + (n > 1 ? '&page=' + n : '');
|
|
76
|
+
};
|
|
77
|
+
if (page > 1) nav.appendChild(el('a', { href: link(page - 1), rel: 'prev' }, 'Previous'));
|
|
78
|
+
nav.appendChild(el('span', {}, 'Page ' + page + ' of ' + pages));
|
|
79
|
+
if (page < pages) nav.appendChild(el('a', { href: link(page + 1), rel: 'next' }, 'Next'));
|
|
80
|
+
box.appendChild(nav);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (d.readyState === 'loading') d.addEventListener('DOMContentLoaded', run);
|
|
84
|
+
else run();
|
|
85
|
+
})();
|
|
@@ -4,10 +4,17 @@
|
|
|
4
4
|
* end's /api/search/suggest, which reads Spillway's published pages, and shows them as a list under the field: the arrow
|
|
5
5
|
* keys move through it, Enter opens the highlighted page, Escape closes it. Without this script the field is a plain
|
|
6
6
|
* search form. Text is set with textContent, never parsed as HTML.
|
|
7
|
+
*
|
|
8
|
+
* With static output there is no /api/search/suggest here: the script tag names Spillway's own public endpoint
|
|
9
|
+
* (data-sw-endpoint), which the browser asks directly without cookies, and the base path the pages live under
|
|
10
|
+
* (data-sw-base).
|
|
7
11
|
*/
|
|
8
12
|
(function () {
|
|
9
13
|
var d = document;
|
|
10
14
|
var count = 0;
|
|
15
|
+
var tag = d.currentScript;
|
|
16
|
+
var endpoint = (tag && tag.getAttribute('data-sw-endpoint')) || '/api/search/suggest';
|
|
17
|
+
var base = (tag && tag.getAttribute('data-sw-base')) || '';
|
|
11
18
|
function bind(input) {
|
|
12
19
|
if (input.hasAttribute('data-sw-bound') || !input.form) return;
|
|
13
20
|
input.setAttribute('data-sw-bound', '');
|
|
@@ -65,7 +72,7 @@
|
|
|
65
72
|
li.className = 'sw-suggest__item';
|
|
66
73
|
li.setAttribute('role', 'option');
|
|
67
74
|
li.setAttribute('aria-selected', 'false');
|
|
68
|
-
a.href = item.path;
|
|
75
|
+
a.href = base + item.path;
|
|
69
76
|
a.tabIndex = -1;
|
|
70
77
|
title.className = 'sw-suggest__title';
|
|
71
78
|
title.textContent = item.title;
|
|
@@ -88,8 +95,8 @@
|
|
|
88
95
|
if (q === asked) return;
|
|
89
96
|
asked = q;
|
|
90
97
|
if (q.length < 2) return show([]);
|
|
91
|
-
var url = '
|
|
92
|
-
fetch(url, { headers: { accept: 'application/json' } })
|
|
98
|
+
var url = endpoint + '?q=' + encodeURIComponent(q) + (locale ? '&locale=' + encodeURIComponent(locale) : '');
|
|
99
|
+
fetch(url, { headers: { accept: 'application/json' }, credentials: 'same-origin' })
|
|
93
100
|
.then(function (res) {
|
|
94
101
|
return res.ok ? res.json() : { items: [] };
|
|
95
102
|
})
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
/**
|
|
3
3
|
* The shell around every page: the head from the page's SEO data (canonical links on this front end's address), the
|
|
4
|
-
* brand, the block stylesheet, the main and footer menus, the language switcher and, in a preview, the preview bar.
|
|
4
|
+
* brand, the block stylesheet, the main and footer menus, the language switcher and, in a preview, the preview bar. With
|
|
5
|
+
* static output, links get the base path, and Sign in and Account go to the Spillway site when it has accounts on.
|
|
5
6
|
*/
|
|
6
7
|
import SpillwayStyles from '@spillway-cms/astro/components/SpillwayStyles.astro';
|
|
7
8
|
import { renderHead, renderMenu } from '@spillway-cms/astro/render';
|
|
@@ -9,6 +10,7 @@ import type { LanguageLink, PreviewState, PublicRender } from '@spillway-cms/cli
|
|
|
9
10
|
import type { MemberSession } from '@spillway-cms/client/members';
|
|
10
11
|
import { loadShell, withSiteUrls } from '../lib/spillway';
|
|
11
12
|
import { members } from '../lib/members';
|
|
13
|
+
import { BASE_PATH, SPILLWAY_URL, STATIC, href, htmlLinks } from '../lib/output';
|
|
12
14
|
// The brand as it was at build time (scripts/brand.mjs, run before every build): the --sw-* variables and fonts.
|
|
13
15
|
import builtCss from '../styles/spillway-brand.css?raw';
|
|
14
16
|
import builtBrand from '../styles/spillway-brand.json';
|
|
@@ -44,7 +46,12 @@ const footerItems = page?.menus.footer ?? footer?.items;
|
|
|
44
46
|
{page ? <Fragment set:html={renderHead(withSiteUrls(page))} /> : <title>{title ?? `Page not found | ${siteName}`}</title>}
|
|
45
47
|
<Fragment set:html={`<style id="spillway-brand">${brandCss}</style>`} />
|
|
46
48
|
<SpillwayStyles />
|
|
47
|
-
{
|
|
49
|
+
{/* With static output the browser asks Spillway's public API for suggestions itself. */}
|
|
50
|
+
{site?.searchSuggestions !== false && (STATIC ? (
|
|
51
|
+
<script is:inline src={`${BASE_PATH}/spillway-suggest.js`} data-sw-endpoint={`${SPILLWAY_URL}/api/search/suggest`} data-sw-base={BASE_PATH} defer></script>
|
|
52
|
+
) : (
|
|
53
|
+
<script is:inline src="/spillway-suggest.js" defer></script>
|
|
54
|
+
))}
|
|
48
55
|
</head>
|
|
49
56
|
<body>
|
|
50
57
|
<a class="skip-link" href="#main">Skip to content</a>
|
|
@@ -55,18 +62,23 @@ const footerItems = page?.menus.footer ?? footer?.items;
|
|
|
55
62
|
</div>
|
|
56
63
|
)}
|
|
57
64
|
<header class="site-header">
|
|
58
|
-
<a class="site-name" href=
|
|
59
|
-
<nav class="site-nav" aria-label="Main"><Fragment set:html={renderMenu(mainItems)} /></nav>
|
|
65
|
+
<a class="site-name" href={href('/')}>{siteName}</a>
|
|
66
|
+
<nav class="site-nav" aria-label="Main"><Fragment set:html={htmlLinks(renderMenu(mainItems))} /></nav>
|
|
60
67
|
{languages.length > 0 && (
|
|
61
68
|
<nav class="language-switcher" aria-label="Language">
|
|
62
69
|
<ul>
|
|
63
70
|
{languages.map((l) => (
|
|
64
|
-
<li><a href={l.href} hreflang={l.locale} lang={l.locale} aria-current={l.current ? 'true' : undefined}>{l.label}</a></li>
|
|
71
|
+
<li><a href={href(l.href)} hreflang={l.locale} lang={l.locale} aria-current={l.current ? 'true' : undefined}>{l.label}</a></li>
|
|
65
72
|
))}
|
|
66
73
|
</ul>
|
|
67
74
|
</nav>
|
|
68
75
|
)}
|
|
69
|
-
{
|
|
76
|
+
{STATIC ? (site?.accounts && (
|
|
77
|
+
<nav class="member-links" aria-label="Account">
|
|
78
|
+
<a class="member-link" href={`${SPILLWAY_URL}/account/login`}>Sign in</a>
|
|
79
|
+
<a class="member-link" href={`${SPILLWAY_URL}/account`}>Account</a>
|
|
80
|
+
</nav>
|
|
81
|
+
)) : members && (member ? (
|
|
70
82
|
<form class="member-links" method="post" action="/auth/logout">
|
|
71
83
|
<span class="member-name">{member.name || member.email || 'Signed in'}</span>
|
|
72
84
|
<button type="submit">Sign out</button>
|
|
@@ -77,7 +89,7 @@ const footerItems = page?.menus.footer ?? footer?.items;
|
|
|
77
89
|
</header>
|
|
78
90
|
<main id="main"><slot /></main>
|
|
79
91
|
<footer class="site-footer">
|
|
80
|
-
<nav class="site-nav" aria-label="Footer"><Fragment set:html={renderMenu(footerItems)} /></nav>
|
|
92
|
+
<nav class="site-nav" aria-label="Footer"><Fragment set:html={htmlLinks(renderMenu(footerItems))} /></nav>
|
|
81
93
|
{site?.footerNote?.split('\n').map((line) => <p>{line}</p>)}
|
|
82
94
|
</footer>
|
|
83
95
|
</body>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { frontEndUrl, normalizeBasePath, rewriteHtmlUrls } from '@spillway-cms/client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* How this site is built (README.md, Static output). By default it is a Node server: pages render on request through the
|
|
5
|
+
* cache, the webhook purges it, members sign in here and previews work. With `SPILLWAY_OUTPUT=static`, `astro build`
|
|
6
|
+
* writes plain files to dist/ for any static host instead (astro.config.mjs): every page is read from Spillway at build
|
|
7
|
+
* time, and the routes in src/server-routes/ are left out.
|
|
8
|
+
*/
|
|
9
|
+
export const STATIC = (process.env.SPILLWAY_OUTPUT ?? '').trim().toLowerCase() === 'static';
|
|
10
|
+
|
|
11
|
+
/** The Spillway site (SPILLWAY_URL in .env). */
|
|
12
|
+
export const SPILLWAY_URL = (process.env.SPILLWAY_URL || 'http://localhost:3000').replace(/\/+$/, '');
|
|
13
|
+
|
|
14
|
+
/** With static output, the path this site is served under (`SPILLWAY_BASE_PATH=/site`); '' for the root. */
|
|
15
|
+
export const BASE_PATH = STATIC ? normalizeBasePath(process.env.SPILLWAY_BASE_PATH) : '';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A link on this site: with static output, a page's path gets the base path and Spillway's own paths (the account area,
|
|
19
|
+
* media, form posts) go to the Spillway site, which has no proxy here. With server output it is unchanged.
|
|
20
|
+
*/
|
|
21
|
+
export function href(path: string): string {
|
|
22
|
+
return STATIC ? frontEndUrl(path, { basePath: BASE_PATH, origin: SPILLWAY_URL }) : path;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** `href` over the links in HTML Spillway wrote (a menu). */
|
|
26
|
+
export function htmlLinks(html: string): string {
|
|
27
|
+
return STATIC ? rewriteHtmlUrls(html, { basePath: BASE_PATH, origin: SPILLWAY_URL }) : html;
|
|
28
|
+
}
|
|
@@ -4,15 +4,21 @@
|
|
|
4
4
|
* this file from a client-side script.
|
|
5
5
|
*/
|
|
6
6
|
import type { AstroCookies } from 'astro';
|
|
7
|
-
import { client } from 'spillway:client';
|
|
7
|
+
import { client as configured } from 'spillway:client';
|
|
8
8
|
import { SpillwayError, previewFromRequest, type PreviewState } from '@spillway-cms/astro';
|
|
9
9
|
import { languageLinks, localizedPath, splitLocalePath, type LanguageLink, type PublicBrand, type PublicMenu, type PublicRedirect, type PublicRender, type PublicSite } from '@spillway-cms/client';
|
|
10
10
|
import { cached } from './cache';
|
|
11
|
+
import { BASE_PATH, STATIC } from './output';
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
/** The client; a static build reads what the public API shows a visitor, without the token (astro.config.mjs says so). */
|
|
14
|
+
export const client = STATIC ? configured.with({ token: undefined, site: undefined }) : configured;
|
|
13
15
|
|
|
14
|
-
/** This front end's own address, for canonical links, the sitemap and robots.txt. */
|
|
15
|
-
export const SITE_URL = (process.env.SITE_URL || 'http://localhost:4321').replace(/\/+$/, '');
|
|
16
|
+
/** This front end's own address with its base path, for canonical links, the sitemap and robots.txt. */
|
|
17
|
+
export const SITE_URL = withBase((process.env.SITE_URL || 'http://localhost:4321').replace(/\/+$/, ''));
|
|
18
|
+
|
|
19
|
+
function withBase(url: string): string {
|
|
20
|
+
return BASE_PATH && !url.endsWith(BASE_PATH) ? `${url}${BASE_PATH}` : url;
|
|
21
|
+
}
|
|
16
22
|
|
|
17
23
|
/** Tag of the entries every webhook purges: the site settings, the brand, the menus, the redirects and the path list. */
|
|
18
24
|
export const SHELL_TAG = 'shell';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static output (README.md, Static output): the paths src/pages/[...path].astro writes. Every published path, every
|
|
3
|
+
* redirect in Spillway (written as a page that sends the browser on), each language's search page (its results read in
|
|
4
|
+
* the browser) and the 404 page. A build that cannot read them stops with the reason. With server output there are none
|
|
5
|
+
* to list: every path renders on request.
|
|
6
|
+
*/
|
|
7
|
+
import { siteLocales } from '@spillway-cms/client';
|
|
8
|
+
import { client, searchPath } from './spillway';
|
|
9
|
+
import { STATIC } from './output';
|
|
10
|
+
|
|
11
|
+
async function staticPaths(): Promise<{ params: { path: string | undefined } }[]> {
|
|
12
|
+
let paths: string[];
|
|
13
|
+
let searches: string[];
|
|
14
|
+
try {
|
|
15
|
+
const site = await client.site();
|
|
16
|
+
paths = (await client.paths()).map((p) => p.path);
|
|
17
|
+
searches = siteLocales(site).map((locale) => searchPath(site, locale));
|
|
18
|
+
} catch (err) {
|
|
19
|
+
throw new Error(`Static output: Spillway's published paths could not be read (${err instanceof Error ? err.message : String(err)}). A static build needs them; check SPILLWAY_URL.`);
|
|
20
|
+
}
|
|
21
|
+
const redirects = await client.redirects().catch(() => []);
|
|
22
|
+
const all = new Set([...paths, ...redirects.map((r) => r.from), ...searches, '/404']);
|
|
23
|
+
return [...all].filter((p) => p.startsWith('/')).map((p) => ({ params: { path: p === '/' ? undefined : p.slice(1) } }));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const getStaticPaths = STATIC ? staticPaths : undefined;
|
|
@@ -8,12 +8,14 @@
|
|
|
8
8
|
import type { MiddlewareHandler } from 'astro';
|
|
9
9
|
import { redirectFor } from './lib/spillway';
|
|
10
10
|
import { readMember } from './lib/members';
|
|
11
|
+
import { STATIC } from './lib/output';
|
|
11
12
|
|
|
12
13
|
const SKIP = ['/api/', '/_astro/', '/_image', '/_server-islands/'];
|
|
13
14
|
|
|
14
15
|
export const onRequest: MiddlewareHandler = async (context, next) => {
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
// Static output: no requests to answer, only pages to write; src/pages/[...path].astro writes the redirects as pages.
|
|
17
|
+
if (STATIC) return next();
|
|
18
|
+
const { pathname } = context.url;
|
|
17
19
|
context.locals.member = pathname.startsWith('/_astro/') ? null : await readMember(context.cookies);
|
|
18
20
|
if (context.locals.member) {
|
|
19
21
|
const response = await page(context, next);
|