@riebeckite/honox 0.0.15 → 0.0.16
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/dist/index.d.ts +2 -0
- package/dist/index.js +307 -39
- package/dist/server.js +7 -3
- package/dist/src/scaffold/deployment.d.ts +1 -0
- package/dist/src/scaffold/index.d.ts +1 -0
- package/dist/src/scaffold/templates.d.ts +4 -1
- package/dist/src/scaffold/version.d.ts +1 -1
- package/dist/src/scaffold/wrangler-defaults.d.ts +5 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export { loadRiebeckiteConfig, resolveHonoxConfig, } from "./src/config_loader.js";
|
|
2
2
|
export { replaceHonoxIslandDependencyPlugin } from "./src/honox_islands.js";
|
|
3
|
+
export { assertGitHubRepository, deploymentTemplateFiles, type ScaffoldDeploymentOptions, } from "./src/scaffold/deployment.js";
|
|
3
4
|
export type { ScaffoldSiteOptions, ScaffoldSiteResult, } from "./src/scaffold/index.js";
|
|
4
5
|
export { ScaffoldSiteError, scaffoldRiebeckiteSite, } from "./src/scaffold/index.js";
|
|
5
6
|
export { formatScaffoldNextSteps, type ScaffoldNextStepsOptions, } from "./src/scaffold/next-steps.js";
|
|
6
7
|
export type { ScaffoldAppFileKey, ScaffoldPageKey, ScaffoldPluginSpec, ScaffoldPreset, ScaffoldPresetName, ScaffoldReadmeLevel, ScaffoldThemeSpec, } from "./src/scaffold/presets.js";
|
|
7
8
|
export { empty, isScaffoldPresetName, minimal, resolveScaffoldPreset, SCAFFOLD_DEFAULT_PRESET, SCAFFOLD_PRESET_NAMES, scaffoldPresets, showcase, starter, } from "./src/scaffold/presets.js";
|
|
9
|
+
export { buildDefaultWranglerConfig, DEFAULT_WORKER_NAME, GITHUB_ACTIONS_SECRETS, PACKAGE_MANAGER, WORKER_NAME_MAX_LENGTH, WRANGLER_DEFAULTS, WRANGLER_VERSION, type WranglerDefaults, workerNameFromDirectory, } from "./src/scaffold/wrangler-defaults.js";
|
|
8
10
|
export { createRiebeckiteSsg, defaultSsgEntry, riebeckiteSsgExtensionMap, } from "./src/ssg.js";
|
|
9
11
|
export type { RiebeckiteSsgOptions } from "./src/ssg_plugin.js";
|
|
10
12
|
export { riebeckiteSsg } from "./src/ssg_plugin.js";
|
package/dist/index.js
CHANGED
|
@@ -254,10 +254,6 @@ function isJavaScriptModule(filePath) {
|
|
|
254
254
|
return /\.[cm]?[jt]sx?$/.test(filePath);
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
// src/scaffold/index.ts
|
|
258
|
-
import fs8 from "node:fs/promises";
|
|
259
|
-
import path9 from "node:path";
|
|
260
|
-
|
|
261
257
|
// src/scaffold/wrangler-defaults.ts
|
|
262
258
|
var WRANGLER_DEFAULTS = {
|
|
263
259
|
/** JSON schema for IDE support and validation */
|
|
@@ -271,6 +267,18 @@ var WRANGLER_DEFAULTS = {
|
|
|
271
267
|
/** Static assets directory - Riebeckite builds to ./dist */
|
|
272
268
|
assets: { directory: "./dist" }
|
|
273
269
|
};
|
|
270
|
+
var WRANGLER_VERSION = "^4.83.0";
|
|
271
|
+
var DEFAULT_WORKER_NAME = "riebeckite-site";
|
|
272
|
+
var WORKER_NAME_MAX_LENGTH = 63;
|
|
273
|
+
function workerNameFromDirectory(directoryName) {
|
|
274
|
+
const normalized = directoryName.trim().toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "");
|
|
275
|
+
const name = normalized.slice(0, WORKER_NAME_MAX_LENGTH).replace(/-+$/g, "");
|
|
276
|
+
return name.length > 0 ? name : DEFAULT_WORKER_NAME;
|
|
277
|
+
}
|
|
278
|
+
function buildDefaultWranglerConfig(workerName) {
|
|
279
|
+
return `${JSON.stringify({ ...WRANGLER_DEFAULTS, name: workerName }, null, 2)}
|
|
280
|
+
`;
|
|
281
|
+
}
|
|
274
282
|
var GITHUB_ACTIONS_SECRETS = {
|
|
275
283
|
/** Cloudflare API token with Workers Scripts: Edit permission */
|
|
276
284
|
CLOUDFLARE_API_TOKEN: "CLOUDFLARE_API_TOKEN",
|
|
@@ -281,6 +289,7 @@ var GITHUB_ACTIONS_SECRETS = {
|
|
|
281
289
|
/** Optional: Token for site repo to read content repo */
|
|
282
290
|
RIEBECKITE_CONTENT_READ_TOKEN: "RIEBECKITE_CONTENT_READ_TOKEN"
|
|
283
291
|
};
|
|
292
|
+
var PACKAGE_MANAGER = "npm";
|
|
284
293
|
|
|
285
294
|
// src/scaffold/deployment.ts
|
|
286
295
|
var GITHUB_REPOSITORY_PATTERN = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
|
|
@@ -324,9 +333,14 @@ function deploymentTemplateFiles(options) {
|
|
|
324
333
|
] : []
|
|
325
334
|
];
|
|
326
335
|
}
|
|
336
|
+
function wranglerJsoncFile(workerName) {
|
|
337
|
+
return {
|
|
338
|
+
path: "wrangler.jsonc",
|
|
339
|
+
content: buildDefaultWranglerConfig(workerName)
|
|
340
|
+
};
|
|
341
|
+
}
|
|
327
342
|
function wranglerConfig() {
|
|
328
|
-
return
|
|
329
|
-
`;
|
|
343
|
+
return buildDefaultWranglerConfig(WRANGLER_DEFAULTS.name);
|
|
330
344
|
}
|
|
331
345
|
function deployWorkflow(contentRepository) {
|
|
332
346
|
const contentCheckout = contentRepository === void 0 ? "" : `
|
|
@@ -428,6 +442,10 @@ jobs:
|
|
|
428
442
|
`;
|
|
429
443
|
}
|
|
430
444
|
|
|
445
|
+
// src/scaffold/index.ts
|
|
446
|
+
import fs8 from "node:fs/promises";
|
|
447
|
+
import path9 from "node:path";
|
|
448
|
+
|
|
431
449
|
// src/scaffold/presets.ts
|
|
432
450
|
var SCAFFOLD_LANGUAGES = [
|
|
433
451
|
"en",
|
|
@@ -1951,22 +1969,38 @@ async function findWorkspaceRoot(configRoot) {
|
|
|
1951
1969
|
}
|
|
1952
1970
|
}
|
|
1953
1971
|
async function startHonoxDevServer(options) {
|
|
1954
|
-
const
|
|
1955
|
-
await
|
|
1956
|
-
|
|
1957
|
-
|
|
1972
|
+
const root = path7.resolve(options.root);
|
|
1973
|
+
await withWorkingDirectory(root, async () => {
|
|
1974
|
+
const server2 = await createServer2({ root });
|
|
1975
|
+
await server2.listen();
|
|
1976
|
+
server2.printUrls();
|
|
1977
|
+
await waitForShutdown(server2);
|
|
1978
|
+
});
|
|
1958
1979
|
}
|
|
1959
1980
|
async function buildHonoxApplication(options) {
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1981
|
+
const root = path7.resolve(options.root);
|
|
1982
|
+
await withWorkingDirectory(root, async () => {
|
|
1983
|
+
await runTraced(
|
|
1984
|
+
options.tracer,
|
|
1985
|
+
"integration.honox.client_build",
|
|
1986
|
+
() => build({ root, mode: "client" })
|
|
1987
|
+
);
|
|
1988
|
+
await runTraced(
|
|
1989
|
+
options.tracer,
|
|
1990
|
+
"integration.honox.server_build",
|
|
1991
|
+
() => build({ root })
|
|
1992
|
+
);
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1995
|
+
async function withWorkingDirectory(root, task) {
|
|
1996
|
+
const previousDirectory = process.cwd();
|
|
1997
|
+
if (previousDirectory === root) return await task();
|
|
1998
|
+
process.chdir(root);
|
|
1999
|
+
try {
|
|
2000
|
+
return await task();
|
|
2001
|
+
} finally {
|
|
2002
|
+
process.chdir(previousDirectory);
|
|
2003
|
+
}
|
|
1970
2004
|
}
|
|
1971
2005
|
async function runTraced(tracer, name, buildTask) {
|
|
1972
2006
|
return tracer ? await tracer.span(name, {}, buildTask) : await buildTask();
|
|
@@ -2239,18 +2273,112 @@ function style(preset) {
|
|
|
2239
2273
|
" justify-content: space-between;",
|
|
2240
2274
|
" gap: 1rem;",
|
|
2241
2275
|
" padding: 1rem;",
|
|
2242
|
-
" border-bottom: 1px solid
|
|
2276
|
+
" border-bottom: 1px solid var(--rb-color-border);",
|
|
2243
2277
|
"}",
|
|
2244
2278
|
"",
|
|
2245
2279
|
".site-header__home {",
|
|
2246
2280
|
" display: inline-flex;",
|
|
2247
2281
|
" align-items: center;",
|
|
2248
2282
|
" gap: 0.5rem;",
|
|
2249
|
-
" color:
|
|
2283
|
+
" color: var(--rb-color-ink);",
|
|
2250
2284
|
" font-weight: 700;",
|
|
2251
2285
|
" text-decoration: none;",
|
|
2252
2286
|
"}",
|
|
2253
2287
|
"",
|
|
2288
|
+
".rb-nav {",
|
|
2289
|
+
" color: var(--rb-color-ink);",
|
|
2290
|
+
"}",
|
|
2291
|
+
"",
|
|
2292
|
+
".rb-nav__list {",
|
|
2293
|
+
" display: flex;",
|
|
2294
|
+
" align-items: center;",
|
|
2295
|
+
" gap: 0.75rem;",
|
|
2296
|
+
" margin: 0;",
|
|
2297
|
+
" padding: 0;",
|
|
2298
|
+
" list-style: none;",
|
|
2299
|
+
"}",
|
|
2300
|
+
"",
|
|
2301
|
+
".rb-nav__item {",
|
|
2302
|
+
" position: relative;",
|
|
2303
|
+
"}",
|
|
2304
|
+
"",
|
|
2305
|
+
".rb-nav__link {",
|
|
2306
|
+
" color: inherit;",
|
|
2307
|
+
" text-decoration: none;",
|
|
2308
|
+
"}",
|
|
2309
|
+
"",
|
|
2310
|
+
".rb-nav__link:hover,",
|
|
2311
|
+
".rb-nav__link:focus-visible,",
|
|
2312
|
+
".rb-nav__link--active {",
|
|
2313
|
+
" color: var(--rb-color-accent);",
|
|
2314
|
+
"}",
|
|
2315
|
+
"",
|
|
2316
|
+
".rb-nav__link:focus-visible,",
|
|
2317
|
+
".rb-nav__toggle:focus-visible {",
|
|
2318
|
+
" outline: 2px solid var(--rb-color-accent);",
|
|
2319
|
+
" outline-offset: 2px;",
|
|
2320
|
+
"}",
|
|
2321
|
+
"",
|
|
2322
|
+
".rb-nav__children {",
|
|
2323
|
+
" display: none;",
|
|
2324
|
+
" position: absolute;",
|
|
2325
|
+
" top: 100%;",
|
|
2326
|
+
" left: 0;",
|
|
2327
|
+
" min-width: max-content;",
|
|
2328
|
+
" padding: 0.5rem;",
|
|
2329
|
+
" background: var(--rb-color-surface);",
|
|
2330
|
+
" border: 1px solid var(--rb-color-border);",
|
|
2331
|
+
"}",
|
|
2332
|
+
"",
|
|
2333
|
+
".rb-nav__item:hover > .rb-nav__children,",
|
|
2334
|
+
".rb-nav__item:focus-within > .rb-nav__children {",
|
|
2335
|
+
" display: flex;",
|
|
2336
|
+
" flex-direction: column;",
|
|
2337
|
+
" align-items: stretch;",
|
|
2338
|
+
"}",
|
|
2339
|
+
"",
|
|
2340
|
+
".rb-nav__mobile {",
|
|
2341
|
+
" display: none;",
|
|
2342
|
+
"}",
|
|
2343
|
+
"",
|
|
2344
|
+
".rb-site-footer {",
|
|
2345
|
+
" width: min(100% - 2rem, 48rem);",
|
|
2346
|
+
" margin: 1rem auto 0;",
|
|
2347
|
+
" padding-block: 1rem;",
|
|
2348
|
+
" border-top: 1px solid var(--rb-color-border);",
|
|
2349
|
+
"}",
|
|
2350
|
+
"",
|
|
2351
|
+
"@media (max-width: 48rem) {",
|
|
2352
|
+
" .rb-site-header {",
|
|
2353
|
+
" flex-wrap: wrap;",
|
|
2354
|
+
" }",
|
|
2355
|
+
"",
|
|
2356
|
+
" .rb-site-header > .rb-nav {",
|
|
2357
|
+
" display: none;",
|
|
2358
|
+
" }",
|
|
2359
|
+
"",
|
|
2360
|
+
" .rb-nav__mobile {",
|
|
2361
|
+
" display: block;",
|
|
2362
|
+
" }",
|
|
2363
|
+
"",
|
|
2364
|
+
" .rb-nav__mobile .rb-nav__list {",
|
|
2365
|
+
" flex-direction: column;",
|
|
2366
|
+
" align-items: flex-start;",
|
|
2367
|
+
" padding-top: 0.75rem;",
|
|
2368
|
+
" }",
|
|
2369
|
+
"",
|
|
2370
|
+
" .rb-nav__mobile .rb-nav__children {",
|
|
2371
|
+
" display: flex;",
|
|
2372
|
+
" position: static;",
|
|
2373
|
+
" flex-direction: column;",
|
|
2374
|
+
" align-items: flex-start;",
|
|
2375
|
+
" gap: 0.5rem;",
|
|
2376
|
+
" margin-top: 0.5rem;",
|
|
2377
|
+
" background: transparent;",
|
|
2378
|
+
" border: 0;",
|
|
2379
|
+
" }",
|
|
2380
|
+
"}",
|
|
2381
|
+
"",
|
|
2254
2382
|
".site-header__logo {",
|
|
2255
2383
|
" width: 1.75rem;",
|
|
2256
2384
|
" height: 1.75rem;",
|
|
@@ -2333,13 +2461,16 @@ function style(preset) {
|
|
|
2333
2461
|
return [...imports, ...blocks].join("\n");
|
|
2334
2462
|
}
|
|
2335
2463
|
function siteHeader() {
|
|
2336
|
-
return `import {
|
|
2464
|
+
return `import type { NavigationItem } from "@riebeckite/core";
|
|
2465
|
+
import { ColorModeToggle } from "@riebeckite/plugin-color-mode";
|
|
2337
2466
|
import { config } from "../config";
|
|
2338
2467
|
|
|
2339
|
-
export function SiteHeader() {
|
|
2468
|
+
export function SiteHeader({ path }: { path: string }) {
|
|
2469
|
+
const navigation = (config.navigation?.header ?? []).filter((item) => item.href !== "/");
|
|
2470
|
+
|
|
2340
2471
|
return (
|
|
2341
|
-
<header class="site-header">
|
|
2342
|
-
<a href="/" class="site-header__home">
|
|
2472
|
+
<header class="site-header rb-site-header">
|
|
2473
|
+
<a href="/" class="site-header__home rb-site-header__home">
|
|
2343
2474
|
<img
|
|
2344
2475
|
src="/riebeckite-logo.png"
|
|
2345
2476
|
alt=""
|
|
@@ -2349,10 +2480,85 @@ export function SiteHeader() {
|
|
|
2349
2480
|
/>
|
|
2350
2481
|
{config.site.title}
|
|
2351
2482
|
</a>
|
|
2483
|
+
{navigation.length > 0 ? (
|
|
2484
|
+
<>
|
|
2485
|
+
<SiteNavigation items={navigation} path={path} />
|
|
2486
|
+
<details class="site-navigation__mobile rb-nav__mobile">
|
|
2487
|
+
<summary class="rb-nav__toggle">Menu</summary>
|
|
2488
|
+
<SiteNavigation items={navigation} path={path} />
|
|
2489
|
+
</details>
|
|
2490
|
+
</>
|
|
2491
|
+
) : null}
|
|
2352
2492
|
<ColorModeToggle />
|
|
2353
2493
|
</header>
|
|
2354
2494
|
);
|
|
2355
2495
|
}
|
|
2496
|
+
|
|
2497
|
+
export function SiteFooter({ path }: { path: string }) {
|
|
2498
|
+
const footerNavigation = config.navigation?.footer ?? [];
|
|
2499
|
+
if (footerNavigation.length === 0) return null;
|
|
2500
|
+
|
|
2501
|
+
return (
|
|
2502
|
+
<footer class="site-footer rb-site-footer">
|
|
2503
|
+
<SiteNavigation items={footerNavigation} path={path} />
|
|
2504
|
+
</footer>
|
|
2505
|
+
);
|
|
2506
|
+
}
|
|
2507
|
+
|
|
2508
|
+
function SiteNavigation({
|
|
2509
|
+
items,
|
|
2510
|
+
path,
|
|
2511
|
+
}: {
|
|
2512
|
+
items: readonly NavigationItem[];
|
|
2513
|
+
path: string;
|
|
2514
|
+
}) {
|
|
2515
|
+
return (
|
|
2516
|
+
<nav class="site-navigation rb-nav" aria-label="Site navigation">
|
|
2517
|
+
<NavigationItems items={items} path={path} />
|
|
2518
|
+
</nav>
|
|
2519
|
+
);
|
|
2520
|
+
}
|
|
2521
|
+
|
|
2522
|
+
function NavigationItems({
|
|
2523
|
+
items,
|
|
2524
|
+
path,
|
|
2525
|
+
isChildList = false,
|
|
2526
|
+
}: {
|
|
2527
|
+
items: readonly NavigationItem[];
|
|
2528
|
+
path: string;
|
|
2529
|
+
isChildList?: boolean;
|
|
2530
|
+
}) {
|
|
2531
|
+
return (
|
|
2532
|
+
<ul class={isChildList ? "site-navigation__list rb-nav__list rb-nav__children" : "site-navigation__list rb-nav__list"}>
|
|
2533
|
+
{items.map((item) => {
|
|
2534
|
+
const active = isActive(item.href, path);
|
|
2535
|
+
return (
|
|
2536
|
+
<li class="site-navigation__item rb-nav__item">
|
|
2537
|
+
<a
|
|
2538
|
+
href={item.href}
|
|
2539
|
+
class={active ? "site-navigation__link rb-nav__link rb-nav__link--active is-active" : "site-navigation__link rb-nav__link"}
|
|
2540
|
+
aria-current={active ? "page" : undefined}
|
|
2541
|
+
target={item.external ? "_blank" : undefined}
|
|
2542
|
+
rel={item.external ? "noreferrer" : undefined}
|
|
2543
|
+
>
|
|
2544
|
+
{item.label}
|
|
2545
|
+
</a>
|
|
2546
|
+
{item.children && item.children.length > 0 ? (
|
|
2547
|
+
<NavigationItems items={item.children} path={path} isChildList />
|
|
2548
|
+
) : null}
|
|
2549
|
+
</li>
|
|
2550
|
+
);
|
|
2551
|
+
})}
|
|
2552
|
+
</ul>
|
|
2553
|
+
);
|
|
2554
|
+
}
|
|
2555
|
+
|
|
2556
|
+
function isActive(href: string, path: string): boolean {
|
|
2557
|
+
if (!href.startsWith("/")) return false;
|
|
2558
|
+
const target = href.replace(/\\/+$/, "") || "/";
|
|
2559
|
+
const current = path.replace(/^\\/[a-z]{2}(?:-[A-Z]{2})?(?=\\/|$)/, "").replace(/\\/+$/, "") || "/";
|
|
2560
|
+
return target === "/" ? current === target : current === target || current.startsWith(\`\${target}/\`);
|
|
2561
|
+
}
|
|
2356
2562
|
`;
|
|
2357
2563
|
}
|
|
2358
2564
|
function article() {
|
|
@@ -2454,7 +2660,7 @@ import { jsxRenderer } from "hono/jsx-renderer";
|
|
|
2454
2660
|
import { Link, Script } from "honox/server";
|
|
2455
2661
|
${hasColorMode ? `import { ColorModeScript } from "@riebeckite/plugin-color-mode";
|
|
2456
2662
|
` : ""}${hasSearch ? `import { SearchBar } from "@riebeckite/plugin-search";
|
|
2457
|
-
` : ""}${hasHeader ? `import { SiteHeader } from "../components/site-header";
|
|
2663
|
+
` : ""}${hasHeader ? `import { SiteFooter, SiteHeader } from "../components/site-header";
|
|
2458
2664
|
` : ""}import { config } from "../config";
|
|
2459
2665
|
|
|
2460
2666
|
function themeAttributes() {
|
|
@@ -2491,11 +2697,12 @@ ${hasColorMode ? ` <ColorModeScript />
|
|
|
2491
2697
|
{headTags.map(renderHeadTag)}
|
|
2492
2698
|
<Script src="/app/client.ts" async />
|
|
2493
2699
|
</head>
|
|
2494
|
-
<body class="riebeckite-page">
|
|
2495
|
-
${hasHeader ? ` <SiteHeader />
|
|
2700
|
+
<body class="riebeckite-page rb-site">
|
|
2701
|
+
${hasHeader ? ` <SiteHeader path={c.req.path} />
|
|
2496
2702
|
` : ""}${hasSearch ? ` <SearchBar />
|
|
2497
2703
|
` : ""} {children}
|
|
2498
|
-
|
|
2704
|
+
${hasHeader ? ` <SiteFooter path={c.req.path} />
|
|
2705
|
+
` : ""} </body>
|
|
2499
2706
|
</html>
|
|
2500
2707
|
);
|
|
2501
2708
|
});
|
|
@@ -2535,7 +2742,7 @@ export default jsxRenderer(({ children }, c) => (
|
|
|
2535
2742
|
<Link href="/app/style.css" rel="stylesheet" />
|
|
2536
2743
|
<Script src="/app/client.ts" async />
|
|
2537
2744
|
</head>
|
|
2538
|
-
<body class="riebeckite-page">{children}</body>
|
|
2745
|
+
<body class="riebeckite-page rb-site">{children}</body>
|
|
2539
2746
|
</html>
|
|
2540
2747
|
));
|
|
2541
2748
|
`;
|
|
@@ -4538,12 +4745,12 @@ function referenceThemesContent(preset) {
|
|
|
4538
4745
|
}
|
|
4539
4746
|
|
|
4540
4747
|
// src/scaffold/version.ts
|
|
4541
|
-
var RIEBECKITE_VERSION = "^0.0.
|
|
4748
|
+
var RIEBECKITE_VERSION = "^0.0.16";
|
|
4542
4749
|
|
|
4543
4750
|
// src/scaffold/templates.ts
|
|
4544
|
-
function siteTemplateFiles(preset, variables) {
|
|
4751
|
+
function siteTemplateFiles(preset, variables, options = {}) {
|
|
4545
4752
|
return [
|
|
4546
|
-
{ path: "package.json", content: packageJson(preset, variables) },
|
|
4753
|
+
{ path: "package.json", content: packageJson(preset, variables, options) },
|
|
4547
4754
|
{
|
|
4548
4755
|
path: "riebeckite.config.ts",
|
|
4549
4756
|
content: riebeckiteConfig(preset, variables)
|
|
@@ -4624,7 +4831,7 @@ function appFiles(preset) {
|
|
|
4624
4831
|
...has("article") ? [{ path: "app/components/article.tsx", content: get("article") }] : []
|
|
4625
4832
|
];
|
|
4626
4833
|
}
|
|
4627
|
-
function packageJson(preset, variables) {
|
|
4834
|
+
function packageJson(preset, variables, options) {
|
|
4628
4835
|
const dependencies = {
|
|
4629
4836
|
"@riebeckite/core": RIEBECKITE_VERSION,
|
|
4630
4837
|
"@riebeckite/honox": RIEBECKITE_VERSION,
|
|
@@ -4656,7 +4863,8 @@ function packageJson(preset, variables) {
|
|
|
4656
4863
|
"@riebeckite/cli": RIEBECKITE_VERSION,
|
|
4657
4864
|
"@types/node": "^24.5.2",
|
|
4658
4865
|
typescript: "^5.0.0",
|
|
4659
|
-
vite: "^8.0.9"
|
|
4866
|
+
vite: "^8.0.9",
|
|
4867
|
+
...options.cloudflareWorkers ? { wrangler: WRANGLER_VERSION } : {}
|
|
4660
4868
|
}
|
|
4661
4869
|
},
|
|
4662
4870
|
null,
|
|
@@ -4686,6 +4894,7 @@ function riebeckiteConfig(preset, variables) {
|
|
|
4686
4894
|
lines.push(" content: {");
|
|
4687
4895
|
lines.push(' directory: "content",');
|
|
4688
4896
|
lines.push(" },");
|
|
4897
|
+
for (const line of navigationConfig(preset)) lines.push(line);
|
|
4689
4898
|
if (preset.theme) {
|
|
4690
4899
|
const theme = preset.theme;
|
|
4691
4900
|
lines.push(
|
|
@@ -4701,6 +4910,25 @@ function riebeckiteConfig(preset, variables) {
|
|
|
4701
4910
|
return `${lines.join("\n")}
|
|
4702
4911
|
`;
|
|
4703
4912
|
}
|
|
4913
|
+
function navigationConfig(preset) {
|
|
4914
|
+
if (preset.name === "starter") {
|
|
4915
|
+
return [
|
|
4916
|
+
" navigation: {",
|
|
4917
|
+
' header: [{ label: "Guide", href: "/guide" }, { label: "Examples", href: "/examples" }, { label: "Notes", href: "/notes/planning", children: [{ label: "Planning", href: "/notes/planning" }, { label: "Writing", href: "/notes/writing" }] }],',
|
|
4918
|
+
' footer: [{ label: "Guide", href: "/guide" }, { label: "Examples", href: "/examples" }],',
|
|
4919
|
+
" },"
|
|
4920
|
+
];
|
|
4921
|
+
}
|
|
4922
|
+
if (preset.name === "showcase") {
|
|
4923
|
+
return [
|
|
4924
|
+
" navigation: {",
|
|
4925
|
+
' header: [{ label: "Guide", href: "/guide" }, { label: "Examples", href: "/examples" }, { label: "Framework", href: "/framework/plugins", children: [{ label: "Plugins", href: "/framework/plugins" }, { label: "Themes", href: "/framework/themes" }] }],',
|
|
4926
|
+
' footer: [{ label: "Guide", href: "/guide" }, { label: "Examples", href: "/examples" }],',
|
|
4927
|
+
" },"
|
|
4928
|
+
];
|
|
4929
|
+
}
|
|
4930
|
+
return [];
|
|
4931
|
+
}
|
|
4704
4932
|
var OPTION_DEPTH = {
|
|
4705
4933
|
empty: 0,
|
|
4706
4934
|
minimal: 0,
|
|
@@ -4917,6 +5145,16 @@ function readmeEn(preset, variables) {
|
|
|
4917
5145
|
"```",
|
|
4918
5146
|
""
|
|
4919
5147
|
);
|
|
5148
|
+
if (preset.name !== "empty") {
|
|
5149
|
+
lines.push(
|
|
5150
|
+
"## First edits",
|
|
5151
|
+
"",
|
|
5152
|
+
"- `content/index.md`: the first published page.",
|
|
5153
|
+
"- `riebeckite.config.ts`: set `site.title`, `site.baseUrl`, and `content.directory`.",
|
|
5154
|
+
"- `public/favicon.ico`: replace the site icon when you are ready.",
|
|
5155
|
+
""
|
|
5156
|
+
);
|
|
5157
|
+
}
|
|
4920
5158
|
if (preset.readme === "rich") {
|
|
4921
5159
|
lines.push(...demoPagesLines(preset, variables, words, "en"));
|
|
4922
5160
|
lines.push(...copyPasteDemoLines(preset, words, "en"));
|
|
@@ -4965,6 +5203,16 @@ function readmeJa(preset, variables) {
|
|
|
4965
5203
|
"```",
|
|
4966
5204
|
""
|
|
4967
5205
|
);
|
|
5206
|
+
if (preset.name !== "empty") {
|
|
5207
|
+
lines.push(
|
|
5208
|
+
"## 最初に編集する場所",
|
|
5209
|
+
"",
|
|
5210
|
+
"- `content/index.md`: 最初に公開されるページです。",
|
|
5211
|
+
"- `riebeckite.config.ts`: `site.title`、`site.baseUrl`、`content.directory` を設定します。",
|
|
5212
|
+
"- `public/favicon.ico`: 必要になったらサイトアイコンを置き換えます。",
|
|
5213
|
+
""
|
|
5214
|
+
);
|
|
5215
|
+
}
|
|
4968
5216
|
if (preset.readme === "rich") {
|
|
4969
5217
|
lines.push(...demoPagesLines(preset, variables, words, "ja"));
|
|
4970
5218
|
lines.push(...copyPasteDemoLines(preset, words, "ja"));
|
|
@@ -5432,8 +5680,14 @@ async function scaffoldRiebeckiteSite(options) {
|
|
|
5432
5680
|
const preset = resolveScaffoldPreset(options.preset);
|
|
5433
5681
|
validateDeploymentOptions(options);
|
|
5434
5682
|
const files = [
|
|
5435
|
-
...siteTemplateFiles(preset, templateVariables(options, targetDirectory)
|
|
5436
|
-
|
|
5683
|
+
...siteTemplateFiles(preset, templateVariables(options, targetDirectory), {
|
|
5684
|
+
cloudflareWorkers: options.cloudflareWorkers
|
|
5685
|
+
}),
|
|
5686
|
+
...options.githubActions ? deploymentTemplateFiles(deploymentOptions(options)) : options.cloudflareWorkers ? [
|
|
5687
|
+
wranglerJsoncFile(
|
|
5688
|
+
workerNameFromDirectory(path9.basename(targetDirectory))
|
|
5689
|
+
)
|
|
5690
|
+
] : []
|
|
5437
5691
|
];
|
|
5438
5692
|
await assertTargetWritable(
|
|
5439
5693
|
targetDirectory,
|
|
@@ -5530,9 +5784,13 @@ function formatScaffoldNextSteps(relativeDirectory, options = {}) {
|
|
|
5530
5784
|
lines.push("");
|
|
5531
5785
|
lines.push("Then edit:");
|
|
5532
5786
|
lines.push(` ${options.editFile}`);
|
|
5787
|
+
lines.push("");
|
|
5788
|
+
lines.push("Common first settings:");
|
|
5789
|
+
lines.push(" riebeckite.config.ts: site.title, site.baseUrl, content.directory");
|
|
5533
5790
|
}
|
|
5534
5791
|
if (options.externalContent === true) {
|
|
5535
5792
|
lines.push("");
|
|
5793
|
+
lines.push("Operational content lives in the content repository. CI checks it out to content/.");
|
|
5536
5794
|
lines.push(
|
|
5537
5795
|
"Copy github/notify-site.yml to the content repository as .github/workflows/notify-site.yml."
|
|
5538
5796
|
);
|
|
@@ -5540,13 +5798,22 @@ function formatScaffoldNextSteps(relativeDirectory, options = {}) {
|
|
|
5540
5798
|
return lines.join("\n");
|
|
5541
5799
|
}
|
|
5542
5800
|
export {
|
|
5801
|
+
DEFAULT_WORKER_NAME,
|
|
5802
|
+
GITHUB_ACTIONS_SECRETS,
|
|
5803
|
+
PACKAGE_MANAGER,
|
|
5543
5804
|
SCAFFOLD_DEFAULT_PRESET,
|
|
5544
5805
|
SCAFFOLD_PRESET_NAMES,
|
|
5545
5806
|
ScaffoldSiteError,
|
|
5807
|
+
WORKER_NAME_MAX_LENGTH,
|
|
5808
|
+
WRANGLER_DEFAULTS,
|
|
5809
|
+
WRANGLER_VERSION,
|
|
5810
|
+
assertGitHubRepository,
|
|
5811
|
+
buildDefaultWranglerConfig,
|
|
5546
5812
|
buildHonoxApplication,
|
|
5547
5813
|
createRiebeckiteSsg,
|
|
5548
5814
|
defaultSsgEntry,
|
|
5549
5815
|
defaultSsrExternals,
|
|
5816
|
+
deploymentTemplateFiles,
|
|
5550
5817
|
empty,
|
|
5551
5818
|
formatScaffoldNextSteps,
|
|
5552
5819
|
isScaffoldPresetName,
|
|
@@ -5565,5 +5832,6 @@ export {
|
|
|
5565
5832
|
scaffoldRiebeckiteSite,
|
|
5566
5833
|
showcase,
|
|
5567
5834
|
startHonoxDevServer,
|
|
5568
|
-
starter
|
|
5835
|
+
starter,
|
|
5836
|
+
workerNameFromDirectory
|
|
5569
5837
|
};
|
package/dist/server.js
CHANGED
|
@@ -17,6 +17,7 @@ async function riebeckiteSsgParams(content, parameter = "slug") {
|
|
|
17
17
|
if (changeSet.fullRegenerationRequired || process.env.RIEBECKITE_SSG_FULL_REGENERATION === "1") {
|
|
18
18
|
return [
|
|
19
19
|
...manifest.publicEntries.filter((entry) => entry.permalink !== "/").map((entry) => ({ [parameter]: entry.permalink.replace(/^\/+/, "") })),
|
|
20
|
+
...[...manifest.publicRedirects.keys()].filter((path) => path !== "/").map((path) => ({ [parameter]: path.replace(/^\/+/, "") })),
|
|
20
21
|
...await pluginPageSsgParams(content, parameter)
|
|
21
22
|
];
|
|
22
23
|
}
|
|
@@ -24,16 +25,19 @@ async function riebeckiteSsgParams(content, parameter = "slug") {
|
|
|
24
25
|
changeSet.affected.filter((output) => output.kind !== "generated").map((output) => output.path)
|
|
25
26
|
);
|
|
26
27
|
const contentParams = manifest.publicEntries.filter((entry) => affected.has(routeOutputPath(entry.permalink))).map((entry) => ({ [parameter]: entry.permalink.replace(/^\/+/, "") }));
|
|
28
|
+
const redirectParams = [...manifest.publicRedirects.keys()].filter((path) => affected.has(routeOutputPath(path))).filter((path) => path !== "/").map((path) => ({ [parameter]: path.replace(/^\/+/, "") }));
|
|
27
29
|
const pluginPageParams = (await content.getPagePaths()).filter((path) => affected.has(routeOutputPath(path))).filter((path) => path !== "/").map((path) => ({ [parameter]: path.replace(/^\/+/, "") }));
|
|
28
|
-
return [...contentParams, ...pluginPageParams];
|
|
30
|
+
return [...contentParams, ...redirectParams, ...pluginPageParams];
|
|
29
31
|
}
|
|
30
32
|
function resolveContentRoute(manifest, pathname) {
|
|
31
33
|
const path = normalizeRequestPath(pathname);
|
|
32
34
|
const entry = manifest.byRoutablePermalink.get(path);
|
|
33
35
|
if (entry) return { kind: "content", entry };
|
|
34
|
-
const redirect = manifest.
|
|
36
|
+
const redirect = manifest.publicRedirects.get(path);
|
|
35
37
|
if (!redirect) return null;
|
|
36
|
-
const target = manifest.
|
|
38
|
+
const target = manifest.byRoutablePermalink.get(
|
|
39
|
+
manifest.bySlug.get(redirect.slug)?.permalink ?? ""
|
|
40
|
+
);
|
|
37
41
|
if (!target) return null;
|
|
38
42
|
return {
|
|
39
43
|
kind: "redirect",
|
|
@@ -5,3 +5,4 @@ export type ScaffoldDeploymentOptions = {
|
|
|
5
5
|
};
|
|
6
6
|
export declare function assertGitHubRepository(value: string, option: string): void;
|
|
7
7
|
export declare function deploymentTemplateFiles(options: ScaffoldDeploymentOptions): readonly SiteTemplateFile[];
|
|
8
|
+
export declare function wranglerJsoncFile(workerName: string): SiteTemplateFile;
|
|
@@ -10,6 +10,7 @@ export type ScaffoldSiteOptions = {
|
|
|
10
10
|
readonly overwrite?: boolean;
|
|
11
11
|
/** Generate the Cloudflare Workers GitHub Actions workflow. */
|
|
12
12
|
readonly githubActions?: boolean;
|
|
13
|
+
readonly cloudflareWorkers?: boolean;
|
|
13
14
|
/** Read content from this separate GitHub repository during deployment. */
|
|
14
15
|
readonly contentRepository?: string;
|
|
15
16
|
/** Site repository to notify from the generated content workflow. */
|
|
@@ -6,11 +6,14 @@ export type SiteTemplateVariables = {
|
|
|
6
6
|
readonly baseUrl: string;
|
|
7
7
|
readonly locale: string;
|
|
8
8
|
};
|
|
9
|
+
export type SiteTemplateOptions = {
|
|
10
|
+
readonly cloudflareWorkers?: boolean;
|
|
11
|
+
};
|
|
9
12
|
export type SiteTemplateFile = {
|
|
10
13
|
readonly path: string;
|
|
11
14
|
readonly content: string | Uint8Array;
|
|
12
15
|
};
|
|
13
|
-
export declare function siteTemplateFiles(preset: ScaffoldPreset, variables: SiteTemplateVariables): readonly SiteTemplateFile[];
|
|
16
|
+
export declare function siteTemplateFiles(preset: ScaffoldPreset, variables: SiteTemplateVariables, options?: SiteTemplateOptions): readonly SiteTemplateFile[];
|
|
14
17
|
/**
|
|
15
18
|
* Resolve a plugin's options literal for the preset's depth, or `null` when
|
|
16
19
|
* the plugin takes no options at that depth (and should be called bare).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const RIEBECKITE_VERSION = "^0.0.
|
|
1
|
+
export declare const RIEBECKITE_VERSION = "^0.0.16";
|
|
@@ -27,6 +27,11 @@ export declare const WRANGLER_DEFAULTS: {
|
|
|
27
27
|
};
|
|
28
28
|
/** Type for the wrangler config object */
|
|
29
29
|
export type WranglerDefaults = typeof WRANGLER_DEFAULTS;
|
|
30
|
+
export declare const WRANGLER_VERSION = "^4.83.0";
|
|
31
|
+
export declare const DEFAULT_WORKER_NAME = "riebeckite-site";
|
|
32
|
+
export declare const WORKER_NAME_MAX_LENGTH = 63;
|
|
33
|
+
export declare function workerNameFromDirectory(directoryName: string): string;
|
|
34
|
+
export declare function buildDefaultWranglerConfig(workerName: string): string;
|
|
30
35
|
/** Expected secret names in GitHub Actions workflow */
|
|
31
36
|
export declare const GITHUB_ACTIONS_SECRETS: {
|
|
32
37
|
/** Cloudflare API token with Workers Scripts: Edit permission */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/honox",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"esbuild": "^0.28.2",
|
|
37
37
|
"hono": "^4.12.25",
|
|
38
38
|
"vite": "^8.0.9",
|
|
39
|
-
"@riebeckite/core": "0.0.
|
|
39
|
+
"@riebeckite/core": "0.0.16"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|