-
-
Notifications
You must be signed in to change notification settings - Fork 85
Description
Bug Report Checklist
- I have pulled the latest
mainbranch of the repository. - I have searched for related issues and found none that matched my issue.
Overview
Splitting out of #1910: right now, the TSup config includes all src/**/*.ts files except test files:
create-typescript-app/tsup.config.ts
Line 7 in 21b4be0
| entry: ["src/**/*.ts", "!src/**/*.test.*"], |
That presents an edge case for test utility files with names like data.fakes.ts. They're not excluded by the !src/**/*.test.*, and so are included by the src/**/*.ts - even though they shouldn't be in the output package. As a result I've been less willing to write files like that.
The tsup config could in theory be expanded to exclude files with known names like *.fakes.*...
entry: ["src/**/*.ts", "!src/**/*.fakes.*", "!src/**/*.test.*"],...but then that establishes a convention that not every package already uses. -1 from me.
I think what we really need here is an entry that respects package.json exports/main. I think that could be achieved with some kind of helper library used like:
import { defineConfig } from "tsup";
import { readEntryPoints } from "read-entry-points";
export default defineConfig({
// ...
entry: readEntryPoints(),
// ...
});Additional Info
I see this as kind of an intermediate step in lieu of / towards #1910. This wouldn't solve the issues around tsup falling out of maintenance. But it would solve the specific issue of out-of-entrypoints modules still being included.
Putting in status: in discussion for a bit to let the idea settle. I'm also asking around about #1910 on social media: https://bsky.app/profile/joshuakgoldberg.com/post/3lhgppvnyjc2e, https://fosstodon.org/@JoshuaKGoldberg/113951603816733558.
π