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
6 changes: 3 additions & 3 deletions examples/cargo-like/src/fonts/SOURCES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Local license: Fraunces-OFL.txt
Project: https://github.com/undercasetype/Fraunces

DS Weiss-Gotisch (regular, unmodified TrueType)
Copied from the local DOMStack source: fonts/ds-weiss-gotisch/DSWeiss-Gotisch.ttf
Accompanying license copied from: fonts/ds-weiss-gotisch/1001fonts-ds-weiss-gotisch-eula.txt
Copied from the local DOMStack source: site/fonts/ds-weiss-gotisch/DSWeiss-Gotisch.ttf
Accompanying license copied from: site/fonts/ds-weiss-gotisch/1001fonts-ds-weiss-gotisch-eula.txt
Local license: DSWeiss-Gotisch-LICENSE.txt
Upstream directory: https://github.com/bcomnes/domstack/tree/master/fonts/ds-weiss-gotisch
Upstream directory: https://github.com/bcomnes/domstack/tree/master/site/fonts/ds-weiss-gotisch
License: 1001Fonts Free For Commercial Use License (FFC).
Free personal/commercial use, but modification and publication/distribution
have separate restrictions. Review the license before publishing the font files.
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@
"clean-node_modules": "rm -rf node_modules && rm -rf examples/*/node_modules",
"build": "npm run clean && npm run build:defaults && run-p build:domstack build:declaration build:schema",
"build:defaults": "node scripts/build-defaults.js",
"build:domstack": "./bin.js --src . --ignore examples,/eject-deps,test-cases,test-fixtures,type-tests,coverage,*.tsconfig.json,fonts,/lib,/types,/scripts,/plans,/browser-tests,/test-results,/lcov.info,/tsconfig.json,/AGENTS.md,/AGENT.md,/agents.md",
"new-blogpost": "node tools/blog/create.ts",
"publish-draft": "node tools/blog/publish.ts",
"import-author": "node tools/authors/import.ts",
"build:domstack": "./bin.js --src . --ignore examples,/eject-deps,test-cases,test-fixtures,type-tests,coverage,*.tsconfig.json,/site/fonts,/site/tools,/lib,/types,/scripts,/plans,/browser-tests,/test-results,/lcov.info,/tsconfig.json,/AGENTS.md,/AGENT.md,/agents.md",
"new-blogpost": "node site/tools/blog/create.ts",
"publish-draft": "node site/tools/blog/publish.ts",
"import-author": "node site/tools/authors/import.ts",
"build:declaration": "node ./node_modules/typescript7/bin/tsc -p declaration.tsconfig.json",
"build:schema": "node scripts/domstack-manifest-schema.js",
"watch": "npm run clean && run-p watch:*",
Expand Down
File renamed without changes.
File renamed without changes
2 changes: 1 addition & 1 deletion site/globals/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@font-face {
font-family: 'DSWeiss-Gotisch';
src: url('../../fonts/ds-weiss-gotisch/DSWeiss-Gotisch.ttf') format('truetype');
src: url('../fonts/ds-weiss-gotisch/DSWeiss-Gotisch.ttf') format('truetype');
}

