Thank you for your interest in contributing to visnap! This document provides guidelines for contributing to this project.

Development Setup

  1. Clone the repository

    git clone https://github.com/behnamazimi/visnap
    cd visnap
  2. Install dependencies

    npm install
  3. Build packages

    npm run build
  4. Run tests

    npm run test

Package Structure

This is a monorepo with the following packages:

  • @visnap/protocol - Shared types and interfaces
  • @visnap/playwright-adapter - Playwright browser integration
  • @visnap/storybook-adapter - Storybook integration
  • @visnap/core - Core functionality
  • visnap - Command-line interface

All packages share the same version number (fixed versioning).

Making Changes

Code Style

  • Follow the existing code style and patterns
  • Run npm run lint to check for linting issues
  • Run npm run check-types to verify there are no TypeScript type errors
  • Ensure all tests pass with npm run test

Creating Changesets

When making changes that should be released, you need to create a changeset:

  1. Create a changeset describing your changes:

    npx changeset
  2. Follow the prompts to:

    • Select which packages are affected (usually all packages)
    • Choose the type of change (patch, minor, major)
    • Write a clear description of the changes
  3. Include the changeset file in your PR

When to create a changeset:

  • ✅ Bug fixes, new features, breaking changes
  • ❌ Internal refactoring, documentation updates, tests

Write clear descriptions:

  • ✅ "Fix CLI command failing on Windows"
  • ❌ "Fix bugs"

Pull Request Process

  1. Create a feature branch from main
  2. Make your changes
  3. Add tests if applicable
  4. Create a changeset if the change should be released
  5. Submit a pull request with a clear description

Release Process

This project uses automated releases with Changesets:

  • Once your PR with changesets is merged to main, a "Version Packages" PR will be automatically created
  • Maintainers review and merge the version PR
  • Packages are automatically published to npm

Guidelines

  • Ensure all tests pass before submitting
  • Follow the existing code style and patterns
  • Include tests for new functionality
  • Update documentation if needed
  • Create a changeset for any changes that should be released