Skip to content

Commit 5ea7d3e

Browse files
feat: switch from tsup to tsdown (#2224)
<!-- 👋 Hi, thanks for sending a PR to create-typescript-app! 🎁 Please fill out all fields below and make sure each item is true and [x] checked. Otherwise we may not be able to review your PR. --> ## PR Checklist - [x] Addresses an existing open issue: fixes #2223 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md) were taken ## Overview Switches over, and includes intake/transition logic to remove the `bundle` property from old `tsup.config.ts` files. ~~Blocked from passing lint:spelling on streetsidesoftware/cspell-dicts#4518 -> #2237.~~ ✅ 🎁
1 parent ac941e4 commit 5ea7d3e

File tree

13 files changed

+479
-442
lines changed

13 files changed

+479
-442
lines changed

.github/DEVELOPMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pnpm install
1616
1717
## Building
1818

19-
Run [**tsup**](https://tsup.egoist.dev) locally to build source files from `src/` into output files in `lib/`:
19+
Run [**tsdown**](https://tsdown.dev) locally to build source files from `src/` into output files in `lib/`:
2020

2121
```shell
2222
pnpm build

docs/Blocks.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,16 @@ This table summarizes each block and which base levels they're included in:
5050
| Renovate | `--add-renovate`, `--exclude-renovate` | | | 💯 |
5151
| Security Docs | `--add-security-docs`, `--exclude-security-docs` | ✔️ || 💯 |
5252
| Templated With | `--add-templated-with`, `--exclude-templated-with` | ✔️ || 💯 |
53-
| TSup | `--add-tsup`, `--exclude-tsup` | ✔️ || 💯 |
53+
| TSDown | `--add-tsdown`, `--exclude-tsdown` | ✔️ || 💯 |
5454
| TypeScript | `--add-typescript`, `--exclude-typescript` | ✔️ || 💯 |
5555
| Vitest | `--add-vitest`, `--exclude-vitest` | || 💯 |
5656
| VS Code | `--add-vs-code`, `--exclude-vs-code` | | | 💯 |
5757
| Web-ext | `--add-web-ext`, `--exclude-web-ext` | | | |
5858

59-
For example, this uses ncc instead of the default tsup builder:
59+
For example, this uses ncc instead of the default tsdown builder:
6060

6161
```shell
62-
npx create-typescript-app --add-ncc --exclude-tsup
62+
npx create-typescript-app --add-ncc --exclude-tsdown
6363
```
6464

6565
See also [CLI](./CLI.md) for customizing templated repositories when running `npx create-typescript-app`.
@@ -82,7 +82,7 @@ We strongly recommend using at least the [_"common"_ base level](#common-base-le
8282

8383
### Building
8484

85-
[**tsup**](https://tsup.egoist.dev): Builds output definitions and JavaScript files using [esbuild](https://esbuild.github.io).
85+
[**tsdown**](https://tsdown.dev): Builds output definitions and JavaScript files.
8686
Each `*.ts` source file within `src/` is built into `.d.ts` and `.js` output files in `lib/`.
8787

8888
Building once:

docs/FAQs.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,17 @@ Here we'll outline the steps required to migrate a CTA app to a GitHub Action:
6666
</details>
6767
6868
- GitHub Actions run without installing package dependencies.
69-
Replace `tsup` with [`ncc`](https://github.com/vercel/ncc) to build source files and dependencies into a single JS file.
70-
Delete `tsup.config.ts` then execute the following commands:
69+
Replace `tsdown` with [`ncc`](https://github.com/vercel/ncc) to build source files and dependencies into a single JS file.
70+
Delete `tsdown.config.ts` then execute the following commands:
7171

7272
```bash
73-
pnpm remove tsup
73+
pnpm remove tsdown
7474
pnpm add @vercel/ncc -D
7575
```
7676
- Now we need to update the `build` script in our `package.json`:
7777

7878
```diff
79-
-"build": "tsup",
79+
-"build": "tsdown",
8080
+"build": "ncc build src/index.ts -o dist --license licenses.txt",
8181
```
8282
- Our build now emits to the `dist` directory; so we'll want to avoid linting that directory by adding the following to `.eslintignore` and our `.prettierignore`:
@@ -102,7 +102,7 @@ First, I'd suggest reading [TypeScript Handbook > Modules - Introduction](https:
102102

103103
Then:
104104

105-
1. In `tsup.config.ts`, change the [tsup `format` option](https://tsup.egoist.dev/#bundle-formats) from `["esm"]` to `["cjs", "esm"]`
105+
1. In `tsdown.config.ts`, change the [tsdown `format` option](https://tsdown.dev/options/output-format) from `["esm"]` to `["cjs", "esm"]`
106106
2. Add a [`package.json` `"exports"` entry](https://nodejs.org/api/packages.html#subpath-exports) like:
107107

108108
<!-- eslint-disable jsonc/sort-keys -->

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"package.json"
2323
],
2424
"scripts": {
25-
"build": "tsup",
25+
"build": "tsdown",
2626
"format": "prettier .",
2727
"lint": "eslint . --max-warnings 0",
2828
"lint:knip": "knip",
@@ -113,7 +113,7 @@
113113
"prettier-plugin-sh": "0.17.4",
114114
"release-it": "19.0.3",
115115
"sentences-per-line": "0.3.0",
116-
"tsup": "8.5.0",
116+
"tsdown": "0.12.7",
117117
"typescript": "5.8.3",
118118
"typescript-eslint": "8.35.0",
119119
"vitest": "3.2.4"

0 commit comments

Comments
 (0)