Thank you for your interest in contributing to @cross/image! This document provides guidelines and instructions for contributing to the project.
- Deno (latest version)
- Node.js 18+ (for testing Node.js compatibility)
- Bun (for testing Bun compatibility)
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/image.git cd image - Install dependencies (Deno will handle this automatically on first run)
Run all tests:
deno test -ARun tests with coverage:
deno task checkCheck formatting:
deno fmt --checkApply formatting:
deno fmtRun linter:
deno lintCheck types:
deno check mod.ts
deno check test/*.test.tsBefore committing, run the precommit task to ensure all checks pass:
deno task precommitThis runs:
- Format checking
- Linting
- Type checking
- All tests
- Follow the existing code style
- Use TypeScript for all code
- Write clear, descriptive variable and function names
- Add JSDoc comments for public APIs
- Keep functions focused and single-purpose
- Write tests for all new features
- Use
@cross/testinstead ofDeno.testfor cross-runtime compatibility - Place tests in the
test/directory - Follow the naming convention:
feature_name.test.ts - Ensure tests pass on Deno, Node.js, and Bun
This library supports Deno, Node.js (18+), and Bun. Ensure your code works across all three runtimes:
- Avoid runtime-specific APIs where possible
- Use standard JavaScript/TypeScript features
- Test on all three runtimes before submitting
Write clear, descriptive commit messages:
- Use present tense ("Add feature" not "Added feature")
- Keep the first line under 72 characters
- Reference issues and PRs where relevant
Example:
Add support for ICO format decoding
- Implement ICO decoder
- Add tests for ICO format
- Update documentation
Fixes #123
-
Create a feature branch from
main:git checkout -b feature/your-feature-name
-
Make your changes following the code guidelines
-
Run tests and validation:
deno task precommit
-
Commit your changes with clear commit messages
-
Push to your fork:
git push origin feature/your-feature-name
-
Open a Pull Request against the
mainbranch -
Respond to feedback from reviewers
- All tests must pass
- Code must be formatted and linted
- Type checking must pass
- Documentation must be updated if needed
- New features should include tests
- Breaking changes should be clearly documented
When adding support for a new image format:
- Create a new format file in
src/formats/ - Implement the
ImageFormatinterface - Add the format to the formats list in
src/image.ts - Add comprehensive tests in
test/ - Update documentation in
docs/src/formats.md - Add examples if appropriate
- Update
README.mdfor user-facing changes - Update docs in
docs/src/for detailed documentation - Keep documentation concise and focused
- Include code examples where helpful
- Check existing issues
- Open a new issue for bugs or feature requests
- Join discussions in existing issues and PRs
By contributing to @cross/image, you agree that your contributions will be licensed under the MIT License.