Thank you for your interest in contributing to create-pull-request! This document provides guidelines and information about the development workflow.
- Node.js >= 20
- npm (comes with Node.js)
-
Fork the repository
git clone https://github.com/yourusername/create-pull-request.git cd create-pull-request -
Install dependencies
npm install
-
Run tests
npm test -
Test the CLI
node create-pull-request.js --help
The project is configured to work correctly on Windows, macOS, and Linux. If you encounter line ending issues on Windows, ensure your Git configuration is set up correctly:
# Configure Git to handle line endings automatically
git config --global core.autocrlf false
git config --global core.eol lfThe project includes:
.gitattributes- Ensures consistent line endings across platforms- CI configuration - Automatically handles line endings in GitHub Actions
- Cross-platform testing - Tests run on all three major operating systems
We use Vitest for testing. The test suite includes:
- Unit tests for all core functions
- Integration tests for complete workflows
- Edge case testing for error handling
- Mocked dependencies for isolated testing
# Run tests in watch mode (recommended during development)
npm test
# Run tests once
npm run test:run
# Run tests with coverage report
npm run test:coverage
# Run tests in watch mode with coverage
npm run test:watchThe project maintains the following coverage thresholds:
- Statements: 70%
- Branches: 85%
- Functions: 85%
- Lines: 70%
The project uses GitHub Actions for CI/CD. The workflow runs:
- Node.js versions: 20.x, 22.x, latest
- Operating systems: Ubuntu, macOS, Windows
- Total combinations: 9 different environments
-
Test Job
- Runs all tests on the matrix combinations
- Generates coverage reports
-
Lint Job
- Validates package.json
- Tests CLI functionality
- Performs basic sanity checks
The CI runs on:
- Push to
mainanddevelopbranches - Pull requests targeting
mainanddevelop
All new code should maintain or improve test coverage. The CI will fail if coverage drops below the thresholds.
When adding new browser support, ensure:
- Add browser to
SUPPORTED_BROWSERSincreate-pull-request.js - Update tests in
create-pull-request.test.js - Update README with new browser information
- Test manually that the browser opens correctly
When adding new platform support:
- Add platform handler to
SUPPORTED_PLATFORMS - Add comprehensive tests for URL generation
- Update documentation in README
- Test with real repositories from that platform
-
Create a feature branch
git checkout -b feature/your-feature-name
-
Make your changes
- Write code following existing patterns
- Add tests for new functionality
- Update documentation as needed
-
Test your changes
npm run test:coverage
-
Commit your changes
git commit -m "feat: add amazing new feature" -
Push and create PR
git push origin feature/your-feature-name
-
Wait for CI
- All tests must pass
- Coverage must meet thresholds
- CLI functionality must work
- Test the happy path: Ensure normal usage works
- Test edge cases: Invalid inputs, network errors, etc.
- Test integration: Complete workflows from start to finish
- Mock external dependencies: Keep tests fast and reliable
# Run a specific test file
npx vitest create-pull-request.test.js
# Run tests with specific pattern
npx vitest --grep "normalizeGitUrl"
# Run tests with debug output
npx vitest --reporter=verbose# Link the package locally for testing
npm link
# Now you can test the CLI globally
create-pull-request --help
# Unlink when done
npm unlink- Ensure all tests pass
- Update version in
package.json - Create release notes
- Tag the release
- Publish to npm
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Please be respectful and professional in all interactions. We want to maintain a welcoming environment for all contributors.
Thank you for contributing! 🎉