Skip to content

Commit 899d48c

Browse files
authored
fix: make JSR publish pass (#10)
* fix(jsr): add adjacent index.d.ts for mod.ts exports Made-with: Cursor * chore(jsr): publish with allow-slow-types and token Made-with: Cursor * chore(jsr): rely on trusted publishing (no token) Made-with: Cursor * fix(jsr): remove ambient module declarations for publish Made-with: Cursor * chore(jsr): remove allow-slow-types Made-with: Cursor * chore(jsr): avoid package-lock during CI install Made-with: Cursor * test: add TypeScript typecheck Made-with: Cursor * test: add TypeScript proxy header harness Made-with: Cursor
1 parent 27fa3d0 commit 899d48c

12 files changed

Lines changed: 735 additions & 222 deletions

File tree

.github/workflows/publish.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@ jobs:
3838
fi
3939
4040
- name: Install dependencies
41-
run: npm install --ignore-scripts
41+
run: npm install --ignore-scripts --no-package-lock
4242

4343
- name: Publish to npm
4444
run: npm publish --access public --provenance
4545

4646
- name: Publish to JSR
47-
run: npx jsr publish
47+
run: |
48+
# Trusted publishing should authenticate via OIDC; token is intentionally not required here.
49+
npx jsr publish --provenance
4850

index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from "./types/index";
2+

package.json

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@
1111
"import": "./index.js"
1212
},
1313
"./axios": {
14-
"types": "./types/index.d.ts",
14+
"types": "./types/axios.d.ts",
1515
"import": "./lib/axios-proxy.js"
1616
},
1717
"./node-fetch": {
18-
"types": "./types/index.d.ts",
18+
"types": "./types/node-fetch.d.ts",
1919
"import": "./lib/node-fetch-proxy.js"
2020
},
2121
"./got": {
22-
"types": "./types/index.d.ts",
22+
"types": "./types/got.d.ts",
2323
"import": "./lib/got-proxy.js"
2424
},
2525
"./undici": {
26-
"types": "./types/index.d.ts",
26+
"types": "./types/undici.d.ts",
2727
"import": "./lib/undici-proxy.js"
2828
},
2929
"./superagent": {
30-
"types": "./types/index.d.ts",
30+
"types": "./types/superagent.d.ts",
3131
"import": "./lib/superagent-proxy.js"
3232
}
3333
},
@@ -41,6 +41,9 @@
4141
"scripts": {
4242
"test": "node test/test_proxy_headers.js core axios node-fetch got undici superagent",
4343
"test:verbose": "node test/test_proxy_headers.js -v",
44+
"test:ts": "tsx test/test_proxy_headers.ts core axios node-fetch got undici superagent",
45+
"test:ts:verbose": "tsx test/test_proxy_headers.ts -v",
46+
"test:types": "tsc -p tsconfig.json --noEmit",
4447
"lint": "eslint lib test",
4548
"prepublishOnly": "node -e \"const p=process.env.PROXY_URL||process.env.HTTPS_PROXY||process.env.https_proxy; if(!p){console.log('prepublishOnly: skipping proxy tests (set PROXY_URL/HTTPS_PROXY to enable)'); process.exit(0);} require('child_process').execSync('npm test',{stdio:'inherit'});\""
4649
},
@@ -88,18 +91,30 @@
8891
"undici": "^5.0.0 || ^6.0.0 || ^7.0.0"
8992
},
9093
"peerDependenciesMeta": {
91-
"axios": { "optional": true },
92-
"got": { "optional": true },
93-
"node-fetch": { "optional": true },
94-
"superagent": { "optional": true },
95-
"undici": { "optional": true }
94+
"axios": {
95+
"optional": true
96+
},
97+
"got": {
98+
"optional": true
99+
},
100+
"node-fetch": {
101+
"optional": true
102+
},
103+
"superagent": {
104+
"optional": true
105+
},
106+
"undici": {
107+
"optional": true
108+
}
96109
},
97110
"devDependencies": {
98111
"axios": "^1.7.0",
99112
"eslint": "^10.0.3",
100113
"got": "^14.4.0",
101114
"node-fetch": "^3.3.0",
102115
"superagent": "^10.1.0",
116+
"tsx": "^4.21.0",
117+
"typescript": "^5.9.3",
103118
"undici": "^7.2.0"
104119
}
105120
}

0 commit comments

Comments
 (0)