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
7 changes: 7 additions & 0 deletions .changeset/self-ignore-generated.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"lectio-docs": patch
---

Generated `.lectio/` and `dist/` directories now self-ignore: `lectio` writes a
`.gitignore` inside each, so they stay out of the consumer's `git status`
without the CLI ever modifying the repo's root `.gitignore`.
7 changes: 7 additions & 0 deletions apps/site-builder/bin/lectio.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ const { buildSearchIndex } = await import('@eventuras/lectio-docs/build-index');
await collect({ rootDir, config, configDir: cwd });
const contentDir = resolve(cwd, config.output);

// A self-ignoring .gitignore in each generated dir keeps them out of the
// consumer's git without ever touching their root .gitignore. `*` ignores the
// whole dir (including this file), so nothing here shows up in `git status`.
const selfIgnore = '# Generated by lectio — safe to delete\n*\n';
writeFileSync(join(contentDir, '.gitignore'), selfIgnore);

// --- 3. materialize this package's site app --------------------------------
// Copy app/ + wiring out of the package. Once installed, the package lives
// under node_modules, where RR won't apply its app-source transforms — copying
Expand Down Expand Up @@ -220,4 +226,5 @@ if (build.status !== 0) process.exit(build.status ?? 1);
const outDir = resolve(cwd, 'dist');
rmSync(outDir, { recursive: true, force: true });
cpSync(join(siteDir, 'build', 'client'), outDir, { recursive: true });
writeFileSync(join(outDir, '.gitignore'), selfIgnore);
console.log(`\nDocs site built → ${outDir}`);