Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c92bbbf
Migrate blog to Void (Vite + Cloudflare Workers + Vue 3)
fengmk2 Mar 1, 2026
1d90374
Replace GitHub ribbon with Deploy on V___ ribbon
fengmk2 Mar 1, 2026
d23061f
Fix deploy: move legacy files, fix SSR CSS and Disqus scripts
fengmk2 Mar 1, 2026
dbced21
Fix ppt deck.js paths to use relative URLs
fengmk2 Mar 2, 2026
9f90894
Return 404 for unknown paths and add sitemap generator
fengmk2 Apr 22, 2026
c61bdb8
Switch void packages to @void-sdk GitHub Packages aliases
fengmk2 Apr 22, 2026
2f75ebf
update deps
fengmk2 Apr 22, 2026
04c1a30
Add PR staging deploy workflow, switch deploy to pnpm
fengmk2 Apr 22, 2026
86eaa80
ignore .void
fengmk2 Apr 22, 2026
be23803
Switch CI/deploy workflows to voidzero-dev/setup-vp
fengmk2 Apr 22, 2026
dfcaac1
Migrate project to Vite+ (vp)
fengmk2 Apr 22, 2026
d5fa8c4
fmt
fengmk2 Apr 22, 2026
f40f670
Pin setup-vp to voidzero-dev/setup-vp#52
fengmk2 Apr 22, 2026
95b37e1
Bump setup-vp PR #52 pin to latest head
fengmk2 Apr 22, 2026
29e1023
Refactor setup-vp usage to PR #54 latest behavior
fengmk2 Apr 22, 2026
9609c50
Bump setup-vp PR #54 pin to latest head (af4ffd9 -> 42d342a)
fengmk2 Apr 22, 2026
fa7eae8
Pin setup-vp to the merged commit of PR #54
fengmk2 Apr 22, 2026
aa21c2b
Use voidzero-dev/setup-vp@v1 floating tag
fengmk2 Apr 22, 2026
d676ce4
Fixup
fengmk2 Apr 22, 2026
a7b5b11
Serve a real 404 page for unknown URLs
fengmk2 Apr 22, 2026
81425b2
Give every page a <title>
fengmk2 Apr 22, 2026
9164264
Log user-agent and client IP on 404 hits
fengmk2 Apr 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"mcpServers": {
"void": {
"command": "npx",
"args": ["void", "mcp"]
}
}
}
1 change: 1 addition & 0 deletions .claude/skills/migrate-vite-cloudflare-to-void
1 change: 1 addition & 0 deletions .claude/skills/void
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read
pull-requests: write

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
with:
cache: true
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- run: vp check
- run: vp run build

staging-deploy:
needs: test
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
with:
cache: true
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- run: vp run sitemap
- run: vpx void deploy
env:
VOID_TOKEN: ${{ secrets.VOID_TOKEN }}
VOID_PROJECT: fengmk2-staging
- name: Comment on PR
uses: actions/github-script@v9
with:
script: |
const marker = '<!-- staging-deploy -->';
const body = `${marker}\n✅ Staging deployment successful!\n\nPreview: https://fengmk2-staging.void.app/\nCommit: ${context.sha}`;
const comments = await github.paginate(github.rest.issues.listComments, {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const existing = comments.find(c => c.body.includes(marker));
if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body,
});
}
20 changes: 20 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Deploy
on:
push:
branches: [master]
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: voidzero-dev/setup-vp@v1
with:
cache: true
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- run: vp run sitemap
- run: vpx void deploy
env:
VOID_TOKEN: ${{ secrets.VOID_TOKEN }}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,11 @@ adc2013_chart.zip
npm-debug.log
nohup.out
package-lock.json
dist/
.wrangler/
.void/
node_modules
dist
.void
.wrangler
*.tsbuildinfo
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24.14.0
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Node.js version 24.14.0 is not a valid or released version. This is likely a typo for a current version like 22.14.0 or 20.14.0. Using a non-existent version will cause environment setup tools to fail.

