Skip to content

Latest commit

 

History

History
132 lines (91 loc) · 3.36 KB

File metadata and controls

132 lines (91 loc) · 3.36 KB

Contributing to @solithix/drafts

Thanks for your interest in contributing! This guide covers everything you need to get started.

Prerequisites

Development Setup

  1. Fork and clone the repository:

    git clone https://github.com/<your-username>/drafts.git
    cd drafts
  2. Install dependencies:

    npm install
  3. Start the dev watcher:

    npm run dev

Available Commands

Command Description
npm run build Build with tsup (ESM, node18 target)
npm run dev Build in watch mode
npm run test Run tests (vitest)
npm run test:watch Run tests in watch mode
npm run typecheck TypeScript check (tsc --noEmit)

Project Structure

src/
  index.ts          # Commander CLI router
  commands/         # Command handlers (init, add feature/page/component)
  templates/        # String template constants with {{variable}} placeholders
  ui/               # Terminal UX (figlet, clack, ora, gradient)
  utils/            # File I/O, shell exec, interpolation, project detection
tests/              # Test files (vitest)

Key things to know:

  • ESM-only — use .js extensions in relative imports
  • Templates are strings, not files on disk. They live in src/templates/ as exported constants and use {{variableName}} syntax interpolated by src/utils/template.ts.
  • tsup bundles everything to a single dist/index.js with a #!/usr/bin/env node shebang.

Branch Model

We use a three-tier branch model:

  • main — production releases
  • dev — integration branch
  • Feature branches — your working branches

Branch Naming

Use a type prefix followed by a short kebab-case description:

feat/add-auth-template
fix/init-crash-on-windows
refactor/simplify-template-engine
chore/update-dependencies
docs/improve-readme

Creating a Branch

Always branch from dev:

git checkout dev
git pull origin dev
git checkout -b feat/your-feature

Commit Conventions

We follow Conventional Commits:

<type>(<scope>): <summary>
  • type: feat, fix, refactor, chore, docs, test, style, perf
  • scope (optional): area of the codebase (e.g., init, templates, cli)
  • summary: imperative, lowercase, no trailing period

Examples:

feat(init): add tailwind config to scaffold
fix(add-feature): handle missing package.json gracefully
docs: update contributing guide
chore: bump vitest to 3.2

Pull Request Process

  1. Make sure your code passes all checks:

    npm run typecheck
    npm run test
    npm run build
  2. Push your branch and open a PR against dev (not main).

  3. Fill out the PR template with a summary, change type, and checklist.

  4. PRs are squash-merged into dev. Merge commits are used from dev into main for releases.

Reporting Issues

Found a bug or have a feature idea? Open an issue using one of the provided templates.

Code of Conduct

This project follows the Contributor Covenant. By participating, you agree to uphold this standard.