Contributing
Learn how to contribute to Waveform Renderer development
We welcome contributions to Waveform Renderer! Whether you’re fixing bugs, adding features, improving documentation, or helping with testing, your work makes this project better for everyone. 🚀
Getting Started
Section titled “Getting Started”Prerequisites
Section titled “Prerequisites”Make sure you have:
- Node.js 18+
- pnpm (recommended package manager)
- Git for version control
- A GitHub account for pull requests
- Fork and clone the repository
git clone https://github.com/YOUR_USERNAME/waveform-renderer.gitcd waveform-renderer
- Install dependencies
pnpm install
- Verify installation
pnpm test # Run testspnpm build # Build packagespnpm dev:lib # Start development mode
Project Structure
Section titled “Project Structure”Waveform Renderer is a monorepo:
waveform-renderer/├── packages/│ ├── waveform-renderer/ # Main library│ │ ├── src/ # Source code│ │ ├── test/ # Unit tests│ │ └── dist/ # Build output│ └── docs/ # Documentation site├── pnpm-workspace.yaml└── package.json
Development
Section titled “Development”Library
Section titled “Library”pnpm dev:lib # Start dev mode (watch mode)pnpm build:lib # Build librarypnpm test # Run testspnpm lint # Run linterpnpm type-check # TypeScript checks
Documentation
Section titled “Documentation”pnpm dev:docs # Start docs serverpnpm build:docs # Build docs
Global
Section titled “Global”pnpm build # Build everythingpnpm test # Run all testspnpm lint # Lint all packagespnpm format # Format code
Testing
Section titled “Testing”Waveform Renderer has 200+ unit tests powered by Vitest.
pnpm test # Run all testspnpm test:coverage # Run with coverage (inside /waveform-renderer)
Example:
import { describe, it, expect, beforeEach } from "vitest";import { WaveformRenderer } from "../src/renderer";
describe("WaveformRenderer", () => { let canvas: HTMLCanvasElement; let peaks: number[];
beforeEach(() => { canvas = document.createElement("canvas"); peaks = Array.from({ length: 100 }, () => Math.random()); });
it("initializes correctly", () => { const waveform = new WaveformRenderer(canvas, peaks); expect(waveform).toBeDefined(); waveform.destroy(); });});
Guidelines:
- Test happy path + edge cases
- Clean up with
destroy()
- Use descriptive test names
- Group related tests with
describe
Code Style
Section titled “Code Style”- Strict TypeScript – no
any
- Explicit types for public APIs
- JSDoc comments on exported methods
- Consistent naming – camelCase (vars), PascalCase (classes)
// ✅ Goodexport interface WaveformOptions { color?: string;}
export class WaveformRenderer { constructor(canvas: HTMLCanvasElement, peaks: number[]) {}}
// ❌ Avoidfunction doStuff(data: any): any {}
Linting uses oxlint:
pnpm lint
Pull Requests
Section titled “Pull Requests”Before you start
Section titled “Before you start”- Check existing issues
- Open an issue first for significant changes
- Keep PRs focused – one fix/feature per PR
Workflow
Section titled “Workflow”- Create a feature branch
git checkout -b feature/your-feature
- Make changes
- Add tests + docs if needed
- Commit with conventional commits
git commit -m "feat: add custom renderer support"
- Push and open a PR on GitHub
PR Checklist
- Tests pass (
pnpm test
) - Types correct (
pnpm type-check
) - Code linted (
pnpm lint
) - Docs updated if necessary
Bug Reports
Section titled “Bug Reports”Please include:
- Clear description
- Steps to reproduce
- Expected vs actual behavior
- Environment info (browser, OS, version)
- Minimal code sample
Feature Requests
Section titled “Feature Requests”Include:
- What you need and why
- Example use case
- Proposed API (if possible)
- Alternatives considered
Documentation
Section titled “Documentation”Docs are built with Astro Starlight. To contribute:
pnpm dev:docs
Guidelines:
- Keep explanations simple
- Provide working examples
- Start with basics, then advanced
- Use visuals when helpful
Releases
Section titled “Releases”Handled by maintainers using a custom release script optimized for this monorepo.
Release Commands
Section titled “Release Commands”# Interactive release processpnpm release:lib
# Preview release without making changes (recommended first)pnpm release:lib --dry-run
Release Process
Section titled “Release Process”The custom release script includes:
- Repository checks - Ensures clean working directory
- Tests and linting - Full test suite and lint checks
- Build - Compiles the library
- Package preview - Shows files to be published with status:
- ✨ NEW - Files added since last release
- 📝 MODIFIED - Files changed since last release
- 🔄 UNCHANGED - Files with no changes
- ⚠️ INCLUDED - Potentially unnecessary files
- Version selection - Interactive choice (patch/minor/major/custom)
- Confirmation - Final approval before publishing
- Git operations - Creates commit and tag
- NPM publish - Publishes to npm registry
- GitHub push - Pushes changes and tags
Versioning
Section titled “Versioning”Follow Semantic Versioning:
- Major → Breaking changes
- Minor → Features (backward compatible)
- Patch → Fixes, docs, perf
Always test releases first with --dry-run
mode to preview changes without publishing.
Community
Section titled “Community”We follow the Contributor Covenant. Be respectful, inclusive, and constructive.
Get help via:
Useful Links
Section titled “Useful Links”- Repo: https://github.com/maximux13/waveform-renderer
- Docs: https://waveform-renderer.vercel.app
- NPM: https://www.npmjs.com/package/waveform-renderer
Thanks for contributing to Waveform Renderer! 🎉 Every pull request, issue, and comment helps make the project better.