22.14.0

1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@void-sdk:registry=https://npm.pkg.github.com
1 change: 1 addition & 0 deletions .vite-hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vp staged
73 changes: 73 additions & 0 deletions .void/entry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import app, { scheduled, __voidCollectPrerenderPaths, __voidHandleWebSocket, __withRawEnv } from 'virtual:void-routes';
import { withRuntimeEnv } from "/Users/fengmk2/git/github.com/fengmk2/fengmk2.github.com/node_modules/.pnpm/@void-sdk+void@0.5.0_@void-sdk+md@0.5.0_@void-sdk+react@0.5.0_@void-sdk+solid@0.5.0_@vo_65db7940de9b53d51259765009dc4b8c/node_modules/@void-sdk/void/dist/runtime/env.mjs";

function __filterInternalBindings(env) {
return new Proxy(env, {
get(target, prop, receiver) {
if (typeof prop === "string" && (prop.startsWith("__VOID_") || prop.startsWith("__PROJECT_"))) return undefined;
return Reflect.get(target, prop, receiver);
},
has(target, prop) {
if (typeof prop === "string" && (prop.startsWith("__VOID_") || prop.startsWith("__PROJECT_"))) return false;
return Reflect.has(target, prop);
},
ownKeys(target) {
return Reflect.ownKeys(target).filter(
(key) => typeof key !== "string" || (!key.startsWith("__VOID_") && !key.startsWith("__PROJECT_"))
);
},
getOwnPropertyDescriptor(target, prop) {
if (typeof prop === "string" && (prop.startsWith("__VOID_") || prop.startsWith("__PROJECT_"))) return undefined;
return Reflect.getOwnPropertyDescriptor(target, prop);
},
});
}

async function serveWithAssets(request, env, response) {
if (response.status !== 404 || !env.ASSETS || (request.method !== "GET" && request.method !== "HEAD")) return response;
const asset = await env.ASSETS.fetch(new Request(request.url, { method: request.method, headers: request.headers }));
if (asset.status === 404) return response;
const res = new Response(asset.body, asset);
if (new URL(request.url).pathname.startsWith("/assets/")) {
res.headers.set("Cache-Control", "public, max-age=31536000, immutable");
} else {
res.headers.set("Cache-Control", "public, s-maxage=60, max-age=0, must-revalidate");
}
return res;
}

async function __handleInternal(request, env, ctx) {
const url = new URL(request.url);
// Readiness probe — platform polls this to confirm the worker is live after WfP upload.
// Handled here (before app.fetch) so user middleware cannot block it.
if (request.method === "GET" && url.pathname === "/__void/ready") {
return Response.json({ ready: true });
}
if (request.method !== "POST" || url.pathname !== "/__void/prerender-paths") return null;
const __expected = env.__VOID_PROXY_TOKEN;
if (__expected) {
const __token = request.headers.get("x-void-internal");
if (!__token || __token !== __expected) {
return Response.json({ error: "unauthorized" }, { status: 401 });
}
}
const paths = await __voidCollectPrerenderPaths(request, env, ctx);
return Response.json({ paths });
}
async function handleScheduled(controller, env, ctx) {
const userEnv = __filterInternalBindings(env);
return withRuntimeEnv(env, () => scheduled(controller, userEnv, ctx));
}

export default { fetch: async (request, env, ctx) => {
const ws = await __voidHandleWebSocket(request, env);
if (ws) return ws;
return __withRawEnv(env, () => {
const userEnv = __filterInternalBindings(env);
return withRuntimeEnv(env, async () => {
const internal = await __handleInternal(request, env, ctx);
if (internal) return internal;
return serveWithAssets(request, env, await app.fetch(request, userEnv, ctx));
});
});
}, scheduled: handleScheduled };
11 changes: 11 additions & 0 deletions .void/md.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Auto-generated by @void/md — do not edit

