mirror of
https://github.com/vercel/streamdown.git
synced 2026-09-19 02:18:37 +08:00
3.9 KiB
3.9 KiB
Contributing to Streamdown
Thank you for your interest in contributing to Streamdown! We welcome contributions from the community.
Getting Started
Prerequisites
- Node.js 18 or higher
- pnpm (version specified in package.json
packageManagerfield)
Setup
- Fork the repository
- Clone your fork:
git clone https://github.com/your-username/streamdown.git cd streamdown - Install dependencies:
pnpm install - Build all packages (required before running tests):
pnpm build - Run the tests to ensure everything is working:
pnpm test
Development Workflow
Project Structure
This is a monorepo managed with Turbo. The main package is located at:
packages/streamdown/- The core Streamdown React component library
Available Scripts
pnpm dev- Start development modepnpm build- Build all packagespnpm test- Run testspnpm test:coverage- Run tests with coveragepnpm test:ui- Run tests with UIpnpm check- Check linting and formattingpnpm fix- Fix linting and formattingpnpm check-types- Type checking
Making Changes
-
Create a new branch for your feature or fix:
git checkout -b feature/your-feature-name -
Make your changes and ensure:
- All tests pass (
pnpm test) - Code is properly formatted (
pnpm format) - Type checking passes (
pnpm check-types) - Linting passes (
pnpm lint)
- All tests pass (
-
Write or update tests for your changes
-
Create a changeset for your changes:
pnpm changeset- Select the package(s) affected
- Choose the appropriate version bump (patch/minor/major)
- Write a concise description of the changes
Commit Guidelines
We follow conventional commits for clear commit history:
feat:New featuresfix:Bug fixesdocs:Documentation changesstyle:Code style changes (formatting, etc)refactor:Code changes that neither fix bugs nor add featurestest:Adding or updating testschore:Maintenance tasks
Examples:
feat: add support for custom code block themes
fix: resolve markdown parsing issue with nested lists
docs: update README with new API examples
Pull Request Process
-
Ensure your PR:
- Has a clear, descriptive title
- Includes a changeset (run
pnpm changesetif you haven't) - Passes all CI checks
- Includes tests for new functionality
- Updates documentation if needed
-
PR Description should include:
- What changes were made
- Why these changes were necessary
- Any breaking changes
- Screenshots/demos for UI changes
-
Link any related issues using keywords like
Fixes #123orCloses #456
Testing
Running Tests
# Run all tests
pnpm test
# Run tests with coverage
pnpm test:coverage
# Run tests with UI
pnpm test:ui
# Run tests in watch mode (in package directory)
cd packages/streamdown
pnpm vitest
Writing Tests
- Tests are located in
packages/streamdown/__tests__/ - Use descriptive test names
- Test both success and error cases
- Ensure good coverage for new features
Release Process
Releases are automated through GitHub Actions and changesets:
- When PRs with changesets are merged to
main, a "Version Packages" PR is automatically created - This PR updates package versions and changelogs
- When the Version Packages PR is merged, packages are automatically published to npm
Code Style
- We use TypeScript for type safety
- Follow the existing code style in the project
- Use meaningful variable and function names
- Add comments for complex logic
- Keep functions small and focused
Getting Help
- Open an issue for bugs or feature requests
- Join discussions in GitHub Discussions
- Check existing issues before creating new ones
License
By contributing to Streamdown, you agree that your contributions will be licensed under the Apache-2.0 License.