Skip to content

Latest commit

 

History

History
250 lines (159 loc) · 4.62 KB

File metadata and controls

250 lines (159 loc) · 4.62 KB

Scripts

This document explains all npm scripts in the root package.json.

Quick Reference

Script Purpose
pnpm bootstrap First-time setup
pnpm dev Development mode
pnpm build Build all packages
pnpm test Run all tests
pnpm lint Lint all packages
pnpm typecheck Type-check all packages
pnpm verify Run lint + typecheck + test + build
pnpm format Format all files with Prettier
pnpm clean Remove build artifacts

Setup Scripts

pnpm bootstrap

First-time repository setup.

pnpm bootstrap

Runs scripts/bootstrap/cold-start.mjs:

  1. Checks Node.js version (requires >= 22)
  2. Checks pnpm version (requires 10.30.2)
  3. Optionally prompts for local npm authentication
  4. Optionally configures Turbo remote cache with Vercel
  5. Syncs Turbo cache settings to GitHub (TURBO_TEAM variable and TURBO_TOKEN secret)
  6. Prints npm trusted publishing setup guidance (per package)
  7. Installs dependencies
  8. Runs workspace verification (pnpm setup:verify)

Run this after cloning the repository.

pnpm bootstrap:doctor

Diagnose setup issues.

pnpm bootstrap:doctor

Runs prerequisite checks without installing. Use when bootstrap fails.

pnpm setup / pnpm setup:verify

  • setup is an alias for bootstrap
  • setup:verify runs full validation: typecheck, lint, build, test, then verify:release

Development Scripts

pnpm dev

Start development mode.

pnpm dev

Runs turbo run dev with watch mode enabled. Packages rebuild on file changes.

pnpm build

Build all packages.

pnpm build

Runs turbo run build. Outputs go to each package's dist/ directory.

pnpm clean

Remove build artifacts.

pnpm clean

Runs turbo run clean. Removes dist/, .turbo/, node_modules/, etc.


Quality Scripts

pnpm lint

Lint all packages.

pnpm lint

Runs ESLint across the workspace. Automatically fixes fixable issues.

pnpm typecheck

Type-check all packages.

pnpm typecheck

Runs tsc --noEmit in each package. Reports type errors without emitting files.

pnpm test

Run all tests.

pnpm test

Runs Vitest in each package.

pnpm test:coverage

Run tests with coverage.

pnpm test:coverage

Generates coverage reports in generated/test-coverage/.

pnpm verify

Run lint, typecheck, test, and build together.

pnpm verify

Equivalent to:

pnpm turbo run typecheck lint test build --continue

The --continue flag runs all tasks even if one fails, so you see all errors at once.

pnpm format

Format all files.

pnpm format

Runs Prettier on TypeScript, JSON, and Markdown files.


Validation Scripts

pnpm verify:release

Verify packages are ready for release.

pnpm verify:release

Runs release verification across all workspace packages:

  • For every package: runs typecheck, lint:check, test, and build release gates

pnpm docs:validate

Validate documentation.

pnpm docs:validate

Runs scripts/docs/validate-usage-guides.mjs:

  • Checks each package has a usage guide
  • Validates documentation structure

Release Scripts

pnpm release

Publish packages to npm.

pnpm release

Runs changeset publish. For brand-new packages, this initial publish is token-based and may require OTP.

pnpm prepare

Configure git hooks.

# Runs automatically on pnpm install
pnpm prepare

Sets core.hooksPath to .githooks/ so commitlint runs on commits.


Package-Level Scripts

Each package has its own scripts. Common patterns:

Script Purpose
build Build the package
dev Watch mode
test Run tests
test:coverage Tests with coverage
lint Lint the package
typecheck Type-check
clean Remove artifacts

Running Package Scripts

Use Turbo's filter:

# Test only utils
pnpm turbo run test --filter=@reasonabletech/utils

# Build only config packages
pnpm turbo run build --filter=@reasonabletech/config-*

Or run directly in the package:

cd packages/utils
pnpm test