Thank you for taking the time to contribute! This document describes our workflow, quality gates, commit conventions, and release process. By participating, you agree to follow our Code of Conduct.
- Reporting Bugs
- Suggesting Enhancements
- Branching Model & Workflow
- Development Setup
- Quality Gates (Lint, Format, Types, Tests)
- Commit Messages (Conventional Commits)
- Submitting a Pull Request
- Releases
- Code of Conduct
- Security
- License
To file a clear, actionable bug report:
- Search existing issues to avoid duplicates.
- If not found, open a new issue and include:
- Descriptive title and summary
- Steps to reproduce (minimal repro if possible)
- Expected vs. actual behavior
- Environment details (OS, browser, Node.js/npm)
- Relevant logs, stack traces, or screenshots
When proposing an enhancement:
- Check open issues/PRs for similar ideas.
- Open a new issue describing:
- Motivation and use case
- Proposed API/UX (code snippets welcome)
- Alternatives considered and trade-offs
We use a simplified GitFlow:
- Default branch:
develop - Feature branches:
feature/<short-name>cut fromdevelop - Regular work: open PRs into
develop - Releases: open a PR from
developtomain- When the PR is merged, a release pipeline runs automatically on
main - After publishing,
mainis synced back intodevelop
- When the PR is merged, a release pipeline runs automatically on
See the workflows in .github/workflows/:
- CI:
.github/workflows/ci.yml(runs on pushes/PRs todevelopandfeature/**) - Release:
.github/workflows/release.yml(runs on push tomainand on manual dispatch)
- Clone the repository:
git clone git@github.com:addon-stack/inject-script.git cd inject-script - Install dependencies (Node.js 20+ recommended):
npm install
- Useful scripts:
npm run dev— build in watch mode (tsup)npm run build— production build (tsup)npm run format— format with Biomenpm run format:check— check formatting onlynpm run lint— Biome lint + format checksnpm run lint:fix— autofix safe issuesnpm run lint:fix:unsafe— autofix including unsafe transformsnpm run typecheck— TypeScript type checkingnpm run test— run tests (Jest)npm run test:ci— CI-friendly tests with coveragenpm run test:related— run tests related to staged/changed filesnpm run release— run release-it locally
We treat code quality seriously and run multiple static checks locally and in CI:
- Biome (formatter + linter) — configured via
biome.jsonnpm run format/npm run lint
- TypeScript type checks —
npm run typecheck - Unit tests (Jest) —
npm run test - Pre-commit automation (
lint-stagedvia Husky pre-commit hook):- For
src/**/*.{js,jsx,ts,tsx,cjs,mjs}:biome check --write --unsafethennpm run test:related - For
*.{json,css,scss,html}:biome format --write
- For
- CI mirrors this pipeline (lint → typecheck → test → build) and uploads coverage artifacts
Please ensure all commands above pass before opening a PR.
All commits MUST follow Conventional Commits:
<type>(optional scope): <short summary>
[optional body]
[optional footer(s)]
Common types: feat, fix, docs, style, refactor, test, chore.
Examples:
feat(core): add MV3 documentId targetingfix(v2): handle timeout cleanupdocs: update README with API examples
Enforcement:
- We use Husky + commitlint. The
commit-msghook runs commitlint and blocks non‑conforming messages. - Config:
.commitlintrc.jsonextends@commitlint/config-conventional.
Tip: for complex changes, prefer multiple small commits over one large commit.
- Create a branch from
develop:git checkout -b feature/<short-name>
- Make your changes under
src/and update docs/tests if needed. - Run quality gates locally:
npm run lint && npm run typecheck && npm run test && npm run build
- Commit using Conventional Commits. The Husky hook will validate your message.
- Push and open a PR into
develop. - PR checklist:
- Lint, types, and tests pass in CI
- Docs updated (README/CONTRIBUTING if applicable)
- Linked related issues (e.g.,
Closes #123) - Clear description of changes and motivation
Maintainers perform release PRs from develop → main (see below).
Releases are automated via GitHub Actions + release-it:
- Trigger: merge/push to
main(or manual dispatch with inputs) - Steps (see
.github/workflows/release.yml):- Run the full CI matrix
- Execute
release-itin CI (--ci) with conventional changelog - Create a Git tag and GitHub Release
- Publish to npm using
NPM_TOKENand selected dist-tag - Sync
mainback intodevelop
Local dry-run is available via npm run release (requires proper credentials for a real publish).
Please read and follow our Code of Conduct in all interactions.
If you discover a vulnerability, please follow our Security Policy and avoid disclosing publicly until fixed.
By contributing, you agree that your contributions will be licensed under the project’s MIT License. See LICENSE.md.