Skip to content

Commit 3e05456

Browse files
committed
feat(routes): hide /work directory from the public site
1 parent 4dd911b commit 3e05456

4 files changed

Lines changed: 33 additions & 12 deletions

File tree

src/build/routes.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,21 @@ export type Route = {
77
}
88

99
export function allRoutes(catalog: Catalog): Route[] {
10+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
11+
const _catalog = catalog
1012
const routes: Route[] = [
1113
{ path: '/', view: 'home' },
12-
{ path: '/work/', view: 'work-index' },
13-
{ path: '/work/health/', view: 'health' },
14+
// Work directory is disabled until approved content is ready.
15+
// Uncomment to restore the public catalog, detail pages, and health page.
16+
// { path: '/work/', view: 'work-index' },
17+
// { path: '/work/health/', view: 'health' },
1418
{ path: '/commitment/', view: 'commitment' },
1519
{ path: '/about/', view: 'about' },
1620
{ path: '/design-system/', view: 'design-system' },
1721
]
18-
for (const entry of catalog) {
19-
if (entry.hidden) continue
20-
routes.push({ path: `/work/${entry.name}/`, view: 'work-detail', slug: entry.name })
21-
}
22+
// for (const entry of catalog) {
23+
// if (entry.hidden) continue
24+
// routes.push({ path: `/work/${entry.name}/`, view: 'work-detail', slug: entry.name })
25+
// }
2226
return routes
2327
}

tests/a11y/pages.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ const DIST = join(process.cwd(), 'dist')
77

88
const pages = [
99
'index.html',
10-
'work/index.html',
11-
'work/health/index.html',
1210
'commitment/index.html',
1311
'about/index.html',
1412
'design-system/index.html',

tests/build/routes.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { describe, test, expect } from 'bun:test'
2+
import { allRoutes } from '../../src/build/routes'
3+
import { fixtureCatalog } from '../fixtures/catalog'
4+
5+
describe('allRoutes', () => {
6+
test('produces the expected public routes', () => {
7+
const paths = allRoutes(fixtureCatalog).map((r) => r.path)
8+
expect(paths).toContain('/')
9+
expect(paths).toContain('/commitment/')
10+
expect(paths).toContain('/about/')
11+
expect(paths).toContain('/design-system/')
12+
})
13+
14+
test('does not produce any /work/ routes', () => {
15+
const paths = allRoutes(fixtureCatalog).map((r) => r.path)
16+
for (const path of paths) {
17+
expect(path.startsWith('/work/')).toBe(false)
18+
}
19+
expect(paths).not.toContain('/work/')
20+
})
21+
})

tests/build/smoke.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ beforeAll(async () => {
1919
describe('build smoke', () => {
2020
const expectedPaths = [
2121
'index.html',
22-
'work/index.html',
23-
'work/health/index.html',
2422
'commitment/index.html',
2523
'about/index.html',
2624
]
@@ -35,8 +33,8 @@ describe('build smoke', () => {
3533
})
3634
}
3735

38-
test('produces a work directory', () => {
36+
test('does not produce a work directory', () => {
3937
const workDir = join(outDir, 'work')
40-
expect(existsSync(workDir)).toBe(true)
38+
expect(existsSync(workDir)).toBe(false)
4139
})
4240
})

0 commit comments

Comments
 (0)