Skip to content

Add Node build pipeline to package userscripts as Chromium (blink) and Firefox (moz) extensions#3

Open
digitalby wants to merge 1 commit intomainfrom
codex/build-userscript-as-chrome-and-firefox-extension
Open

Add Node build pipeline to package userscripts as Chromium (blink) and Firefox (moz) extensions#3
digitalby wants to merge 1 commit intomainfrom
codex/build-userscript-as-chrome-and-firefox-extension

Conversation

@digitalby
Copy link
Copy Markdown
Owner

Motivation

  • Provide a reproducible, CI-friendly way to ship the existing *.user.js sources as browser extensions while keeping the original userscript files in place for existing raw GitHub installs.
  • Support two immediate targets (blink/ for Chromium and moz/ for Firefox) and make future platform outputs (e.g. Safari) easier to add.

Description

  • Add a Node build script at tools/build-extensions.mjs that scans root *.user.js files, parses userscript metadata, inlines @require files that reference the repo's raw GitHub URLs, and produces bundled content scripts.
  • Add package.json scripts (build:extensions, clean:extensions) to run the build locally or in automation.
  • Add a GitHub Actions workflow at .github/workflows/build-extensions.yml that runs the build, zips blink/ and moz/ outputs, and uploads them as artifacts.
  • Emit extension outputs in blink/ and moz/ (each contains scripts/ and a generated manifest.json), and document the build/load steps in README.md; original .user.js sources are not moved or renamed.

Testing

  • Ran npm run build:extensions which completed successfully and reported the number of bundled userscripts.
  • Verified generated manifests by inspecting blink/manifest.json and moz/manifest.json to confirm expected content_scripts, run_at mappings, and Firefox browser_specific_settings.
  • Confirmed the build created per-target scripts/*.js bundles in both blink/ and moz/ directories.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant