Skip to content

Conversation

@jsnmrs
Copy link
Owner

@jsnmrs jsnmrs commented Jan 1, 2026

Summary

This refactor moves bookmarklet metadata from separate JSON files into the source JS files as JSDoc-style comments. The build process now auto-discovers JS files and extracts metadata, eliminating the need to edit two files when adding or updating bookmarklets.

Key changes:

  • Metadata (name, description, author, tags) now lives in each JS file as JSDoc comments
  • Generated JSON files removed from version control
  • New scaffolding script (npm run new) for creating bookmarklets
  • Build-time validation for orphan files, test pages, and tag taxonomy
  • Standardized tag taxonomy with categories, modifiers, and WCAG format
  • Test pages now use Eleventy computed data instead of YAML frontmatter
  • Added CONTRIBUTING.md with contributor documentation

Test plan

  • Run npm run build to verify build completes without errors
  • Check that all bookmarklets appear on the index page
  • Verify test pages load at correct URLs
  • Test scaffolding script with npm run new -- --name "Test" --tags "diagnostic"

Move bookmarklet metadata from data/bookmarklets.json into the source
JS files as JSDoc-style comment blocks. The build process now:

- Auto-discovers JS files in bookmarklets/ directory
- Parses @bookmarklet, @description, @author, @authorUrl, @tags,
  @Auditing, and @PageTest metadata from JSDoc comments
- Generates bookmarklets.json from extracted metadata
- Continues with existing minification/encoding pipeline

This eliminates the need to edit two files when adding or updating
a bookmarklet. Metadata stays with code, reducing sync issues.
Add bookmarklets.11tydata.cjs that uses Eleventy computed data to
derive layout, file, permalink, and title from HTML filenames.

Remove frontmatter from all 22 test pages - they now contain only
test content with no YAML required.
Add scripts/new-bookmarklet.js that generates JS and HTML files
for new bookmarklets with proper metadata templates.

Usage: npm run new -- --name "Name" --author "Author" --tags "tags"
Add comprehensive validation to build.js:
- Orphan detection: JS files without @bookmarklet metadata fail the build
- Test page validation: @PageTest true requires matching HTML file
- Metadata completeness: warnings for missing optional fields
- Helper file support: @Helper true excludes files from validation

Add @PageTest self to grouped-fields.js, tool-aria-usage.js, tool-aria.js
Add @Helper true to test-js-external.js (CSP test helper, not a bookmarklet)
Introduce a consistent tag taxonomy:
- Category tags (required): accessibility, diagnostic, utility
- Modifier tags (optional): external
- WCAG tags (optional): wcag:X.X.X format

Update all 42 bookmarklets with non-compliant tags to use the new format.
Add tag validation to build.js that warns on invalid tags or missing category.
Document the taxonomy in plan.md with examples.
Create comprehensive contributor documentation covering:
- Quick start with scaffolding script
- Manual setup instructions
- Metadata field reference
- Tag taxonomy (categories, modifiers, WCAG format)
- Test page conventions (@PageTest values)
- Build process and available commands
- PR submission checklist
- Convert data file to ESM format (.mjs) for Eleventy 3.0 compatibility
- Update permalink to place test pages at root level (/{name}/)
- Change passthrough copy to only copy JS files, not HTML templates

Test page links now resolve correctly without the bookmarklets/ prefix.
@jsnmrs jsnmrs changed the title Document scaffolding script in README Refactor: Single source of truth for bookmarklet metadata Jan 1, 2026
@jsnmrs jsnmrs merged commit 26c17f2 into main Jan 1, 2026
1 check passed
@jsnmrs jsnmrs deleted the refactor branch January 1, 2026 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants