### Basic tsdown CLI Usage Source: https://tsdown.dev/guide/getting-started Verify tsdown installation and explore its capabilities by running commands to check the version or display help information. ```sh ./node_modules/.bin/tsdown --version ``` ```sh ./node_modules/.bin/tsdown --help ``` -------------------------------- ### Run tsdown Bundle and Verify Output Source: https://tsdown.dev/guide/getting-started Execute the tsdown build command and then run the generated JavaScript file to verify that your code bundles and executes correctly. ```sh ./node_modules/.bin/tsdown ``` ```sh node dist/index.mjs ``` -------------------------------- ### Create First tsdown Bundle Source: https://tsdown.dev/guide/getting-started Define source TypeScript files and a tsdown configuration file to create your first bundle. This demonstrates the basic workflow of tsdown. ```ts import { hello } from './hello.ts' hello() ``` ```ts export function hello() { console.log('Hello tsdown!') } ``` ```ts import { defineConfig } from 'tsdown' export default defineConfig({ entry: ['./src/index.ts'], }) ``` -------------------------------- ### Install tsdown with Package Managers Source: https://tsdown.dev/guide/getting-started Install tsdown as a development dependency using various package managers like npm, pnpm, yarn, and bun. This is a prerequisite for using tsdown in your project. ```sh npm install -D tsdown ``` ```sh pnpm add -D tsdown ``` ```sh yarn add -D tsdown ``` ```sh bun add -D tsdown ``` -------------------------------- ### Install TypeScript as a Development Dependency Source: https://tsdown.dev/guide/getting-started Optionally install TypeScript as a development dependency if you are not using `isolatedDeclarations`. This ensures TypeScript is available for type checking and compilation. ```sh npm install -D typescript ``` ```sh pnpm add -D typescript ``` ```sh yarn add -D typescript ``` ```sh bun add -D typescript ``` -------------------------------- ### Create a New Project with tsdown CLI Source: https://tsdown.dev/guide/getting-started Use the create-tsdown CLI to quickly scaffold new projects with pre-configured templates for pure TypeScript libraries, React, or Vue frontend applications. ```sh npm create tsdown@latest ``` ```sh pnpm create tsdown@latest ``` ```sh yarn create tsdown@latest ``` ```sh bun create tsdown@latest ``` -------------------------------- ### Configure tsdown with Plugins Source: https://tsdown.dev/guide/getting-started Extend tsdown's functionality by integrating plugins, including Rolldown, Unplugin, and most Rollup plugins. Add plugins to the `plugins` array in your configuration file. ```ts import SomePlugin from 'some-plugin' import { defineConfig } from 'tsdown' export default defineConfig({ plugins: [SomePlugin()], }) ``` -------------------------------- ### Add tsdown Build Script to package.json Source: https://tsdown.dev/guide/getting-started Integrate the tsdown build command into your project's `package.json` scripts for easier execution. This allows you to run builds using standard npm commands. ```json { "name": "my-tsdown-project", "type": "module", "scripts": { "build": "tsdown" }, "devDependencies": { "tsdown": "^0.9.0" } } ``` -------------------------------- ### Enable Watch Mode in tsdown Source: https://tsdown.dev/guide/getting-started Activate watch mode using the `--watch` or `-w` option to automatically rebuild your project whenever files change. This is beneficial for development workflows. ```bash tsdown --watch ``` -------------------------------- ### Run tsdown Migration with Multiple Directories Source: https://tsdown.dev/guide/migrate-from-tsup Explicitly list multiple directories to migrate using the tsdown-migrate command. This provides precise control over which parts of your project are migrated. ```bash npx tsdown-migrate packages/foo packages/bar ``` -------------------------------- ### Run tsdown Migration Command Source: https://tsdown.dev/guide/migrate-from-tsup Execute the tsdown-migrate command to initiate the migration process from tsup. This command can be run directly using npx. It's recommended to save your changes before running the migration. ```bash npx tsdown-migrate ``` -------------------------------- ### Run tsdown Migration with Glob Patterns Source: https://tsdown.dev/guide/migrate-from-tsup For monorepos, specify directories to migrate using glob patterns with the tsdown-migrate command. This allows for targeted migration of specific packages or directories. ```bash npx tsdown-migrate packages/* ``` -------------------------------- ### Perform a Dry Run of tsdown Migration Source: https://tsdown.dev/guide/migrate-from-tsup Use the --dry-run or -d flag with the tsdown-migrate command to preview the migration without making any actual changes to your configuration files. This is useful for understanding the impact of the migration. ```bash npx tsdown-migrate --dry-run ``` ```bash npx tsdown-migrate -d ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.