mirror of
https://github.com/prdlk/leetcode.git
synced 2026-11-04 21:47:38 +00:00
feat(docs): move the site to prdcs.wiki on a Cloudflare Worker
Blume's cloudflare() adapter builds the docs as the prdcs-wiki Worker (apps/docs/wrangler.jsonc: name, prdcs.wiki custom domain), and deploy.yml ships it with wrangler instead of GitHub Pages. The SRS Worker's DOCS_URL / DOCS_ORIGIN, release links and README badge follow the new domain.
This commit is contained in:
1 parent
2835f618aa
commit
dd796acbae
15 files changed
+643
-212
No files matched your search
+3
-3
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* POST /ask — the docs assistant's backend.
|
||||
*
|
||||
* The docs are a static GitHub Pages site, and Blume's own assistant route is
|
||||
* server-rendered (it reads the provider key per request), so the site points
|
||||
* `ai.assistant.endpoint` here instead. This speaks the Blume island's wire
|
||||
* Blume's own assistant route reads the provider key per request, and the
|
||||
* docs Worker (apps/docs, `cloudflare()` build) holds no secrets, so the site
|
||||
* points `ai.assistant.endpoint` here instead. This speaks the Blume island's wire
|
||||
* contract (`blume/components/islands/hooks.ts`):
|
||||
*
|
||||
* - request: `{ messages: [{ role, content }], page: { path } }` as JSON,
|
||||
|
||||
@@ -324,7 +324,7 @@ export default {
|
||||
if (path.startsWith("/admin/") && request.method === "POST") {
|
||||
return await handleAdmin(request, env, path);
|
||||
}
|
||||
// The docs assistant (the static Pages site's `ai.assistant.endpoint`).
|
||||
// The docs assistant (the docs site's `ai.assistant.endpoint`).
|
||||
if (path === "/ask") return await handleAsk(request, env);
|
||||
|
||||
if (path === "/chart/progress.svg") {
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
"REPO": "prdlk/leetcode",
|
||||
"FROM_EMAIL": "srs@prdlk.com",
|
||||
"TO_EMAIL": "prnk28@gmail.com",
|
||||
"DOCS_URL": "https://lc.prd.lk",
|
||||
"DOCS_ORIGIN": "https://lc.prd.lk,https://prdlk.github.io",
|
||||
"DOCS_URL": "https://prdcs.wiki",
|
||||
"DOCS_ORIGIN": "https://prdcs.wiki",
|
||||
"PUBLIC_URL": "https://srs-api.prdlk.workers.dev",
|
||||
// The docs assistant's OpenRouter model (POST /ask). `:free` variants share
|
||||
// an upstream pool and answer 429 when it is saturated.
|
||||
|
||||
@@ -60,7 +60,7 @@ const DRY =
|
||||
process.env.DRY_RUN === "true";
|
||||
|
||||
/** The docs site (apps/docs/blume.config.ts `deployment.site`); sync publishes `/<num>` short links. */
|
||||
const DOCS_SITE = "https://lc.prd.lk";
|
||||
const DOCS_SITE = "https://prdcs.wiki";
|
||||
const TIMEVER = "https://gist.github.com/twolfson/de1b004dd22536b8e668";
|
||||
|
||||
const gh = await github();
|
||||
|
||||
+2
-2
@@ -68,7 +68,7 @@
|
||||
* there would otherwise wipe the page's `## Solution`.
|
||||
*
|
||||
* Every page also gets a short link: `/<num>` → `/<topic>/<slug>` (so
|
||||
* `/leetcode/217` opens Contains Duplicate). The rules live in the generated
|
||||
* `/217` opens Contains Duplicate). The rules live in the generated
|
||||
* `apps/docs/redirects.ts`, which `blume.config.ts` imports — Blume takes exact
|
||||
* root-relative paths and prepends the deployment base itself.
|
||||
*/
|
||||
@@ -944,7 +944,7 @@ for (const sol of ordered) {
|
||||
{
|
||||
const module = [
|
||||
"// Generated by `bun run sync` (apps/cli/sync.ts) — do not edit.",
|
||||
"// `/leetcode/<num>` → that problem's page; exact paths, base added by Blume.",
|
||||
"// `/<num>` → that problem's page; exact paths, base added by Blume.",
|
||||
"export default [",
|
||||
...redirects,
|
||||
"];",
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
.blume-verify/
|
||||
.wrangler/
|
||||
@@ -1,4 +1,5 @@
|
||||
import { defineConfig } from "blume";
|
||||
import { cloudflare } from "blume/deploy";
|
||||
import type { StandardSchema } from "blume/core/standard-schema.ts";
|
||||
import { filesystem } from "blume/sources";
|
||||
import { APPENDIX } from "./appendix";
|
||||
@@ -6,7 +7,7 @@ import { RECENCY, type Company } from "./companies";
|
||||
import redirects from "./redirects";
|
||||
|
||||
// Blume's defaults (`inter`, `ibm-plex-mono`) are fetched from fonts.gstatic.com
|
||||
// on every build, which has timed out on the Pages runner and, fully offline,
|
||||
// on every build, which has timed out on the CI runner and, fully offline,
|
||||
// silently ships no fonts at all. The same two families from Fontsource, as
|
||||
// local files, keep the build network-free. Blume resolves `src` from this
|
||||
// directory; the workspace links these packages under ./node_modules.
|
||||
@@ -92,9 +93,14 @@ export default defineConfig({
|
||||
title: "prdlk",
|
||||
description: "Documentation for my LeetCode solutions",
|
||||
logo: "./public/logo.svg",
|
||||
deployment: {
|
||||
site: "https://lc.prd.lk",
|
||||
},
|
||||
// A Cloudflare Workers server build (`@astrojs/cloudflare`), deployed by
|
||||
// `wrangler deploy` with apps/docs/wrangler.jsonc (Worker name, the
|
||||
// prdcs.wiki custom domain). Every page still prerenders; the Worker adds
|
||||
// real HTTP redirects and `Accept: text/markdown` negotiation. Workers
|
||||
// exposes no site URL to detect, so `site` is required.
|
||||
deployment: cloudflare({
|
||||
site: "https://prdcs.wiki",
|
||||
}),
|
||||
github: {
|
||||
owner: "prdlk",
|
||||
repo: "leetcode",
|
||||
@@ -127,10 +133,10 @@ export default defineConfig({
|
||||
structuredData: true,
|
||||
x: { handle: "@prdlk" },
|
||||
},
|
||||
// Blume's own assistant route is server-rendered (it reads the provider key
|
||||
// per request), which a static Pages build cannot ship. The SRS Worker
|
||||
// answers instead (apps/api/src/ask.ts: OpenRouter, grounded on this site's
|
||||
// llms-full.txt, which `agents.llmsTxt` publishes).
|
||||
// Blume's own assistant route reads a provider key per request; the SRS
|
||||
// Worker already holds that key and answers instead (apps/api/src/ask.ts:
|
||||
// OpenRouter, grounded on this site's llms-full.txt, which `agents.llmsTxt`
|
||||
// publishes), so this Worker carries no secrets.
|
||||
ai: {
|
||||
assistant: {
|
||||
enabled: true,
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"scripts": {
|
||||
"dev": "blume dev",
|
||||
"build": "blume build",
|
||||
"deploy": "wrangler deploy",
|
||||
"doctor": "blume doctor"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -19,10 +20,12 @@
|
||||
"tailwind-merge": "^3.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/cloudflare": "^14.4.4",
|
||||
"@fontsource-variable/inter": "^5.3.0",
|
||||
"@fontsource/ibm-plex-mono": "^5.3.0",
|
||||
"@types/d3-hierarchy": "^3.1.7",
|
||||
"@types/react": "^19.3.0",
|
||||
"@types/react-dom": "^19.3.0"
|
||||
"@types/react-dom": "^19.3.0",
|
||||
"wrangler": "^4.125.0"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated by `bun run sync` (apps/cli/sync.ts) — do not edit.
|
||||
// `/leetcode/<num>` → that problem's page; exact paths, base added by Blume.
|
||||
// `/<num>` → that problem's page; exact paths, base added by Blume.
|
||||
export default [
|
||||
{ from: "/1", to: "/hash-table/two-sum" },
|
||||
{ from: "/2", to: "/hybrid-structures/add-two-numbers" },
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// Docs Worker — the Blume site, built by `blume build` with the `cloudflare()`
|
||||
// deploy adapter (blume.config.ts) and shipped by `wrangler deploy` from this
|
||||
// directory. Blume's build merges this file into dist/server/wrangler.json
|
||||
// (main, assets, the text/markdown negotiation wrapper) and writes the
|
||||
// .wrangler/deploy/ redirect wrangler follows, so only what Blume cannot
|
||||
// know lives here: the Worker's name and its domain.
|
||||
{
|
||||
"$schema": "node_modules/wrangler/config-schema.json",
|
||||
"name": "prdcs-wiki",
|
||||
"compatibility_date": "2026-08-24",
|
||||
"observability": { "enabled": true },
|
||||
|
||||
// prdcs.wiki is a zone on the same Cloudflare account; `custom_domain`
|
||||
// makes wrangler create the DNS record and certificate on deploy.
|
||||
"routes": [{ "pattern": "prdcs.wiki", "custom_domain": true }],
|
||||
"workers_dev": false,
|
||||
|
||||
// Blume writes every page as <route>/index.html and links it without the
|
||||
// slash; Cloudflare's default would answer `/x` with a 307 to `/x/` on any
|
||||
// path the static layer serves ahead of the Worker.
|
||||
"assets": { "html_handling": "drop-trailing-slash" }
|
||||
}
|
||||
Reference in new issue
Block a user