export interface VoidMdPage {
path: string;
title: string;
frontmatter: Record<string, unknown>;
headings: { depth: number; slug: string; text: string }[];
}

declare const pages: VoidMdPage[];
export default pages;
5 changes: 5 additions & 0 deletions .void/queues.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Auto-generated by void — do not edit
export interface QueueMap {
}

export declare const queues: QueueMap;
97 changes: 97 additions & 0 deletions .void/routes.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// Auto-generated by void — do not edit
export {}
interface StandardSchemaV1<Input = unknown, Output = Input> {
readonly "~standard": {
readonly version: 1;
readonly vendor: string;
readonly validate: (value: unknown) => unknown;
readonly types?: { readonly input: Input; readonly output: Output } | undefined;
};
}
declare namespace StandardSchemaV1 {
type InferInput<Schema extends StandardSchemaV1> = NonNullable<
Schema["~standard"]["types"]
>["input"];
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<
Schema["~standard"]["types"]
>["output"];
}

type Serialize<T> =
T extends Response ? never :
T extends Date ? string :
T extends bigint ? never :
T extends Function ? never :
T extends undefined ? never :
T extends Array<infer U> ? Array<Serialize<U>> :
T extends object ? { [K in keyof T as T[K] extends Function ? never : K]: Serialize<T[K]> } :
T;

type ExtractInput<V> = {
[K in keyof V as V[K] extends StandardSchemaV1 ? K : never]:
V[K] extends StandardSchemaV1 ? StandardSchemaV1.InferInput<V[K]> : never;
};

type ExtractOutput<S> =
S extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<S> : never;

type RouteParams<P extends readonly string[]> =
P extends readonly [] ? Record<string, never> : { [K in P[number]]: string };

declare module "void/routes" {
export interface RouteMap {}
export interface WebSocketRouteMap {}
export interface PageActionMap {}

export type ParseActionUrl<U extends string> = U extends `${infer Base}?${infer Action}` ? {
base: Base;
action: Action;
} : {
base: U;
action: never;
};

export type ResolveActionBody<U extends string> =
ParseActionUrl<U>["base"] extends keyof PageActionMap
? ParseActionUrl<U>["action"] extends never
? PageActionMap[ParseActionUrl<U>["base"]] extends { body: infer B }
? B
: Record<string, unknown>
: PageActionMap[ParseActionUrl<U>["base"]] extends { actions: infer A }
? ParseActionUrl<U>["action"] extends keyof A
? A[ParseActionUrl<U>["action"]] extends { body: infer B }
? B
: Record<string, unknown>
: never
: never
: Record<string, unknown>;

export type ResolveActionParams<U extends string> =
ParseActionUrl<U>["base"] extends keyof PageActionMap
? PageActionMap[ParseActionUrl<U>["base"]] extends { params: infer P }
? P
: never
: never;

export type HasActionParams<U extends string> =
ResolveActionParams<U> extends Record<string, string> ? true : false;

export type ActionFormOptions<U extends string> =
HasActionParams<U> extends true ? { params: ResolveActionParams<U> } : { params?: never };

export type ActionUrl =
| {
[K in keyof PageActionMap]: PageActionMap[K] extends { body: any } ? K : never;
}[keyof PageActionMap]
| {
[K in keyof PageActionMap]: PageActionMap[K] extends { actions: infer A }
? `${K & string}?${keyof A & string}`
: never;
}[keyof PageActionMap]

interface RouteMap {
}

interface WebSocketRouteMap {
}
}
16 changes: 16 additions & 0 deletions .void/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"files": [
"routes.d.ts",
"md.d.ts"
],
"compilerOptions": {
"paths": {
"void/routes": [
"./routes.d.ts"
],
"@void/md/pages": [
"./md.d.ts"
]
}
}
}
Loading