Skip to content

Commit da5f619

Browse files
authored
feat: migrate to ESM-only build (#47)
Switches the build setup to only output ESM now that `require(esm)` is a thing.
1 parent 2adbaf7 commit da5f619

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

.github/workflows/ci.yml

+9
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,12 @@ jobs:
3939
node-version: ${{ matrix.node-version }}
4040
- run: npm ci
4141
- run: npm run test
42+
if: matrix.node-version != 'latest'
43+
# TODO (43081j): remove the following once there's some way to
44+
# tell node not to try run typescript sources in a way that doesn't
45+
# break <23 node
46+
- run: npm run test
47+
name: "npm run test (without type stripping)"
48+
env:
49+
NODE_OPTIONS: --no-experimental-strip-types
50+
if: matrix.node-version == 'latest'

package.json

+1-8
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
"description": "A minimal library for executing processes in Node",
66
"main": "./dist/main.js",
77
"files": [
8-
"dist",
9-
"!dist/node_modules",
10-
"!dist/cjs/test",
11-
"!dist/esm/test"
8+
"dist"
129
],
1310
"scripts": {
1411
"build": "npm run build:types && tsup",
@@ -54,10 +51,6 @@
5451
"import": {
5552
"types": "./dist/main.d.ts",
5653
"default": "./dist/main.js"
57-
},
58-
"require": {
59-
"types": "./dist/main.d.cts",
60-
"default": "./dist/main.cjs"
6154
}
6255
},
6356
"./package.json": "./package.json"

tsup.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { defineConfig } from "tsup";
33
export default defineConfig({
44
entryPoints: ["src/main.ts"],
55
outDir: "dist",
6-
format: ["esm", "cjs"],
6+
format: ["esm"],
77
tsconfig: "./tsconfig.json",
88
target: "es2022",
99
minify: false,

0 commit comments

Comments
 (0)