Repository navigation
Commit a39e8ca
committed
feat: build dist/ and bin/ with tsup instead of shipping source
Build the package the way @cldmv/vitest-runner does, replacing the
placeholder build script:
- tsup.config.mjs bundles src/ into dist/index.mjs (ESM), dist/index.cjs
(CJS) and bin/fix-headers.mjs (CLI); dist/ and bin/ are build artifacts
(gitignored) and prepack rebuilds them before npm pack/publish
- package.json: main/exports/bin point at the build output, with a
fix-headers-dev export condition that resolves to src/; files ships
dist/, types/ and bin/ (no sourcemaps) instead of src/
- scripts: build (clear dist/ + bin/, then tsup) and build:ci (lint,
format:check, types:build, build); ci.yml's coverage jobs now run
build:ci before measuring src/**
- the CJS build comes from src/index.cjs.mjs with cjsInterop, so
require('@cldmv/fix-headers') still returns the function itself, as
the removed root index.cjs shim did; the root index.mjs shim is gone too
- detectors are imported statically instead of discovered by reading
src/detectors/ at runtime, which a bundle can't do (and which needed a
top-level await that CJS output can't express)
The integration test that exercised the root shims now builds with the
repo's tsup config into its fixture workspace and checks the ESM import,
the CJS require() shape and the built CLI against a fixture project.
136/136 tests pass, coverage 100%.
Fixes #181 parent 2529d83 commit a39e8ca
12 files changed
Lines changed: 1742 additions & 262 deletions
File tree
- .configs
- .github/workflows
- src
- detectors
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
21 | 21 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
230 | 233 | | |
231 | 234 | | |
232 | 235 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
This file was deleted.
This file was deleted.
0 commit comments