body {
Expand Down
4 changes: 2 additions & 2 deletions site/lib/authors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface AuthorMeta {
gpg: string
}

export const authorRegistryDirectory = join(import.meta.dirname, '../../authors')
export const authorRegistryDirectory = join(import.meta.dirname, '../authors')

export function validateAuthorUsername (value: unknown): string {
if (typeof value !== 'string' || !/^[a-z0-9](?:[a-z0-9-]{0,37}[a-z0-9])?$/.test(value) || value.includes('--')) {
Expand Down Expand Up @@ -114,7 +114,7 @@ export class AuthorRegistry {
const meta = validateAuthorMeta(JSON.parse(await readFile(metaPath, 'utf8')), username)
const avatar = await lstat(join(directory, meta.avatar))
if (!avatar.isFile() || avatar.isSymbolicLink() || !avatar.size) throw new Error('avatar must be a nonempty regular file')
return Object.freeze({ username, name: meta.name, url: meta.website || meta.profile, avatar: `/authors/${username}/${meta.avatar}` })
return Object.freeze({ username, name: meta.name, url: meta.website || meta.profile, avatar: `/site/authors/${username}/${meta.avatar}` })
} catch (error) {
throw new Error(`${metaPath}: ${error instanceof Error ? error.message : String(error)}`)
}
Expand Down
4 changes: 2 additions & 2 deletions site/lib/blog.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const post = {

test('blog metadata validates RFC 3339 dates and author arrays', async () => {
assert.equal(blogDate('2024-02-29T12:00:00Z', 'publishDate', 'sample'), '2024-02-29T12:00:00.000Z')
assert.deepEqual(await resolveBlogAuthors(['bcomnes'], 'sample'), [{ username: 'bcomnes', name: 'Bret Comnes', url: 'https://bret.io/', avatar: '/authors/bcomnes/avatar.jpg' }])
assert.deepEqual(await resolveBlogAuthors(['bcomnes'], 'sample'), [{ username: 'bcomnes', name: 'Bret Comnes', url: 'https://bret.io/', avatar: '/site/authors/bcomnes/avatar.jpg' }])
await assert.rejects(validateBlogVars({ description: 'Summary', publishDate: '2026-01-02T00:00:00Z', authors: ['bcomnes'] }, 'sample'), /sample: title/)
await assert.rejects(validateBlogVars({ title: 'Title', description: 'Summary', publishDate: '2026-01-02T00:00:00Z', authors: [] }, 'sample'), /nonempty array/)
await assert.rejects(validateBlogVars({ title: 'Title', description: 'Summary', publishDate: '2026-01-02T00:00:00Z', authors: ['bcomnes', 'bcomnes'] }, 'sample'), /duplicate/)
Expand Down Expand Up @@ -74,7 +74,7 @@ test('feeds include ordered author metadata, avatars, and absolute article asset
assert.equal($('a').attr('href'), `${site}/blog/2026/other/`)
assert.equal($('img').attr('src'), `${site}/blog/2026/example/image.png`)
const json = JSON.parse(jsonFeed([post], site))
assert.deepEqual(json.items[0].authors, [{ name: 'Bret Comnes', url: 'https://bret.io/', avatar: `${site}/authors/bcomnes/avatar.jpg` }])
assert.deepEqual(json.items[0].authors, [{ name: 'Bret Comnes', url: 'https://bret.io/', avatar: `${site}/site/authors/bcomnes/avatar.jpg` }])
assert.equal(json.items[0].content_html, feedHtml(post, site))
assert.match(atomFeed([post], site), /<author>\s+<name>Bret Comnes<\/name>\s+<uri>https:\/\/bret\.io\/<\/uri>\s+<\/author>/)
})
6 changes: 3 additions & 3 deletions tools/authors/README.md → site/tools/authors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Import or refresh a public GitHub profile:

```sh
npm run import-author -- bcomnes
node --test tools/authors/import.test.js
node --test site/tools/authors/import.test.js
```

Importing makes bounded HTTPS requests to `api.github.com` for the profile and social accounts, `avatars.githubusercontent.com` for the avatar, and `github.com` for public SSH/GPG keys. GitHub rate limits apply. An optional `GITHUB_TOKEN` environment variable is sent only to `api.github.com` and is never written to metadata.
Expand All @@ -13,7 +13,7 @@ Redirects are rejected, no token is needed for public profiles, and network fail

## Files and schema

Each `authors/<lowercase-github-username>/` directory contains `author-meta.json` and `avatar.jpg`, `avatar.png`, `avatar.gif`, or `avatar.webp`.
Each `site/authors/<lowercase-github-username>/` directory contains `author-meta.json` and `avatar.jpg`, `avatar.png`, `avatar.gif`, or `avatar.webp`.

Metadata schema version 1 contains:

Expand All @@ -35,7 +35,7 @@ Only public data is stored. These files are intended to be checked in; do not ad

`AuthorRegistry` lazily reads one username at a time, shares in-flight and successful reads, evicts failed reads for retry, returns frozen author objects, and supports `clear(username?)`. `resolveBlogAuthors` requires a nonempty array of unique registered GitHub usernames and preserves input order. It has no default and rejects legacy aliases such as `bret`, `joe`, and `oro`.

Resolved author URLs prefer the imported website and fall back to the GitHub profile. Avatar URLs are local `/authors/<username>/<filename>` paths so builds do not contact GitHub.
Resolved author URLs prefer the imported website and fall back to the GitHub profile. Avatar URLs are local `/site/authors/<username>/<filename>` paths so builds do not contact GitHub.

The registry reads metadata through `fs`, so DOMStack does not automatically invalidate pages when registry files change. Restart the watch process after importing authors or manually editing metadata, or run a fresh build.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { tmpdir } from 'node:os'
import { join } from 'node:path'
import test from 'node:test'
import { importAuthor } from './import.ts'
import { AuthorRegistry, resolveBlogAuthors, validateAuthorMeta, validateAuthorUrl, validateAuthorUsername } from '../../site/lib/authors.ts'
import { AuthorRegistry, resolveBlogAuthors, validateAuthorMeta, validateAuthorUrl, validateAuthorUsername } from '../../lib/authors.ts'

const png = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10, 0])
function fakeFetch (options = {}) {
Expand All @@ -29,7 +29,7 @@ test('imports, loads, and preserves previous data on failed refresh', async () =
assert.equal(meta.website, 'https://example.org/')
assert.equal(meta.keys, '')
assert.equal(meta.gpg, '')
assert.deepEqual(await new AuthorRegistry(directory).get('alice'), { username: 'alice', name: 'Alice Example', url: 'https://example.org/', avatar: '/authors/alice/avatar.png' })
assert.deepEqual(await new AuthorRegistry(directory).get('alice'), { username: 'alice', name: 'Alice Example', url: 'https://example.org/', avatar: '/site/authors/alice/avatar.png' })

const before = await readFile(join(directory, 'alice', 'author-meta.json'), 'utf8')
for (const fail of ['/users/alice', 'avatars.githubusercontent.com', '.keys', '.gpg']) {
Expand Down
4 changes: 2 additions & 2 deletions tools/authors/import.ts → site/tools/authors/import.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { mkdir, mkdtemp, lstat, rename, rm, writeFile } from 'node:fs/promises'
import { join, resolve } from 'node:path'
import { pathToFileURL } from 'node:url'
import { authorRegistryDirectory, validateAuthorMeta, validateAuthorUrl, validateAuthorUsername } from '../../site/lib/authors.ts'
import type { AuthorMeta } from '../../site/lib/authors.ts'
import { authorRegistryDirectory, validateAuthorMeta, validateAuthorUrl, validateAuthorUsername } from '../../lib/authors.ts'
import type { AuthorMeta } from '../../lib/authors.ts'

type Request = typeof fetch

Expand Down
2 changes: 1 addition & 1 deletion tools/blog/create.ts → site/tools/blog/create.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { mkdir, writeFile } from 'node:fs/promises'
import { join } from 'node:path'
import { parseArgs } from 'node:util'
import { resolveBlogAuthors } from '../../site/lib/authors.ts'
import { resolveBlogAuthors } from '../../lib/authors.ts'
import { context, directory, postParts, reportError, requireAbsent, type BlogOptions } from './shared.ts'

export interface CreatePostOptions extends BlogOptions { authors?: string[] }
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tools/blog/shared.ts → site/tools/blog/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface BlogOptions {
now?: Date
}

export const BLOG_DIR = fileURLToPath(new URL('../../blog/', import.meta.url))
export const BLOG_DIR = fileURLToPath(new URL('../../../blog/', import.meta.url))

export function context (options: BlogOptions) {
const now = options.now ?? new Date()
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
],
"exclude": [
"node_modules",
"site/tools/**/*",
"test-cases/build-errors",
"test-cases/page-build-errors",
"test-cases/**/public"
Expand Down