@jaypie/repokit
Prerequisites: npm install -D @jaypie/repokit
Overview
Section titled “Overview”@jaypie/repokit bundles common development tools to reduce dependency duplication across monorepo packages.
Installation
Section titled “Installation”npm install -D @jaypie/repokitQuick Reference
Section titled “Quick Reference”Bundled Tools
Section titled “Bundled Tools”| Tool | Purpose | Command |
|---|---|---|
dotenv |
Environment variables | npx dotenv |
env-cmd |
Run with env file | npx env-cmd |
rimraf |
Cross-platform rm -rf | npx rimraf |
sort-package-json |
Sort package.json | npx sort-package-json |
tsx |
TypeScript execution | npx tsx |
Environment Variables
Section titled “Environment Variables”Load .env file:
npx dotenv -- node script.jsRun with Env File
Section titled “Run with Env File”npx env-cmd -f .env.local npm run devIn package.json:
{ "scripts": { "dev": "env-cmd -f .env.local tsx watch src/server.ts" }}Clean Build Output
Section titled “Clean Build Output”npx rimraf distIn package.json:
{ "scripts": { "clean": "rimraf dist", "build": "npm run clean && vite build" }}Sort package.json
Section titled “Sort package.json”npx sort-package-jsonIn package.json:
{ "scripts": { "format:package": "sort-package-json" }}TypeScript Execution
Section titled “TypeScript Execution”Run TypeScript directly:
npx tsx src/script.tsWatch mode:
npx tsx watch src/server.tsMonorepo Benefits
Section titled “Monorepo Benefits”Install once at root, available to all packages:
project/├── package.json # Has @jaypie/repokit├── packages/│ ├── api/│ │ └── package.json # No need for rimraf, tsx, etc.│ └── worker/│ └── package.jsonCommon Scripts
Section titled “Common Scripts”{ "scripts": { "build": "rimraf dist && vite build && tsc --emitDeclarationOnly", "clean": "rimraf dist", "dev": "env-cmd -f .env.local tsx watch src/server.ts", "format:package": "sort-package-json" }}dotenv-cli vs env-cmd
Section titled “dotenv-cli vs env-cmd”Both are included. Prefer env-cmd for:
- Multiple env files:
env-cmd -f .env.local -f .env.secrets - Fallback files:
env-cmd -f .env.local --fallback
Use dotenv for simple cases:
dotenv -- node script.jsRelated
Section titled “Related”- @jaypie/eslint - Linting configuration
- Project Structure - Monorepo setup