Color mode

Deploy

Static hosting output helpers for Riebeckite. The plugin prepares the files a deploy target needs and emits them through the build's generated-output sink. It does not upload anything and never writes to the filesystem.

日本語

Overview

deployPlugin() reads public redirects from the content manifest and plans the provider-specific files for Cloudflare Pages, Netlify, Vercel, or GitHub Pages. All planning is pure and deterministic: no timestamps, no randomness, and a stable path order.

Usage

ts
import { defineConfig } from "@riebeckite/core";
import { deployPlugin } from "@riebeckite/plugin-deploy";
 
export default defineConfig({
  plugins: [
    deployPlugin({
      provider: ["cloudflare-pages", "github-pages"],
      cname: "example.com",
      headers: { "X-Frame-Options": "DENY" },
    }),
  ],
});

Redirects come only from manifest.publicRedirects, so unpublished notes never leak their old paths into deploy files. A redirect whose target slug is missing is skipped and reported with a deploy-unresolved-redirect diagnostic.

Per-provider output

Provider Files
cloudflare-pages, netlify _redirects (when redirects exist), _headers (when headers are configured)
vercel vercel.json
github-pages .nojekyll, 404.html, CNAME (when configured), one <from>/index.html meta-refresh stub per redirect

GitHub Pages has no _redirects syntax, so every redirect becomes an HTML stub with a meta refresh and a <link rel="canonical">. A redirect from / is skipped because the root cannot be stubbed.

Public API

  • deployPlugin(options: DeployOptions): RiebeckitePlugin
  • planDeployOutputs({ provider, redirects, options }): DeployOutput[]
  • renderRedirectLines(redirects): string
  • renderVercelConfig({ redirects, options }): string
  • renderRedirectStub(redirect): string

Notes

  • Multiple providers are unioned. Identical files collapse into one; the same path with different content throws.
  • Redirect from values are resolved (. and .. segments) before they become output paths, and every planned path passes normalizeGeneratedOutputPath.
  • Uploading, cache invalidation, and provider authentication are out of scope.

See also

History

1 changesCollapseExpand
1 + <!-- Generated from packages/plugins/deploy/README.md. Do not edit this page directly; edit the package README and run `pnpm docs:sync`. -->
2 +
3 + # Deploy
4 +
5 + Static hosting output helpers for Riebeckite. The plugin prepares the files a
6 + deploy target needs and emits them through the build's generated-output sink.
7 + It does not upload anything and never writes to the filesystem.
8 +
9 + [日本語](./deploy.md)
10 +
11 + ## Overview
12 +
13 + `deployPlugin()` reads public redirects from the content manifest and plans the
14 + provider-specific files for Cloudflare Pages, Netlify, Vercel, or GitHub Pages.
15 + All planning is pure and deterministic: no timestamps, no randomness, and a
16 + stable path order.
17 +
18 + ## Usage
19 +
20 + ```ts
21 + import { defineConfig } from "@riebeckite/core";
22 + import { deployPlugin } from "@riebeckite/plugin-deploy";
23 +
24 + export default defineConfig({
25 + plugins: [
26 + deployPlugin({
27 + provider: ["cloudflare-pages", "github-pages"],
28 + cname: "example.com",
29 + headers: { "X-Frame-Options": "DENY" },
30 + }),
31 + ],
32 + });
33 + ```
34 +
35 + Redirects come only from `manifest.publicRedirects`, so unpublished notes never
36 + leak their old paths into deploy files. A redirect whose target slug is missing
37 + is skipped and reported with a `deploy-unresolved-redirect` diagnostic.
38 +
39 + ## Per-provider output
40 +
41 + | Provider | Files |
42 + | --- | --- |
43 + | `cloudflare-pages`, `netlify` | `_redirects` (when redirects exist), `_headers` (when headers are configured) |
44 + | `vercel` | `vercel.json` |
45 + | `github-pages` | `.nojekyll`, `404.html`, `CNAME` (when configured), one `<from>/index.html` meta-refresh stub per redirect |
46 +
47 + GitHub Pages has no `_redirects` syntax, so every redirect becomes an HTML stub
48 + with a meta refresh and a `<link rel="canonical">`. A redirect from `/` is
49 + skipped because the root cannot be stubbed.
50 +
51 + ## Public API
52 +
53 + - `deployPlugin(options: DeployOptions): RiebeckitePlugin`
54 + - `planDeployOutputs({ provider, redirects, options }): DeployOutput[]`
55 + - `renderRedirectLines(redirects): string`
56 + - `renderVercelConfig({ redirects, options }): string`
57 + - `renderRedirectStub(redirect): string`
58 +
59 + ## Notes
60 +
61 + - Multiple providers are unioned. Identical files collapse into one; the same
62 + path with different content throws.
63 + - Redirect `from` values are resolved (`.` and `..` segments) before they become
64 + output paths, and every planned path passes `normalizeGeneratedOutputPath`.
65 + - Uploading, cache invalidation, and provider authentication are out of scope.
66 +
67 + ## See also
68 +
69 + - [Plugin guide](../reference/plugin-api.en.md)
70 +