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
1 change: 1 addition & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
cache: npm

- run: npm ci
- run: npm run build:publisher
- run: npm run build

- name: Assemble site
Expand Down
74 changes: 69 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@
"typecheck": "tsc --noEmit",
"test": "vitest run",
"test:watch": "vitest",
"verify": "npm run check:brand && npm run typecheck && npm run test && npm run build",
"prepublishOnly": "npm run verify"
"verify": "npm run check:publisher && npm run check:brand && npm run typecheck && npm run test && npm run build",
"prepublishOnly": "npm run verify",
"build:publisher": "node scripts/build-publisher.mjs",
"check:publisher": "node scripts/build-publisher.mjs --check"
},
"peerDependencies": {
"react": ">=18",
Expand All @@ -68,6 +70,7 @@
}
},
"devDependencies": {
"@devslab/site-kit": "0.8.0",
"@types/react": "^19.0.0",
"jsdom": "^26.1.0",
"solid-js": "^1.9.14",
Expand Down
28 changes: 28 additions & 0 deletions scripts/build-publisher.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { readFile, writeFile } from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
import { renderPublisherHtml } from '@devslab/site-kit';
import { DEVSLAB_PUBLISHER } from '@devslab/site-kit/devslab';

// The checked-in HTML remains crawlable without JavaScript or a package registry.
const pages = ["site/index.html"];
const root = new URL('../', import.meta.url);
const start = '<!-- site-kit:publisher:start -->';
const end = '<!-- site-kit:publisher:end -->';
const template = start + renderPublisherHtml(DEVSLAB_PUBLISHER) + end;
for (const page of pages) {
const target = new URL(page, root);
const source = await readFile(target, 'utf8');
const rendered = template.replace(/\r?\n/g, source.includes('\r\n') ? '\r\n' : '\n');
const from = source.indexOf(start);
const through = source.indexOf(end);
if (from < 0 || through < from || source.indexOf(start, from + start.length) !== -1) {
throw new Error('Expected one publisher marker pair in ' + page);
}
const result = source.slice(0, from) + rendered + source.slice(through + end.length);
if (process.argv.includes('--check')) {
if (result !== source) throw new Error('Stale publisher in ' + page + '; run build:publisher');
} else if (result !== source) {
await writeFile(target, result);
}
console.log('Publisher verified: ' + fileURLToPath(target));
}
2 changes: 1 addition & 1 deletion scripts/check-brand-assets.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ assert.ok(darkGlow > lightGlow, 'dark atmosphere override must follow the light
assert.match(site.slice(darkGlow), /rgb\(6 182 212 \/ \.10\)/, 'dark atmosphere must cap cyan opacity at .10')

const pkg = JSON.parse(await read('package.json'))
assert.equal(pkg.scripts.verify, 'npm run check:brand && npm run typecheck && npm run test && npm run build', 'routine verification must include the brand check')
assert.equal(pkg.scripts.verify, 'npm run check:publisher && npm run check:brand && npm run typecheck && npm run test && npm run build', 'routine verification must include publisher and brand checks')
assert.equal(pkg.scripts.prepublishOnly, 'npm run verify', 'publishing must use routine verification')
for (const workflow of ['.github/workflows/ci.yml', '.github/workflows/publish.yml']) {
assert.match(await read(workflow), /npm run verify/, `${workflow} must use the routine verification gate`)
Expand Down
3 changes: 2 additions & 1 deletion site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ <h2>No build step <span class="ko">/ JSP·PHP·정적 페이지 — 스크립트
</div>

<footer>
MIT · <a href="https://github.com/devslab-kr">devslab</a> ·
MIT · <!-- site-kit:publisher:start --><a href="https://devslab.kr/">데브스랩(DevsLab)</a>
<script type="application/ld+json">{"@context":"https://schema.org","@type":"Organization","@id":"https://devslab.kr/#organization","name":"DevsLab","url":"https://devslab.kr/","alternateName":["데브스랩","devslab"],"sameAs":["https://github.com/devslab-kr","https://devslab-kr.github.io/"]}</script><!-- site-kit:publisher:end --> ·
the “-key” input family: <a href="https://devslab-kr.github.io/kokey/">kokey</a> (keyboard layouts) · numkey (numbers)
</footer>

Expand Down