Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

🔧fix: exports in package.json #1

Merged
merged 1 commit into from
Jun 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
},
"main": "./dist/index.js",
"exports": {
"node": "./dist/cjs/index.js",
"require": "./dist/cjs/index.js",
"import": "./dist/index.js",
"node": "./dist/index.js",
"default": "./dist/index.js"
},
"types": "./dist/index.d.ts",
Expand All @@ -30,7 +30,8 @@
"license": "MIT",
"scripts": {
"dev": "bun run --hot example/index.ts",
"test": "bun wiptest",
"test": "bun wiptest && npm run test:node",
"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",
"build": "rimraf dist && tsc --project tsconfig.esm.json && tsc --project tsconfig.cjs.json",
"release": "npm run build && npm run test && npm publish --access public"
},
Expand All @@ -42,12 +43,12 @@
"@sinclair/typebox": "^0.28.10",
"@types/node": "^20.1.4",
"bun-types": "^0.5.8",
"elysia": "0.5.0",
"elysia": "0.5.12",
"eslint": "^8.40.0",
"rimraf": "4.3",
"typescript": "^5.0.4"
},
"peerDependencies": {
"elysia": ">= 0.5.0"
"elysia": ">= 0.5.12"
}
}
}
2 changes: 2 additions & 0 deletions test/node/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
package-lock.json
11 changes: 11 additions & 0 deletions test/node/cjs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
if ('Bun' in globalThis) {
throw new Error('❌ Use Node.js to run this test!');
}

const { jwt } = require('@elysiajs/jwt');

if (typeof jwt !== 'function') {
throw new Error('❌ CommonJS Node.js failed');
}

console.log('✅ CommonJS Node.js works!');
6 changes: 6 additions & 0 deletions test/node/cjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "commonjs",
"dependencies": {
"@elysiajs/jwt": "../../.."
}
}
11 changes: 11 additions & 0 deletions test/node/esm/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
if ('Bun' in globalThis) {
throw new Error('❌ Use Node.js to run this test!');
}

import { jwt } from '@elysiajs/jwt';

if (typeof jwt !== 'function') {
throw new Error('❌ ESM Node.js failed');
}

console.log('✅ ESM Node.js works!');
6 changes: 6 additions & 0 deletions test/node/esm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "module",
"dependencies": {
"@elysiajs/jwt": "../../.."
}
}