diff --git a/skills/convert-site/references/hosting-vercel.md b/skills/convert-site/references/hosting-vercel.md index 187941b..5a7cac9 100644 --- a/skills/convert-site/references/hosting-vercel.md +++ b/skills/convert-site/references/hosting-vercel.md @@ -89,7 +89,9 @@ page is noindexed whatever the target. paths (and `node_modules`, `.git`, `.vercel`, `.env.local`). The scaffold's `.vercelignore` lists `/dist/`, `/.conversion/` (run state and the media download), `/review/` and the ignored `/capture/screens/` and `/capture/lighthouse-live/`; `capture/` itself is uploaded, because the -remote build reads it. +remote build reads it. A Git build of `main` gets only what git tracks, so the scaffold's +`.gitignore` anchors `/dist` (Astro's output) and keeps theme and plugin `public/**/dist/` scripts +tracked; a bare `dist` line there would make them 404 in production while CLI previews work. **Node.** The deploy warns that `engines` `>=22.23.4 <23 || >=24.22.1` lets Vercel move the build to the next Node major on its own; that is expected, and a build that breaks on a new major is diff --git a/skills/convert-site/templates/site/.gitignore b/skills/convert-site/templates/site/.gitignore index 0f39ed8..824f3eb 100644 --- a/skills/convert-site/templates/site/.gitignore +++ b/skills/convert-site/templates/site/.gitignore @@ -1,5 +1,6 @@ node_modules -dist +# Astro's build output only: themes and plugins keep built scripts in public/**/dist/ +/dist .astro .env* !.env.example diff --git a/test/convert/init-site.test.mjs b/test/convert/init-site.test.mjs index a842e44..be7f8b9 100644 --- a/test/convert/init-site.test.mjs +++ b/test/convert/init-site.test.mjs @@ -175,7 +175,7 @@ test('init scaffolds templates, copies scripts, commits on main and switches to assert.ok(perPage.every((at, i) => at > 0 && (i === 0 || at > perPage[i - 1])), `the css list, else site.css, then the head slot: ${perPage}`); assert.match(readFileSync(join(dir, 'src', 'styles', 'site.css'), 'utf8'), /css-prune\.mjs/); const ignore = readFileSync(join(dir, '.gitignore'), 'utf8').split('\n'); - for (const entry of ['/capture/screens/', '/capture/lighthouse-live/', '/review/', 'node_modules', 'dist', + for (const entry of ['/capture/screens/', '/capture/lighthouse-live/', '/review/', 'node_modules', '/dist', '.astro', '.env*', '!.env.example', '.conversion/*.tmp', '/media-cache/', '.vercel']) { assert.ok(ignore.includes(entry), `.gitignore lacks ${entry}`); } @@ -222,6 +222,20 @@ test('init scaffolds templates, copies scripts, commits on main and switches to assert.match(again.stderr, /astro\.config\.mjs/); }); +test('.gitignore ignores the root dist/ only: a theme or plugin dist/ under public/ is tracked', (t) => { + const dir = join(tempDir(t, 'site-'), 'site'); + const result = run(baseArgs(dir, bareKit(t))); + assert.equal(result.status, 0, result.stdout + result.stderr); + const ignored = (path) => { + plant(join(dir, path)); + return spawnSync('git', ['check-ignore', '-q', path], { cwd: dir, env: GIT_ENV }).status; + }; + // WordPress keeps built scripts in dist/ folders: the theme's, wp-includes/js/dist/, plugins'. + assert.equal(ignored('public/wp-content/themes/x/dist/app.js'), 1); + assert.equal(ignored('public/wp-includes/js/dist/hooks.min.js'), 1); + assert.equal(ignored('dist/index.html'), 0, "Astro's build output stays ignored"); +}); + test('the real copied scripts answer --help from inside the scaffolded site', (t) => { const dir = join(tempDir(t, 'site-'), 'site'); const result = run(baseArgs(dir, realKit(t)));