Contributing
Thank you for your interest in contributing to Craft! This guide will help you get started.
Development Setup
Section titled “Development Setup”Prerequisites
Section titled “Prerequisites”- Node.js v22+ (managed by Volta)
- pnpm
Installation
Section titled “Installation”# Clone the repositorygit clone https://github.com/getsentry/craft.gitcd craft
# Install dependenciespnpm install --frozen-lockfileDevelopment Commands
Section titled “Development Commands”| Command | Description |
|---|---|
pnpm build | Build the project (outputs to dist/craft) |
pnpm test | Run tests |
pnpm lint | Run ESLint |
pnpm fix | Auto-fix lint issues |
Manual Testing
Section titled “Manual Testing”To test your changes locally:
pnpm build && ./dist/craftProject Structure
Section titled “Project Structure”src/├── __mocks__/ # Test mocks├── __tests__/ # Test files (*.test.ts)├── artifact_providers/ # Artifact provider implementations├── commands/ # CLI command implementations├── schemas/ # JSON schema and TypeScript types├── status_providers/ # Status provider implementations├── targets/ # Release target implementations├── types/ # Shared TypeScript types├── utils/ # Utility functions├── config.ts # Configuration loading├── index.ts # CLI entry point└── logger.ts # Logging utilitiesCode Style
Section titled “Code Style”- TypeScript throughout the codebase
- Prettier for formatting (single quotes, no arrow parens)
- ESLint with
@typescript-eslint/recommended - Unused variables prefixed with
_are allowed
Testing
Section titled “Testing”- Tests use Jest with
ts-jest - Test files are in
src/__tests__/with the*.test.tspattern
# Run all testspnpm test
# Run tests in watch modepnpm test:watchAdding a New Target
Section titled “Adding a New Target”- Create a new file in
src/targets/(e.g.,myTarget.ts) - Implement the
BaseTargetinterface - Register the target in
src/targets/index.ts - Add configuration schema in
src/schemas/ - Write tests in
src/__tests__/ - Document the target in the docs
Pull Requests
Section titled “Pull Requests”- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
Pre-release Script Conventions
Section titled “Pre-release Script Conventions”The pre-release script (scripts/bump-version.sh) should:
- Accept old and new version as the last two arguments
- Replace version occurrences in project files
- Not commit changes
- Not change git state
Example:
#!/bin/bashset -euxOLD_VERSION="${1}"NEW_VERSION="${2}"
export npm_config_git_tag_version=falsenpm version "${NEW_VERSION}"Post-release Script Conventions
Section titled “Post-release Script Conventions”The post-release script (scripts/post-release.sh) runs after successful publish and should:
- Accept old and new version as arguments
- Handle its own git operations (commit, push)
Questions?
Section titled “Questions?”- Open an issue on GitHub
- Check existing issues and pull requests