diff --git a/apps/marketplace/README.md b/apps/marketplace/README.md index 64f68e5..71fc42b 100644 --- a/apps/marketplace/README.md +++ b/apps/marketplace/README.md @@ -98,7 +98,24 @@ apps/marketplace/ | POST | `/api/sources/sync` | 同步市场源 | | DELETE | `/api/sources/:id` | 删除市场源 | +## 部署(Vercel) + +本应用通过仓库根的 monorepo 构建,产物为 Vercel Build Output (v3)。关键设置: + +- **Root Directory**:在 Vercel 项目设置中必须设为 `apps/marketplace`。`vercel.json` 的 + `installCommand` / `buildCommand` 都以 `cd ../..` 回到 monorepo 根安装/构建, + 产物落在 `apps/marketplace/.vercel/output`,与 `outputDirectory: .vercel/output` + (相对 Root Directory)自洽。若 Root Directory 不是 `apps/marketplace`,路径会错位导致部署失败。 +- **Storage(Blob Store)**:数据存储驱动由 `STORAGE_DRIVER=vercelBlob` 选择,需要 + `BLOB_READ_WRITE_TOKEN`。在 Vercel 项目 **Storage → Create Blob Store** 创建后会自动注入该变量。 + 未注入时应用会降级到 `memory` 驱动(数据不持久),仅用于兜底、不建议生产使用。 +- **构建环境变量**:`NITRO_PRESET=vercel` 与 `STORAGE_DRIVER=vercelBlob` 已在 `vercel.json` + 的 `build.env` 中声明,无需手动配置。 +- **原生依赖**:`@nuxt/content` 构建期使用的本地 SQLite 已切换为 Node 内置 `node:sqlite` + (`content.experimental.nativeSqlite: true`,需 Node ≥ 22.5,Vercel 默认运行时满足), + 因此 install 阶段**不再触发 `better-sqlite3` / `sqlite3` 的 node-gyp 原生编译**。 + ## 环境要求 -- Node.js >= 18 +- Node.js >= 22.5(构建期使用 Node 内置 `node:sqlite`) - pnpm >= 9 diff --git a/apps/marketplace/nuxt.config.ts b/apps/marketplace/nuxt.config.ts index 29a89d2..ebed917 100644 --- a/apps/marketplace/nuxt.config.ts +++ b/apps/marketplace/nuxt.config.ts @@ -48,6 +48,11 @@ export default defineNuxtConfig({ type: 'libsql', url: ':memory:', }, + // 构建期本地 content 数据库使用 Node 内置 node:sqlite(Node 22.5+ / 25), + // 避免 better-sqlite3 / sqlite3 的原生编译(node-gyp),从而无需在 Vercel 上编译原生模块。 + experimental: { + nativeSqlite: true, + }, }, colorMode: { diff --git a/apps/marketplace/package.json b/apps/marketplace/package.json index 002af5a..3ddd2d8 100644 --- a/apps/marketplace/package.json +++ b/apps/marketplace/package.json @@ -4,6 +4,9 @@ "version": "0.1.0", "private": true, "description": "SkillForge — discover, search, and share skills, MCP servers, and developer tools", + "engines": { + "node": ">=22.5.0" + }, "scripts": { "dev": "nuxt dev", "build": "nuxt build", @@ -24,14 +27,6 @@ }, "devDependencies": { "@iconify-json/lucide": "^1.2.109", - "better-sqlite3": "^12.10.0", - "sqlite3": "^6.0.1", "typescript": "catalog:" - }, - "pnpm": { - "onlyBuiltDependencies": [ - "better-sqlite3", - "sqlite3" - ] } } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 69a1d0b..bdc5323 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -99,12 +99,6 @@ importers: '@iconify-json/lucide': specifier: ^1.2.109 version: 1.2.109 - better-sqlite3: - specifier: ^12.10.0 - version: 12.10.0 - sqlite3: - specifier: ^6.0.1 - version: 6.0.1 typescript: specifier: 'catalog:' version: 5.9.3 @@ -11485,6 +11479,7 @@ snapshots: dependencies: bindings: 1.5.0 prebuild-install: 7.1.3 + optional: true bindings@1.5.0: dependencies: @@ -11499,6 +11494,7 @@ snapshots: buffer: 5.7.1 inherits: 2.0.4 readable-stream: 3.6.2 + optional: true body-parser@2.2.2: dependencies: @@ -11557,6 +11553,7 @@ snapshots: dependencies: base64-js: 1.5.1 ieee754: 1.2.1 + optional: true buffer@6.0.3: dependencies: @@ -11690,7 +11687,8 @@ snapshots: dependencies: readdirp: 5.0.0 - chownr@1.1.4: {} + chownr@1.1.4: + optional: true chownr@3.0.0: {} @@ -11903,7 +11901,8 @@ snapshots: deep-eql@5.0.2: {} - deep-extend@0.6.0: {} + deep-extend@0.6.0: + optional: true deep-is@0.1.4: {} @@ -12052,6 +12051,7 @@ snapshots: end-of-stream@1.4.5: dependencies: once: 1.4.0 + optional: true engine.io-client@6.6.5: dependencies: @@ -12528,7 +12528,8 @@ snapshots: signal-exit: 4.1.0 strip-final-newline: 3.0.0 - expand-template@2.0.3: {} + expand-template@2.0.3: + optional: true expect-type@1.3.0: {} @@ -12738,7 +12739,8 @@ snapshots: fresh@2.0.0: {} - fs-constants@1.0.0: {} + fs-constants@1.0.0: + optional: true fsevents@2.3.3: optional: true @@ -12801,7 +12803,8 @@ snapshots: dependencies: git-up: 8.1.1 - github-from-package@0.0.0: {} + github-from-package@0.0.0: + optional: true github-slugger@2.0.0: {} @@ -13121,7 +13124,8 @@ snapshots: inherits@2.0.4: {} - ini@1.3.8: {} + ini@1.3.8: + optional: true ini@4.1.1: {} @@ -13944,7 +13948,8 @@ snapshots: mitt@3.0.1: {} - mkdirp-classic@0.5.3: {} + mkdirp-classic@0.5.3: + optional: true mlly@1.8.2: dependencies: @@ -13986,7 +13991,8 @@ snapshots: nanotar@0.3.0: {} - napi-build-utils@2.0.0: {} + napi-build-utils@2.0.0: + optional: true natural-compare@1.4.0: {} @@ -14125,10 +14131,12 @@ snapshots: node-abi@3.92.0: dependencies: semver: 7.8.1 + optional: true node-addon-api@7.1.1: {} - node-addon-api@8.8.0: {} + node-addon-api@8.8.0: + optional: true node-emoji@2.2.0: dependencies: @@ -14812,6 +14820,7 @@ snapshots: simple-get: 4.0.1 tar-fs: 2.1.4 tunnel-agent: 0.6.0 + optional: true prelude-ls@1.2.1: {} @@ -14914,6 +14923,7 @@ snapshots: dependencies: end-of-stream: 1.4.5 once: 1.4.0 + optional: true punycode@2.3.1: {} @@ -14954,6 +14964,7 @@ snapshots: ini: 1.3.8 minimist: 1.2.8 strip-json-comments: 2.0.1 + optional: true react-dom@19.2.4(react@19.2.4): dependencies: @@ -14995,6 +15006,7 @@ snapshots: inherits: 2.0.4 string_decoder: 1.3.0 util-deprecate: 1.0.2 + optional: true readable-stream@4.7.0: dependencies: @@ -15593,6 +15605,7 @@ snapshots: tar: 7.5.15 optionalDependencies: node-gyp: 12.3.0 + optional: true srvx@0.11.16: {} @@ -15658,7 +15671,8 @@ snapshots: strip-indent@4.1.1: {} - strip-json-comments@2.0.1: {} + strip-json-comments@2.0.1: + optional: true strip-json-comments@3.1.1: {} @@ -15739,6 +15753,7 @@ snapshots: mkdirp-classic: 0.5.3 pump: 3.0.4 tar-stream: 2.2.0 + optional: true tar-stream@2.2.0: dependencies: @@ -15747,6 +15762,7 @@ snapshots: fs-constants: 1.0.0 inherits: 2.0.4 readable-stream: 3.6.2 + optional: true tar-stream@3.2.0: dependencies: @@ -15889,6 +15905,7 @@ snapshots: tunnel-agent@0.6.0: dependencies: safe-buffer: 5.2.1 + optional: true type-check@0.4.0: dependencies: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 31646ff..117324f 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -11,6 +11,3 @@ catalogs: tsx: ^4.21.0 typescript: ^5.9.3 vitest: ^3.2.4 -onlyBuiltDependencies: - - better-sqlite3 - - sqlite3