mod.ts: public entrypoint; re-exports the library API.src/: implementation (currentlysrc/dhash.ts).tests/: shared Bun/Deno tests (*.test.ts) and image fixtures.package.json: Bun-first development dependencies and scripts.deno.json: JSR package metadata and Deno compatibility tasks.
Keep public exports flowing through mod.ts. If you add a new public
function/type, export it from mod.ts and add/adjust tests under tests/.
bun run check: runs formatting, linting, TypeScript, CSS, and library tests.bun test: runs the shared library suite with Bun.bun run check:deno: validates the library and demo with Deno.bun run check:npm: builds and tests the generated npm package with Bun and Node.js.bun run pack:npm: buildsdhash.tgzfor npm.
- TypeScript; follow
oxfmtoutput for shared library code and tests. Deno-only scripts and demo code remain formatted bydeno fmt. - Prefer runtime-neutral Node APIs in shared library code and tests. Use
@std/*imports via import mappings only in Deno-specific scripts or demo code. - Naming:
- exported functions:
camelCase(e.g.toAscii,compare). - test files:
*.test.ts.
- exported functions:
- Use
testfrombun:testand runtime-neutral Node APIs in shared library tests.deno.test.jsonremapsbun:testfor Deno compatibility. - Optional coverage:
bun run coverage. - If you change hashing behavior, update expected hashes and/or fixtures in
tests/intentionally (include rationale in the PR).
- Commit messages follow Conventional Commits in this repo:
feat: ...,fix: ...,chore: ..., optionally scoped likefix(dhash): .... - PRs should include:
- what changed and why (short, concrete),
- how to verify (e.g.
deno task test), - notes on permission changes or dependency changes (especially
npm:sharp@...) and any lockfile updates.
- Bump
versionin bothpackage.jsonanddeno.json. - Validate locally:
bun run check,bun run check:deno, andbun run check:npm. - Preview package contents:
deno publish --dry-run. - Build the npm package:
bun run pack:npm. - Publish to JSR:
deno publish(auth via token/login). - Publish to npm:
bun run pack:npmthennpm publish dhash.tgz. - CI publish: push a stable semver tag matching
deno.json’s version (e.g.v0.2.0). Thepublish-npm.ymlworkflow validates once, publishes the tested npm artifact through trusted publishing (OIDC), publishes to JSR through its tokenless GitHub Actions flow, then creates the GitHub Release using notes generated from the git log since the previousv*tag.