### Install and Initialize ts-builds for a New Project Source: https://github.com/jordanburke/ts-builds/blob/main/README.md This snippet demonstrates the steps to install ts-builds and tsdown for a new project, initialize the configuration, create source files, and run the initial validation. ```bash mkdir my-library && cd my-library pnpm init # Install (bundles all tooling) pnpm add -D ts-builds tsdown # Initialize npx ts-builds init # Creates .npmrc with hoist patterns npx ts-builds config # Creates ts-builds.config.json # Create source files mkdir src test echo 'export const hello = () => "Hello!"' > src/index.ts # Validate npx ts-builds validate ``` -------------------------------- ### Install and Initialize ts-builds for an Existing Project Source: https://github.com/jordanburke/ts-builds/blob/main/README.md This snippet shows how to add ts-builds to an existing project, initialize its configuration, clean up redundant dependencies, and run validation. ```bash pnpm add -D ts-builds tsdown npx ts-builds init # Creates .npmrc npx ts-builds config # Creates config file npx ts-builds cleanup # Remove redundant dependencies npx ts-builds validate ``` -------------------------------- ### ts-builds CLI Setup Commands Source: https://github.com/jordanburke/ts-builds/blob/main/README.md A collection of ts-builds CLI commands for setting up and configuring the build environment, including creating configuration files and displaying information. ```bash npx ts-builds init # Create .npmrc with hoist patterns npx ts-builds config # Create ts-builds.config.json npx ts-builds config --force # Overwrite existing config npx ts-builds info # Show bundled packages npx ts-builds cleanup # Remove redundant dependencies npx ts-builds help # Show all commands ``` -------------------------------- ### Basic ts-builds Configuration Source: https://github.com/jordanburke/ts-builds/blob/main/README.md A simple `ts-builds.config.json` example defining the source directory and the sequence of tasks for the validation chain. ```json { "srcDir": "./src", "validateChain": ["format", "lint", "typecheck", "test", "build"] } ``` -------------------------------- ### List Bundled Packages with ts-builds CLI Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md The `info` command lists all packages that are bundled with the ts-builds configuration and do not require separate installation by the user. ```bash npx ts-builds info ``` -------------------------------- ### Configure Monorepo Support in ts-builds Source: https://github.com/jordanburke/ts-builds/blob/main/ROADMAP.md This JSON configuration example shows how to set up ts-builds for monorepo projects. It defines the packages within the monorepo, specifies the build order for these packages, and chains custom build commands. ```json { "monorepo": { "packages": ["shared", "shared-ui", "app"], "buildOrder": [["shared"], ["shared-ui"], ["app"]] }, "chains": { "build:all": ["build:shared", "build:shared-ui", "build:app"] } } ``` -------------------------------- ### Launch Vitest UI for Interactive Testing Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md Starts the Vitest UI, providing an interactive interface for running and debugging tests. This is useful for exploring test results and debugging complex test scenarios. ```bash pnpm test:ui ``` -------------------------------- ### ts-builds Configuration with Custom ESLint Plugins Source: https://github.com/jordanburke/ts-builds/blob/main/README.md This configuration demonstrates how to instruct ts-builds to use the project's local ESLint installation, which is useful when custom ESLint plugins are required. ```json { "srcDir": "./src", "lint": { "useProjectEslint": true } } ``` -------------------------------- ### ts-builds Advanced Configuration for Monorepos Source: https://github.com/jordanburke/ts-builds/blob/main/README.md An advanced configuration example for monorepos, showcasing custom commands, specifying working directories (`cwd`), and defining complex validation chains. ```json { "srcDir": "./src", "commands": { "compile": "tsc", "docs:validate": "pnpm docs:build && pnpm docs:check", "landing:validate": { "run": "pnpm validate", "cwd": "./landing" } }, "chains": { "validate": ["validate:core", "validate:landing"], "validate:core": ["format", "lint", "compile", "test", "docs:validate", "build"], "validate:landing": ["landing:validate"] } } ``` -------------------------------- ### Update Documentation with Standardized Development Commands Source: https://github.com/jordanburke/ts-builds/blob/main/STANDARDIZATION_GUIDE.md This Markdown snippet shows how to update project documentation (like README.md or CLAUDE.md) to reflect the standardized development commands. It highlights the main `pnpm run ci` command and provides clear explanations for individual formatting, linting, testing, and building commands, emphasizing the distinction between check and fix operations. ```markdown ## Development Commands ### Pre-Checkin Command ```bash pnpm run ci # 🚀 Main command: format, lint, test, and build everything ``` ### Individual Commands ```bash # Formatting pnpm format # Format code with Prettier pnpm format:check # Check formatting without writing # Linting pnpm lint # Fix ESLint issues pnpm lint:check # Check ESLint issues without fixing # Testing pnpm test # Run tests once pnpm test:watch # Run tests in watch mode pnpm test:coverage # Run tests with coverage report # Building pnpm build # Production build pnpm dev # Development mode with watch ``` ``` -------------------------------- ### Configure Cloudflare Workers Support in ts-builds Source: https://github.com/jordanburke/ts-builds/blob/main/ROADMAP.md This JSON configuration example illustrates how to set up ts-builds for Cloudflare Workers projects. It defines the source directory, sets the platform to 'cloudflare-worker', and customizes deployment commands. ```json { "srcDir": "./src", "platform": "cloudflare-worker", "commands": { "deploy:dev": "wrangler deploy --env development", "deploy:prod": "wrangler deploy --env production" } } ``` -------------------------------- ### Link and Use CLI Globally Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md Links the local project globally, allowing the CLI to be executed directly from any terminal. This facilitates testing the CLI as if it were installed globally. ```bash # Or link globally pnpm link --global ts-builds help ``` -------------------------------- ### Minimal SPA Setup with Vite in package.json Source: https://context7.com/jordanburke/ts-builds/llms.txt This package.json configuration is for a minimal Single Page Application (SPA) using Vite. It sets up basic project information, references the ts-builds Prettier configuration, and delegates common development and build commands to the ts-builds package. Vite is included as a development dependency. ```json { "name": "my-spa", "version": "1.0.0", "type": "module", "prettier": "ts-builds/prettier", "scripts": { "validate": "ts-builds validate", "format": "ts-builds format", "lint": "ts-builds lint", "typecheck": "ts-builds typecheck", "test": "ts-builds test", "build": "ts-builds build", "dev": "ts-builds dev", "preview": "ts-builds preview" }, "devDependencies": { "ts-builds": "^2.5.0", "vite": "^7.0.0" } } ``` -------------------------------- ### Development Build with Watch Mode Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md Starts a development build that includes watch mode, providing faster rebuilds and hot reloading. This command is an alias for `pnpm build:watch`. ```bash pnpm dev ``` -------------------------------- ### Display Bundled Packages with ts-builds Source: https://context7.com/jordanburke/ts-builds/llms.txt Lists all packages that are included within the ts-builds package. These are the tools that do not need to be installed separately in your project. ```bash npx ts-builds info # Output: # ts-builds bundles these packages: # You DON'T need to install: # - @eslint/js # - @vitest/coverage-v8 # - @vitest/ui # - cross-env # - eslint # - eslint-config-prettier # - eslint-plugin-prettier # - eslint-plugin-simple-import-sort # - prettier # - rimraf # - ts-node # - typescript # - typescript-eslint # - vitest ``` -------------------------------- ### Update GitHub Actions Workflow with Standardized CI Command Source: https://github.com/jordanburke/ts-builds/blob/main/STANDARDIZATION_GUIDE.md This YAML snippet demonstrates updating GitHub Actions workflows to use the standardized `pnpm run ci` command. This replaces individual commands for linting, testing, and building with a single, comprehensive pre-checkin validation pipeline, simplifying CI/CD processes. ```yaml - run: pnpm install - run: pnpm run ci ``` -------------------------------- ### Standardize package.json Scripts for TypeScript Projects Source: https://github.com/jordanburke/ts-builds/blob/main/STANDARDIZATION_GUIDE.md This JSON snippet defines standardized npm/pnpm scripts for a TypeScript project. It includes commands for continuous integration (`ci`), code formatting (`format`, `format:check`), linting (`lint`, `lint:check`), testing (`test`, `test:watch`, `test:coverage`, `test:ui`), building (`build`, `build:watch`, `dev`), and pre-publish checks (`prepublishOnly`). These scripts promote consistency and safety across development workflows. ```json { "scripts": { "ci": "pnpm format && pnpm lint:check && pnpm test && pnpm build", "format": "prettier --write .", "format:check": "prettier --check .", "lint": "eslint ./src --fix", "lint:check": "eslint ./src", "test": "vitest run", "test:watch": "vitest", "test:coverage": "vitest run --coverage", "test:ui": "vitest --ui", "build": "rimraf dist && cross-env NODE_ENV=production tsdown", "build:watch": "tsdown --watch", "dev": "tsdown --watch", "prepublishOnly": "pnpm ci", "ts-types": "tsc --noEmit" } } ``` -------------------------------- ### Minimal TypeScript Library Setup in package.json Source: https://context7.com/jordanburke/ts-builds/llms.txt This package.json configuration is for a minimal TypeScript library. It includes essential fields for publishing an ES module, specifies build output directories, and delegates script commands to the ts-builds package. It also lists ts-builds and tsdown as development dependencies. ```json { "name": "my-library", "version": "1.0.0", "type": "module", "main": "./dist/index.js", "types": "./dist/index.d.ts", "exports": { ".": { "import": "./dist/index.js", "types": "./dist/index.d.ts" } }, "files": ["dist"], "prettier": "ts-builds/prettier", "scripts": { "validate": "ts-builds validate", "format": "ts-builds format", "format:check": "ts-builds format:check", "lint": "ts-builds lint", "lint:check": "ts-builds lint:check", "typecheck": "ts-builds typecheck", "test": "ts-builds test", "test:watch": "ts-builds test:watch", "test:coverage": "ts-builds test:coverage", "build": "ts-builds build", "dev": "ts-builds dev", "prepublishOnly": "pnpm validate" }, "devDependencies": { "ts-builds": "^2.5.0", "tsdown": "^0.20.0" } } ``` -------------------------------- ### Standardize npm Scripts for TypeScript Builds Source: https://github.com/jordanburke/ts-builds/blob/main/STANDARDIZATION_GUIDE.md This snippet shows the transformation of npm scripts from an inconsistent format to a standardized one. The standardized scripts use pnpm for package management and include commands for formatting, linting, testing, and building, ensuring a reliable workflow. ```json { "scripts": { "build": "tsc && webpack", "test": "jest", "lint:format": "prettier --write .", "lint:fix": "eslint --fix src", "prepublishOnly": "npm run build" } } ``` ```json { "scripts": { "ci": "pnpm format && pnpm lint:check && pnpm test && pnpm build", "format": "prettier --write .", "format:check": "prettier --check .", "lint": "eslint ./src --fix", "lint:check": "eslint ./src", "test": "jest", "build": "rimraf dist && tsc && webpack", "dev": "webpack --watch", "prepublishOnly": "pnpm ci" } } ``` -------------------------------- ### Initialize Project with ts-builds CLI Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md Initializes a new project using the ts-builds CLI, typically by creating a `.npmrc` file. This is the default command when running `npx ts-builds` without arguments. ```bash npx ts-builds ``` -------------------------------- ### Display ts-builds CLI Help Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md Shows the help message and usage instructions for the ts-builds CLI, detailing available commands and their options. ```bash npx ts-builds help ``` -------------------------------- ### Build and Run CLI Locally Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md Builds the project for production and then executes the compiled CLI from the `dist/` directory. This is useful for testing the CLI's functionality after a build. ```bash # Build first, then test pnpm build node dist/cli.js help node dist/cli.js info ``` -------------------------------- ### Default CLI Configuration (JSON) Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md This JSON configuration file sets up default directories for source and tests, enables the use of project-specific ESLint, and defines the validation command chain. ```json { "srcDir": "./src", "testDir": "./test", "lint": { "useProjectEslint": true }, "validateChain": ["format", "lint", "typecheck", "test", "build"] } ``` -------------------------------- ### Production Build Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md Creates a production-ready build of the project, outputting optimized and minified code to the `dist/` directory. This build is intended for deployment. ```bash pnpm build ``` -------------------------------- ### Run All Validations (Format, Lint, Test, Build) Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md The `pnpm validate` command is the main pre-checkin command. It orchestrates formatting, linting, testing, and building all components of the project to ensure code quality and consistency before committing. ```bash pnpm validate ``` -------------------------------- ### Clean Dependencies with Auto-Confirmation Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md Executes the `cleanup` command and automatically confirms the removal of redundant dependencies, streamlining the process. ```bash npx ts-builds cleanup --yes ``` -------------------------------- ### Extending Prettier Configuration with ts-builds Source: https://github.com/jordanburke/ts-builds/blob/main/README.md This JSON configuration shows how to reference the Prettier configuration provided by ts-builds. ```json { "prettier": "ts-builds/prettier" } ``` -------------------------------- ### Extending Vitest Configuration with ts-builds Source: https://github.com/jordanburke/ts-builds/blob/main/README.md This TypeScript code demonstrates how to import and extend the base Vitest configuration from ts-builds in a `vitest.config.ts` file. ```typescript // vitest.config.ts import { defineConfig } from "vitest/config" import baseConfig from "ts-builds/vitest" export default defineConfig(baseConfig) ``` -------------------------------- ### Run Tests Once Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md Executes all defined tests within the project once. This command is typically used for verifying the correctness of the code after changes or as part of the build process. ```bash pnpm test ``` -------------------------------- ### ts-builds CLI Script Commands Source: https://github.com/jordanburke/ts-builds/blob/main/README.md This lists various ts-builds CLI commands for executing common development tasks such as validation, formatting, linting, testing, building, and previewing. ```bash npx ts-builds validate # Run full validation chain npx ts-builds format # Format with Prettier npx ts-builds format:check # Check formatting only npx ts-builds lint # Lint with ESLint (--fix) npx ts-builds lint:check # Check lint only npx ts-builds typecheck # TypeScript type checking npx ts-builds test # Run tests once npx ts-builds test:watch # Watch mode npx ts-builds test:coverage # With coverage npx ts-builds build # Production build (tsdown or vite) npx ts-builds dev # Dev mode (tsdown --watch or vite dev server) npx ts-builds preview # Preview production build (vite preview) ``` -------------------------------- ### Initialize Project with ts-builds Source: https://context7.com/jordanburke/ts-builds/llms.txt Sets up a new project by creating necessary .npmrc hoist patterns for peer dependencies like ESLint and Prettier. This command ensures that CLI binaries from these dependencies are accessible within the project. ```bash # Initialize new project with ts-builds mkdir my-library && cd my-library pnpm init pnpm add -D ts-builds tsdown # Run init to create .npmrc with hoist patterns npx ts-builds init # Output: # Initializing ts-builds... # ✓ Updated .npmrc with 6 missing hoist pattern(s) # Done! Your project is configured to hoist CLI binaries from peer dependencies. ``` -------------------------------- ### Run Tests with Coverage Report Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md Executes tests and generates a code coverage report, typically using the v8 provider. This helps in understanding which parts of the codebase are covered by tests. ```bash pnpm test:coverage ``` -------------------------------- ### Extending ESLint Configuration with ts-builds Source: https://github.com/jordanburke/ts-builds/blob/main/README.md This JavaScript code snippet shows how to import and extend the base ESLint configuration provided by ts-builds in an `eslint.config.js` file. ```javascript // eslint.config.js import baseConfig from "ts-builds/eslint" export default [...baseConfig] ``` -------------------------------- ### Format Code with Prettier Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md This command formats the codebase using Prettier in write mode, ensuring consistent code style across the project. It relies on Prettier's configuration defined within the project. ```bash pnpm format ``` -------------------------------- ### Manual npm Version Bumping and Git Tagging Source: https://github.com/jordanburke/ts-builds/blob/main/RELEASE.md Commands to manually trigger version bumps for patch, minor, or major releases. These commands update the package.json version, create a git tag with a commit message, and push the tags to the remote repository, which in turn triggers the automated release workflow. ```bash # Patch release (bug fixes) npm version patch -m "fix: description" git push --follow-tags # Minor release (new features) npm version minor -m "feat: description" git push --follow-tags # Major release (breaking changes) npm version major -m "feat!: description" git push --follow-tags ``` -------------------------------- ### Run Tests with ts-builds Source: https://context7.com/jordanburke/ts-builds/llms.txt Provides commands for running Vitest tests in various modes: single run (`test`), watch mode for development (`test:watch`), coverage reports (`test:coverage`), and the Vitest UI (`test:ui`). ```bash # Run tests once npx ts-builds test # Runs: vitest run # Watch mode for development npx ts-builds test:watch # Runs: vitest # Generate coverage report npx ts-builds test:coverage # Runs: vitest run --coverage # Launch Vitest UI npx ts-builds test:ui # Runs: vitest --ui ``` -------------------------------- ### Extending TypeScript Configuration with ts-builds Source: https://github.com/jordanburke/ts-builds/blob/main/README.md This JSON configuration shows how to extend the base TypeScript configuration provided by ts-builds in a `tsconfig.json` file, allowing for custom compiler options. ```json { "extends": "ts-builds/tsconfig", "compilerOptions": { "outDir": "./dist" } } ``` -------------------------------- ### Extending tsdown Configuration with ts-builds Source: https://github.com/jordanburke/ts-builds/blob/main/README.md This TypeScript code snippet shows how to import the base tsdown configuration from ts-builds in a `tsdown.config.ts` file. ```typescript // tsdown.config.ts import baseConfig from "ts-builds/tsdown" export default baseConfig ``` -------------------------------- ### Create ts-builds Configuration File Source: https://context7.com/jordanburke/ts-builds/llms.txt Generates a default ts-builds.config.json file with standard settings. The `--force` option can be used to overwrite an existing configuration file if needed. ```bash # Create default configuration npx ts-builds config # Output: ✓ Created ts-builds.config.json # Force overwrite existing config npx ts-builds config --force ``` -------------------------------- ### Workaround for Cloudflare Workers and Monorepo with Custom Commands Source: https://github.com/jordanburke/ts-builds/blob/main/ROADMAP.md This JSON configuration demonstrates a workaround for integrating Cloudflare Workers and monorepo support using custom commands within ts-builds. It defines specific build, deploy, and development commands for workers, and chains them with other validation steps. ```json { "srcDir": "./src", "commands": { "build:workers": "tsc --build && tsc-alias", "deploy": "wrangler deploy", "dev:workers": "wrangler dev" }, "chains": { "validate": ["format", "lint", "typecheck", "test", "build:workers"] } } ``` -------------------------------- ### Check Prettier Formatting Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md This command checks if the code adheres to the Prettier formatting rules without making any modifications. It's useful for CI pipelines or for developers to quickly verify formatting compliance. ```bash pnpm format:check ``` -------------------------------- ### Package.json Scripts for ts-builds Integration Source: https://github.com/jordanburke/ts-builds/blob/main/README.md This JSON object shows how to integrate ts-builds commands directly into your project's `package.json` scripts for streamlined execution of build and validation tasks. ```json { "scripts": { "validate": "ts-builds validate", "format": "ts-builds format", "format:check": "ts-builds format:check", "lint": "ts-builds lint", "lint:check": "ts-builds lint:check", "typecheck": "ts-builds typecheck", "test": "ts-builds test", "test:watch": "ts-builds test:watch", "build": "ts-builds build", "dev": "ts-builds dev", "prepublishOnly": "pnpm validate" } } ``` -------------------------------- ### Watch Mode Build Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md Initiates a build process that watches for file changes and automatically recompiles the project. This is useful during development for faster iteration cycles. ```bash pnpm build:watch ``` -------------------------------- ### Format Code with ts-builds Source: https://context7.com/jordanburke/ts-builds/llms.txt Utilizes Prettier to format code. The `format` command applies formatting in place, while `format:check` verifies code formatting without making changes, returning a non-zero exit code if issues are found. ```bash # Format all files in place npx ts-builds format # Runs: prettier --write . # Check formatting without modifying files npx ts-builds format:check # Runs: prettier --check . # Exit code 0 if formatted, non-zero otherwise ``` -------------------------------- ### Integrate ts-builds Vite Configuration Source: https://github.com/jordanburke/ts-builds/blob/main/ROADMAP.md This TypeScript code snippet demonstrates how to integrate the ts-builds Vite configuration into a Vite project. It imports the base Vite configuration from 'ts-builds/vite' and merges it with custom project-specific configurations. ```typescript // vite.config.ts import { vite } from "ts-builds/vite" import { defineConfig, mergeConfig } from "vite" export default defineConfig( mergeConfig(vite, { // your customizations }), ) ``` -------------------------------- ### Check ESLint Issues Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md This command checks for ESLint issues without attempting to fix them. It's valuable for identifying potential code quality problems and ensuring adherence to project coding standards. ```bash pnpm lint:check ``` -------------------------------- ### Prettier Configuration Reference Source: https://context7.com/jordanburke/ts-builds/llms.txt This snippet shows how to reference the shared Prettier configuration from the ts-builds package within a project's package.json file. It points to the 'ts-builds/prettier' path for configuration. ```json { "name": "my-library", "prettier": "ts-builds/prettier" } ``` -------------------------------- ### SPA/React App Configuration for ts-builds Source: https://context7.com/jordanburke/ts-builds/llms.txt Configuration for single-page applications (SPAs) using Vite for builds and development server, specifying the source directory and the validation chain. ```json { "srcDir": "./src", "buildMode": "vite", "validateChain": ["format", "lint", "typecheck", "test", "build"] } ``` -------------------------------- ### Build Project with ts-builds Source: https://context7.com/jordanburke/ts-builds/llms.txt Handles project builds using either tsdown for libraries or Vite for SPAs, based on the `buildMode` configuration. Supports production builds (`build`), development watch mode (`dev`), and Vite preview (`preview`). ```bash # Production build for library (default: tsdown) npx ts-builds build # Runs: rimraf dist && cross-env NODE_ENV=production tsdown # Production build for SPA (when buildMode: "vite") npx ts-builds build # Runs: rimraf dist && vite build # Development mode with watch npx ts-builds dev # For libraries: tsdown --watch # For SPAs: vite (dev server with HMR) # Preview production build (vite only) npx ts-builds preview # Runs: vite preview ``` -------------------------------- ### Lint Code with ts-builds Source: https://context7.com/jordanburke/ts-builds/llms.txt Executes ESLint for code analysis. The `lint` command automatically fixes issues, while `lint:check` only reports them. Configure `useProjectEslint: true` to use project-local ESLint configurations. ```bash # Lint and auto-fix issues npx ts-builds lint # Runs: eslint --fix ./src # Check lint without fixing npx ts-builds lint:check # Runs: eslint ./src ``` -------------------------------- ### Run Validation Chain with ts-builds Source: https://context7.com/jordanburke/ts-builds/llms.txt Executes a predefined sequence of commands, typically including formatting, linting, type checking, testing, and building. Custom validation chains can be defined in the ts-builds configuration file. ```bash # Run default validation chain npx ts-builds validate # Output: # 📋 Running chain: validate [format → lint → typecheck → test → build] # ▶ Running format... # ✓ format complete # ▶ Running lint... # ✓ lint complete # ... ``` -------------------------------- ### Clean Redundant Dependencies with ts-builds CLI Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md Removes redundant dependencies from the `package.json` file. This helps in maintaining a lean and efficient project dependency list. ```bash npx ts-builds cleanup ``` -------------------------------- ### Configure Vite Build Mode in ts-builds Source: https://github.com/jordanburke/ts-builds/blob/main/ROADMAP.md This configuration enables Vite for building React Single Page Applications (SPAs) and other projects that prefer Vite over tsdown for bundling. It specifies the source directory and sets the build mode to 'vite'. ```json { "srcDir": "./src", "buildMode": "vite" } ``` -------------------------------- ### Run Custom Named Chain with ts-builds Source: https://context7.com/jordanburke/ts-builds/llms.txt Execute custom validation chains defined in the ts-builds configuration file using the npx command. This allows for specific validation sequences tailored to different parts of a project, such as core logic or landing pages. ```bash npx ts-builds validate:core npx ts-builds validate:landing ``` -------------------------------- ### Fix ESLint Issues Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md The `pnpm lint` command automatically fixes common linting issues identified by ESLint. It applies fixes in write mode, modifying the source files to comply with the defined linting rules. ```bash pnpm lint ``` -------------------------------- ### Extend ESLint Base Configuration with ts-builds Source: https://context7.com/jordanburke/ts-builds/llms.txt Extends the base ESLint configuration provided by ts-builds, adding TypeScript support, Prettier integration, import sorting, and project-specific rules. ```javascript // eslint.config.js import baseConfig from "ts-builds/eslint" export default [ ...baseConfig, { // Add project-specific rules rules: { "@typescript-eslint/explicit-function-return-type": "error", }, }, ] ``` -------------------------------- ### Extend Vite Configuration with ts-builds Source: https://context7.com/jordanburke/ts-builds/llms.txt Extends the base Vite configuration for SPA builds, integrating React plugins and configuring build output settings like output directory and target. ```typescript // vite.config.ts import { defineConfig, mergeConfig } from "vite" import { vite } from "ts-builds/vite" import react from "@vitejs/plugin-react" export default defineConfig( mergeConfig(vite, { plugins: [react()], // Base config includes: // - build.outDir: "dist" // - build.sourcemap: true // - build.target: "es2020" // - resolve.alias: { "@": "./src" } }), ) ``` -------------------------------- ### Extend tsdown Configuration with ts-builds Source: https://context7.com/jordanburke/ts-builds/llms.txt Extends the base tsdown configuration for library builds, specifying entry points and enabling features like ESM output and sourcemaps. ```typescript // tsdown.config.ts import { defineConfig } from "tsdown" import { tsdown as baseConfig } from "ts-builds/tsdown" export default defineConfig({ ...baseConfig, entry: ["src/index.ts"], // Base config includes: // - sourcemap: true // - clean: true // - dts: true (declaration files) // - format: ["esm"] // - minify: true in production // - target: "es2020" }) ``` -------------------------------- ### Extend ESLint Functype Configuration with ts-builds Source: https://context7.com/jordanburke/ts-builds/llms.txt Integrates the 'functype' ESLint configuration from ts-builds, providing support for functional programming concepts like Option, Either, and functional composition. ```javascript // eslint.config.js import functypeConfig from "ts-builds/eslint-functype" export default [ ...functypeConfig, // Includes: prefer-option, prefer-either, prefer-fold, // prefer-map, prefer-flatmap, no-imperative-loops, // prefer-do-notation ] ``` -------------------------------- ### Run Tests in Watch Mode Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md Runs tests continuously and automatically re-runs them when file changes are detected. This is ideal for TDD workflows, providing rapid feedback during development. ```bash pnpm test:watch ``` -------------------------------- ### Extend Vitest Configuration with ts-builds Source: https://context7.com/jordanburke/ts-builds/llms.txt Extends the base Vitest configuration provided by ts-builds to include specific settings for tests, such as coverage thresholds for lines, functions, and branches. ```typescript // vitest.config.ts import { defineConfig, mergeConfig } from "vitest/config" import baseConfig from "ts-builds/vitest" export default mergeConfig( baseConfig, defineConfig({ test: { // Override or extend settings coverage: { threshold: { lines: 80, functions: 80, branches: 80, }, }, }, }), ) ``` -------------------------------- ### Default Prettier Settings Source: https://context7.com/jordanburke/ts-builds/llms.txt These are the default Prettier settings provided by the ts-builds package. They define code formatting rules such as semicolon usage, trailing commas, quote style, print width, tab width, and end-of-line characters. ```javascript // Default Prettier settings from ts-builds { semi: false, trailingComma: "all", singleQuote: false, printWidth: 120, tabWidth: 2, endOfLine: "auto" } ``` -------------------------------- ### ts-builds Configuration File Structure Source: https://context7.com/jordanburke/ts-builds/llms.txt Defines the structure of the ts-builds.config.json file, which controls various aspects of the build process including source directories, build mode, linting settings, custom commands, and validation chains. ```json { "srcDir": "./src", "testDir": "./test", "buildMode": "tsdown", "lint": { "useProjectEslint": false }, "validateChain": ["format", "lint", "typecheck", "test", "build"], "commands": { "docs:build": "pnpm typedoc", "subproject": { "run": "pnpm validate", "cwd": "./packages/sub" } }, "chains": { "validate": ["validate:core", "validate:docs"], "validate:core": ["format", "lint", "typecheck", "test", "build"], "validate:docs": ["docs:build"] } } ``` -------------------------------- ### Remove Redundant Dependencies with ts-builds Source: https://context7.com/jordanburke/ts-builds/llms.txt Scans your project's package.json and removes dependencies that are already bundled within ts-builds. It can be run interactively or non-interactively using the `--yes` flag. ```bash # Interactive cleanup npx ts-builds cleanup # Output: # Found redundant packages that are bundled with ts-builds: # devDependencies to remove: # - eslint # - prettier # - typescript # Remove these packages? (y/N) y # ✓ Removed 3 redundant package(s) from package.json # Non-interactive cleanup npx ts-builds cleanup --yes ``` -------------------------------- ### Extend ESLint Functional Programming Configuration with ts-builds Source: https://context7.com/jordanburke/ts-builds/llms.txt Applies the functional programming (FP) ESLint configuration from ts-builds, which includes rules promoting immutability and functional patterns. ```javascript // eslint.config.js import fpConfig from "ts-builds/eslint-fp" export default [ ...fpConfig, // Includes: no-let, immutable-data, prefer-immutable-types ] ``` -------------------------------- ### Type Check Code with ts-builds Source: https://context7.com/jordanburke/ts-builds/llms.txt Runs the TypeScript compiler in a check-only mode (`tsc --noEmit`) without generating output files. This command verifies the project's types and exits with a non-zero code if type errors are detected. ```bash npx ts-builds typecheck # Runs: tsc --noEmit # Exit code 0 if no type errors, non-zero otherwise ``` -------------------------------- ### Check TypeScript Types Source: https://github.com/jordanburke/ts-builds/blob/main/CLAUDE.md Uses the TypeScript compiler (`tsc`) to check for type errors in the project without performing any transpilation. This ensures type safety across the codebase. ```bash pnpm ts-types ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.