Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion skills/convert-site/references/hosting-vercel.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion skills/convert-site/templates/site/.gitignore
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 15 additions & 1 deletion test/convert/init-site.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
Expand Down Expand Up @@ -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)));
Expand Down
Loading