Skip to content

Latest commit

 

History

History
59 lines (46 loc) · 1.86 KB

File metadata and controls

59 lines (46 loc) · 1.86 KB

Contributing

Thanks for your interest in contributing to React Theme Toggle! This guide covers code contributions and releasing.

Project layout

src/
  components/ToggleTheme.tsx  # The component (inline styles, no CSS import)
  index.ts                    # Public API
src/app/                       # The demo site (Next.js)
tsup.config.ts                 # Library build (ESM + CJS + types)
.github/workflows/
  ci.yml                       # Lint + typecheck + library build
  deploy.yml                   # Demo site -> GitHub Pages
  publish.yml                  # npm publish on version tags

Getting started

bun install
bun run dev

Run the checks before opening a PR:

bun run lint
bun run typecheck
bun run build:lib

Code contributions

  1. Branch. Work on a descriptive branch off main, e.g. feat/controlled-uncontrolled.
  2. Style. Match the existing conventions: TypeScript, readable multi-line formatting, and no dead code. Lint and typecheck must pass.
  3. Component. The component is rendered with inline styles so consumers never need to import CSS. Keep it that way. It must stay fully controlled (selectedTheme + onChange) and accessible (checkbox + label, keyboard focusable, ariaLabel).
  4. Demo. Showcase any new prop or behavior in src/app/page.tsx.
  5. PR. Open a pull request against main. CI runs lint, typecheck, and the library build. Merges to main deploy the demo to GitHub Pages.

Releasing

Releases are cut from version tags:

  1. Bump the version in package.json (e.g. 2.1.0).
  2. Commit and push, then tag it: git tag v2.1.0 && git push origin v2.1.0.
  3. The Publish workflow builds the package and runs npm publish.

The publish workflow needs an NPM_TOKEN secret (an npm access token) configured in the repository settings. Without it the workflow will fail.