Skip to content

Commit c51ab46

Browse files
authored
Merge pull request #6 from bogeychan/main
🔧fix: exports in package.json
2 parents 5fb9504 + 8ee9fbd commit c51ab46

File tree

6 files changed

+42
-5
lines changed

6 files changed

+42
-5
lines changed

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@
1414
"devDependencies": {
1515
"@types/node": "^20.1.4",
1616
"bun-types": "^0.5.8",
17-
"elysia": "0.5.0",
17+
"elysia": "0.5.12",
1818
"eslint": "^8.40.0",
1919
"mitata": "^0.1.6",
2020
"rimraf": "4.3",
2121
"typescript": "^5.0.4"
2222
},
2323
"peerDependencies": {
24-
"elysia": ">= 0.5.0"
24+
"elysia": ">= 0.5.12"
2525
},
2626
"exports": {
27+
"node": "./dist/cjs/index.js",
2728
"require": "./dist/cjs/index.js",
2829
"import": "./dist/index.js",
29-
"node": "./dist/index.js",
3030
"default": "./dist/index.js"
3131
},
3232
"bugs": "https://github.com/elysiajs/elysia-static/issues",
@@ -40,9 +40,10 @@
4040
"license": "MIT",
4141
"scripts": {
4242
"dev": "bun run --hot example/index.ts",
43-
"test": "bun wiptest",
43+
"test": "bun wiptest && npm run test:node",
44+
"test:node": "npm install --prefix ./test/node/cjs/ && npm install --prefix ./test/node/esm/ && node ./test/node/cjs/index.js && node ./test/node/esm/index.js",
4445
"build": "rimraf dist && tsc --project tsconfig.esm.json && tsc --project tsconfig.cjs.json",
4546
"release": "npm run build && npm run test && npm publish --access public"
4647
},
4748
"types": "./src/index.ts"
48-
}
49+
}

test/node/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
package-lock.json

test/node/cjs/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
if ('Bun' in globalThis) {
2+
throw new Error('❌ Use Node.js to run this test!');
3+
}
4+
5+
const { staticPlugin } = require('@elysiajs/static');
6+
7+
if (typeof staticPlugin !== 'function') {
8+
throw new Error('❌ CommonJS Node.js failed');
9+
}
10+
11+
console.log('✅ CommonJS Node.js works!');

test/node/cjs/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"type": "commonjs",
3+
"dependencies": {
4+
"@elysiajs/static": "../../.."
5+
}
6+
}

test/node/esm/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
if ('Bun' in globalThis) {
2+
throw new Error('❌ Use Node.js to run this test!');
3+
}
4+
5+
import { staticPlugin } from '@elysiajs/static';
6+
7+
if (typeof staticPlugin !== 'function') {
8+
throw new Error('❌ ESM Node.js failed');
9+
}
10+
11+
console.log('✅ ESM Node.js works!');

test/node/esm/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"type": "module",
3+
"dependencies": {
4+
"@elysiajs/static": "../../.."
5+
}
6+
}

0 commit comments

Comments
 (0)