{ cmd }: rec { # Install commands install = { pnpm }: { "pnpm:install" = cmd "Install dependencies" '' ${pnpm} install "$@" ''; "pnpm:install:frozen" = cmd "Install with frozen lockfile" '' ${pnpm} install --frozen-lockfile ''; }; # Build commands build = { pnpm }: { "pnpm:build" = cmd "Build the project" '' ${pnpm} build "$@" ''; "pnpm:build:watch" = cmd "Build in watch mode" '' ${pnpm} build --watch ''; }; # Development server dev = { pnpm }: { "pnpm:dev" = cmd "Start development server" '' ${pnpm} dev "$@" ''; }; # Test commands test = { pnpm }: { "pnpm:test" = cmd "Run tests" '' ${pnpm} test "$@" ''; "pnpm:test:watch" = cmd "Run tests in watch mode" '' ${pnpm} test --watch ''; "pnpm:test:coverage" = cmd "Run tests with coverage" '' ${pnpm} test --coverage "$@" ''; }; # Linting commands (eslint) lint = { pnpm }: { "pnpm:lint" = cmd "Run ESLint" '' ${pnpm} lint "$@" ''; "pnpm:lint:fix" = cmd "Auto-fix ESLint issues" '' ${pnpm} lint --fix "$@" ''; }; # Formatting commands (prettier) fmt = { pnpm }: { "pnpm:fmt" = cmd "Format code with Prettier" '' ${pnpm} format "$@" ''; "pnpm:fmt:check" = cmd "Check code formatting" '' ${pnpm} format --check "$@" ''; }; # TypeScript typecheck = { pnpm }: { "pnpm:typecheck" = cmd "Run TypeScript type checking" '' ${pnpm} typecheck "$@" ''; "pnpm:typecheck:watch" = cmd "Type check in watch mode" '' ${pnpm} typecheck --watch ''; }; # CI workflow ci = { pnpm }: { "pnpm:ci" = cmd "Run full CI suite (install, lint, typecheck, test, build)" '' set -e echo "Installing dependencies..." ${pnpm} install --frozen-lockfile echo "Running linter..." ${pnpm} lint echo "Running type checker..." ${pnpm} typecheck echo "Running tests..." ${pnpm} test echo "Building..." ${pnpm} build echo "CI passed!" ''; }; # Convenience: all standard commands all = { pnpm }: install { inherit pnpm; } // build { inherit pnpm; } // dev { inherit pnpm; } // test { inherit pnpm; } // lint { inherit pnpm; } // fmt { inherit pnpm; } // typecheck { inherit pnpm; } // ci { inherit pnpm; }; }