Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(deploy): keep SELF_HOSTING_AI.md in Vercel uploads so the docs site builds (MUL-9943) (#11274)
Bohan Jiangad70086d9ae7
diff --git a/.github/ci-paths.json b/.github/ci-paths.jsonindex 59c5f194e1..5cc670a1c4 100644--- a/.github/ci-paths.json+++ b/.github/ci-paths.json@@ -36,6 +36,7 @@"apps/web/features/landing/site/cloud-page.tsx","packages/core/ai-traffic/**","SELF_HOSTING_AI.md",+ ".vercelignore","package.json",".npmrc","pnpm-lock.yaml",diff --git a/.vercelignore b/.vercelignoreindex 1e4b4a36be..a1573e7c51 100644--- a/.vercelignore+++ b/.vercelignore@@ -21,6 +21,8 @@ _features/Dockerfile.web/Makefile/*.md+# apps/docs embeds this file with <include> (content/docs/self-hosting-ai.mdx).+!/SELF_HOSTING_AI.md/docker-compose*.yml/playwright.config.ts/skills-lock.jsondiff --git a/apps/docs/lib/vercel-upload-coverage.test.ts b/apps/docs/lib/vercel-upload-coverage.test.tsnew file mode 100644index 0000000000..5ead55fec6--- /dev/null+++ b/apps/docs/lib/vercel-upload-coverage.test.ts@@ -0,0 +1,65 @@+// @vitest-environment node+import { execFileSync } from "node:child_process";+import { existsSync, readdirSync, readFileSync } from "node:fs";+import path from "node:path";+import { describe, expect, it } from "vitest";++// Vercel uploads the repository filtered by the root .vercelignore, which+// drops most root files and other workspaces. A docs page that embeds a file+// with `<include>` builds locally but fails every Vercel deployment when that+// file is filtered out, as SELF_HOSTING_AI.md was (MUL-9943). .vercelignore is+// listed in the "docs" group of .github/ci-paths.json so editing it runs this.++const repoRoot = path.resolve(__dirname, "../../..");+const docsDir = path.join(repoRoot, "apps/docs/content/docs");+const includePattern = /<include(?:\s[^>]*)?>([^<]+)<\/include>/g;++function mdxFiles(dir: string): string[] {+ return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {+ const full = path.join(dir, entry.name);+ if (entry.isDirectory()) return mdxFiles(full);+ return /\.mdx?$/.test(entry.name) ? [full] : [];+ });+}++function includedFiles(): { page: string; target: string }[] {+ return mdxFiles(docsDir).flatMap((file) =>+ [...readFileSync(file, "utf8").matchAll(includePattern)].map((match) => ({+ page: path.relative(repoRoot, file),+ // remark-include resolves the path relative to the page; `#section` and+ // `?query` suffixes pick part of the file.+ target: path.relative(+ repoRoot,+ path.resolve(path.dirname(file), match[1]!.trim().replace(/[#?].*$/, "")),+ ),+ })),+ );+}++// Uses Git's ignore matching, which follows the same gitignore syntax Vercel+// documents for .vercelignore.+function excludedFromUpload(files: string[]): string[] {+ if (files.length === 0) return [];+ const output = execFileSync(+ "git",+ ["ls-files", "--cached", "--ignored", "--exclude-from=.vercelignore", "--", ...files],+ { cwd: repoRoot, encoding: "utf8" },+ );+ return output.split("\n").filter(Boolean);+}++describe("Vercel upload", () => {+ const includes = includedFiles();++ it("finds the pages that embed repository files", () => {+ expect(includes.map(({ target }) => target)).toContain("SELF_HOSTING_AI.md");+ });++ it("keeps every file a docs page embeds with <include>", () => {+ for (const { page, target } of includes) {+ expect(existsSync(path.join(repoRoot, target)), `${page} includes missing ${target}`).toBe(true);+ }+ const excluded = excludedFromUpload([...new Set(includes.map(({ target }) => target))]);+ expect(excluded, "allow these in .vercelignore").toEqual([]);+ });+});diff --git a/scripts/ci-scope.test.mjs b/scripts/ci-scope.test.mjsindex 2b6bd412bf..de13f3faff 100644--- a/scripts/ci-scope.test.mjs+++ b/scripts/ci-scope.test.mjs@@ -25,6 +25,7 @@ for (const [name, files, selected] of [["docs test", ["apps/docs/lib/unrendered-bold.test.ts"], ["quality", "docs"]],["AI traffic classifier", ["packages/core/ai-traffic/index.ts"], ["frontend", "quality", "docs", "e2e"]],["self-hosting guide for agents", ["SELF_HOSTING_AI.md"], ["docs"]],+ ["Vercel upload filter", [".vercelignore"], ["docs"]],["web changelog", ["apps/web/features/landing/i18n/en.ts"], ["frontend", "quality", "docs", "e2e"]],["landing site copy", ["apps/web/features/landing/i18n/site-ko.ts"], ["frontend", "quality", "docs", "e2e"]],["cloud page", ["apps/web/features/landing/site/cloud-page.tsx"], ["frontend", "quality", "docs", "e2e"]],