refactor: migrate to pnpm workspace monorepo#50
Merged
Conversation
Restructure the single Next.js package into a pnpm workspace: - apps/web: the Next.js app (UI, App Router pages, SSG district routes, ETL scripts, and public/data) - packages/core (@zipkit/core): framework-agnostic domain logic extracted from src/lib -- lookup-zipcode (3+3 specificity matching), format-english-address (UPU formatting), and shared types The app consumes @zipkit/core via Next transpilePackages; exports point at the TS source, so there is no build step yet. Root package.json holds workspace scripts that delegate to apps/web via --filter, and Prettier now runs from the repo root. Updated .gitignore and .prettierignore paths.
Update file paths (apps/web, packages/core), rewrite the project structure tree for the workspace, and note the monorepo in the tech stack.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
地址英譯與 3+3 郵遞區號比對是本專案最有價值、最難複製的部分,而 npm 上目前沒有把這塊做好的套件。為了日後能將它獨立成可重用、可發佈的 library,程式碼需要先變成 workspace——讓核心邏輯與 Next.js app 分離,並讓 app 像使用外部依賴一樣消費它。
這個 PR 是結構上的第一步:把單一 Next.js 套件拆成 pnpm workspace,並以 web app 作為抽出後核心的第一個消費者(dogfood)。
What changed
apps/web— 既有的 Next.js app(UI、頁面、SSG 區頁、ETL 腳本、public/data)原封不動移入。packages/core(@zipkit/core) — 從src/lib抽出的無框架依賴核心邏輯:lookup-zipcode(3+3 特異性比對)、format-english-address(UPU 英譯)、共用types。純函式,不依賴 React/Next。transpilePackages消費@zipkit/core,exports指向 TS 原始碼,目前沒有 build step(延後到真的要發佈套件時再做)。package.json持有 workspace scripts,透過--filterdelegate 給apps/web;Prettier 改由 repo root 執行。.gitignore/.prettierignore路徑,README 改寫為新結構。Review note
808 個檔案變更,但 798 個是純 rename(app 移入
apps/web/)。實質 diff 約 10 個檔案:新增的 workspace/package 設定與 import 改寫。淨 +170 / −100。Verification
pnpm check(recursive typecheck + lint + Prettier)通過pnpm --filter web build通過 — 379 個靜態頁全數生成Follow-ups(不在此 PR)
apps/web。@zipkit/core補 Vitest golden tests,再做真正的 build / publish pipeline。