Skip to content

Commit 1b7246a

Browse files
Merge pull request #16 from DeepanshKhurana/development
refactor: move generated files to public/generated/
2 parents 6df9d21 + c60cdf1 commit 1b7246a

19 files changed

Lines changed: 45 additions & 127 deletions

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,4 @@ dist-ssr
2424
*.sw?
2525

2626
# Content and generated files
27-
public/index/*json
28-
public/feed*
27+
public/generated/

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.2.9] - 2026-02-22
9+
10+
### Changed
11+
12+
- Moved auto-generated files to `public/generated/` subdirectory for cleaner structure.
13+
814
## [1.2.8] - 2026-02-20
915

1016
### Fixed

build/calculate-stats.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const __filename = fileURLToPath(import.meta.url);
66
const __dirname = path.dirname(__filename);
77

88
const publicDir = path.join(__dirname, '..', 'public');
9-
const piecesPagesJsonPath = path.join(publicDir, 'index', 'pieces-pages.json');
10-
const statsJsonPath = path.join(publicDir, 'index', 'stats.json');
9+
const piecesPagesJsonPath = path.join(publicDir, 'generated', 'index', 'pieces-pages.json');
10+
const statsJsonPath = path.join(publicDir, 'generated', 'index', 'stats.json');
1111

1212
try {
1313
const piecesPagesData = JSON.parse(fs.readFileSync(piecesPagesJsonPath, 'utf-8'));

build/ensure-defaults.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ const contentDir = path.join(publicDir, 'content');
99
const introPath = path.join(contentDir, 'intro.md');
1010
const piecesDir = path.join(contentDir, 'pieces');
1111
const pagesDir = path.join(contentDir, 'pages');
12-
const indexDir = path.join(publicDir, 'index');
12+
const generatedDir = path.join(publicDir, 'generated');
13+
const indexDir = path.join(generatedDir, 'index');
1314

1415
console.log('\nChecking for missing content...\n');
1516

16-
[contentDir, piecesDir, pagesDir, indexDir].forEach(dir => {
17+
[contentDir, piecesDir, pagesDir, generatedDir, indexDir].forEach(dir => {
1718
if (!fs.existsSync(dir)) {
1819
fs.mkdirSync(dir, { recursive: true });
1920
console.warn(`WARNING: Directory missing: ${path.basename(dir)}/ — created`);
@@ -71,7 +72,7 @@ const robotsPath = path.join(publicDir, 'robots.txt');
7172
const siteUrl = config.site?.url?.replace(/\/+$/, '') || 'https://example.com';
7273
const robotsContent = `User-agent: *
7374
Disallow:
74-
Sitemap: ${siteUrl}/sitemap.xml
75+
Sitemap: ${siteUrl}/generated/sitemap.xml
7576
`;
7677
fs.writeFileSync(robotsPath, robotsContent);
7778
console.log('Generated robots.txt');

build/generate-body-of-work.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import path from 'path';
33
import yaml from 'js-yaml';
44

55
const publicDir = path.join(__dirname, '..', 'public');
6-
const piecesJsonPath = path.join(publicDir, 'index', 'pieces.json');
7-
const collectionsJsonPath = path.join(publicDir, 'index', 'pieces-collections.json');
6+
const piecesJsonPath = path.join(publicDir, 'generated', 'index', 'pieces.json');
7+
const collectionsJsonPath = path.join(publicDir, 'generated', 'index', 'pieces-collections.json');
88
const bodyOfWorkPath = path.join(publicDir, 'content', 'pages', 'body-of-work.md');
99
const configPath = path.join(publicDir, 'config.yaml');
1010

build/generate-rss.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ const __dirname = path.dirname(__filename);
1111
const publicDir = path.join(__dirname, '..', 'public');
1212
const contentDir = path.join(publicDir, 'content', 'pieces');
1313
const configPath = path.join(publicDir, 'config.yaml');
14-
const piecesJsonPath = path.join(publicDir, 'index', 'pieces.json');
15-
const rssPath = path.join(publicDir, 'feed.xml');
14+
const piecesJsonPath = path.join(publicDir, 'generated', 'index', 'pieces.json');
15+
const rssPath = path.join(publicDir, 'generated', 'feed.xml');
1616

1717
interface Piece {
1818
slug: string;
@@ -77,7 +77,7 @@ interface FrontMatter {
7777
rssLines.push('');
7878
rssLines.push('<channel>');
7979
rssLines.push(` <title>${escapeXml(siteTitle)}</title>`);
80-
rssLines.push(` <atom:link href="${baseUrl}/feed.xml" rel="self" type="application/rss+xml" />`);
80+
rssLines.push(` <atom:link href="${baseUrl}/generated/feed.xml" rel="self" type="application/rss+xml" />`);
8181
rssLines.push(` <link>${baseUrl}/</link>`);
8282
rssLines.push(` <description>${escapeXml(siteTagline)}</description>`);
8383
rssLines.push(` <lastBuildDate>${buildDate}</lastBuildDate>`);

build/generate-sitemap.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ const __dirname = path.dirname(__filename);
88

99
const publicDir = path.join(__dirname, '..', 'public');
1010
const configPath = path.join(publicDir, 'config.yaml');
11-
const piecesJsonPath = path.join(publicDir, 'index', 'pieces.json');
12-
const pagesJsonPath = path.join(publicDir, 'index', 'pages.json');
13-
const collectionsJsonPath = path.join(publicDir, 'index', 'pieces-collections.json');
14-
const sitemapPath = path.join(publicDir, 'sitemap.xml');
11+
const piecesJsonPath = path.join(publicDir, 'generated', 'index', 'pieces.json');
12+
const pagesJsonPath = path.join(publicDir, 'generated', 'index', 'pages.json');
13+
const collectionsJsonPath = path.join(publicDir, 'generated', 'index', 'pieces-collections.json');
14+
const sitemapPath = path.join(publicDir, 'generated', 'sitemap.xml');
1515

1616
interface Piece {
1717
slug: string;
@@ -47,15 +47,13 @@ interface Collection {
4747
sitemapLines.push('<?xml version="1.0" encoding="UTF-8"?>');
4848
sitemapLines.push('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
4949

50-
// Homepage
5150
sitemapLines.push(' <url>');
5251
sitemapLines.push(` <loc>${baseUrl}/</loc>`);
5352
sitemapLines.push(` <lastmod>${currentDate}</lastmod>`);
5453
sitemapLines.push(' <changefreq>daily</changefreq>');
5554
sitemapLines.push(' <priority>1.0</priority>');
5655
sitemapLines.push(' </url>');
5756

58-
// Pages
5957
for (const page of pages) {
6058
sitemapLines.push(' <url>');
6159
sitemapLines.push(` <loc>${baseUrl}/${page.slug}</loc>`);
@@ -65,7 +63,6 @@ interface Collection {
6563
sitemapLines.push(' </url>');
6664
}
6765

68-
// Collections/Reader pages
6966
for (const collection of collections) {
7067
sitemapLines.push(' <url>');
7168
sitemapLines.push(` <loc>${baseUrl}/reader/${encodeURIComponent(collection.name)}</loc>`);
@@ -75,7 +72,6 @@ interface Collection {
7572
sitemapLines.push(' </url>');
7673
}
7774

78-
// Individual pieces
7975
for (const piece of pieces) {
8076
sitemapLines.push(' <url>');
8177
sitemapLines.push(` <loc>${baseUrl}/${piece.slug}</loc>`);

build/index-pages.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import yaml from 'js-yaml';
55

66
const publicDir = path.join(__dirname, '..', 'public');
77
const pagesPath = path.join(publicDir, 'content', 'pages');
8-
const indexPath = path.join(publicDir, 'index', 'pages.json');
9-
const errorsPath = path.join(publicDir, 'index', 'page-errors.json');
8+
const indexPath = path.join(publicDir, 'generated', 'index', 'pages.json');
9+
const errorsPath = path.join(publicDir, 'generated', 'index', 'page-errors.json');
1010
const configPath = path.join(publicDir, 'config.yaml');
1111

1212
type Page = {

build/index-pieces.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import yaml from 'js-yaml';
55

66
const publicDir = path.join(__dirname, '..', 'public');
77
const piecesPath = path.join(publicDir, 'content', 'pieces');
8-
const piecesIndexPath = path.join(publicDir, 'index', 'pieces.json');
9-
const collectionsPath = path.join(publicDir, 'index', 'pieces-collections.json');
10-
const errorsPath = path.join(publicDir, 'index', 'pieces-errors.json');
8+
const piecesIndexPath = path.join(publicDir, 'generated', 'index', 'pieces.json');
9+
const collectionsPath = path.join(publicDir, 'generated', 'index', 'pieces-collections.json');
10+
const errorsPath = path.join(publicDir, 'generated', 'index', 'pieces-errors.json');
1111
const configPath = path.join(publicDir, 'config.yaml');
1212

1313
type Piece = {

build/paginate-pieces.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import fm from "front-matter";
44

55
const publicDir = path.join(__dirname, '..', 'public');
66
const piecesPath = path.join(publicDir, 'content', 'pieces');
7-
const pagesIndexPath = path.join(publicDir, 'index', 'pieces-pages.json');
8-
const piecesIndexPath = path.join(publicDir, 'index', 'pieces.json');
7+
const pagesIndexPath = path.join(publicDir, 'generated', 'index', 'pieces-pages.json');
8+
const piecesIndexPath = path.join(publicDir, 'generated', 'index', 'pieces.json');
99

1010
const CHARS_PER_PAGE = 2200;
1111

0 commit comments

Comments
 (0)