Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.
Open
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
24 changes: 0 additions & 24 deletions .cjs.swcrc

This file was deleted.

24 changes: 0 additions & 24 deletions .es.swcrc

This file was deleted.

54 changes: 54 additions & 0 deletions build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { $ } from 'bun'
import { build, type Options } from 'tsup'

const tsupConfig: Options = {
entry: ['src/**/*.ts'],
splitting: false,
sourcemap: false,
clean: true,
bundle: true,
// outExtension() {
// return {
// js: '.js'
// }
// }
} satisfies Options

await Promise.all([
// ? tsup esm
build({
outDir: 'dist',
format: 'esm',
target: 'node20',
cjsInterop: false,
...tsupConfig
}),
// ? tsup cjs
build({
outDir: 'dist/cjs',
format: 'cjs',
target: 'node20',
// dts: true,
...tsupConfig
})
])

await $`tsc --project tsconfig.dts.json`

await Bun.build({
entrypoints: ['./src/index.ts'],
outdir: './dist/bun',
minify: true,
target: 'bun',
sourcemap: 'external',
external: ['elysia']
})

await Promise.all([
$`cp dist/*.d.ts dist/cjs`,
$`cp dist/ws/*.d.ts dist/cjs/ws/`,
])

await $`cp dist/index*.d.ts dist/bun`

process.exit()
Binary file modified bun.lockb
Binary file not shown.
17 changes: 7 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,23 @@
"type": "git",
"url": "https://github.com/elysiajs/node-adapter"
},
"main": "./dist/index.js",
"main": "./dist/cjs/index.js",
"devDependencies": {
"@types/node": "^20.4.1",
"bun-types": "^0.6.13",
"elysia": "^0.6.0-alpha.1",
"eslint": "^8.44.0",
"rimraf": "4.4.1",
"ts-node": "^10.9.1",
"tsup": "^8.3.0",
"typescript": "^5.1.6"
},
"peerDependencies": {
"elysia": ">= 0.6.0-alpha.1"
},
"exports": {
"require": "./dist/cjs/index.js",
"import": "./dist/index.js",
"node": "./dist/index.js",
"default": "./dist/index.js"
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/cjs/index.js"
},
"bugs": "https://github.com/elysiajs/node-adapter/issues",
"description": "Node adapter plugin for Elysia",
Expand All @@ -42,12 +41,10 @@
"scripts": {
"dev": "ts-node example/index.ts",
"test": "bun wiptest",
"build": "rimraf dist && npm run build:cjs && npm run build:esm",
"build:cjs": "tsc --project tsconfig.cjs.json",
"build:esm": "tsc --project tsconfig.esm.json",
"build": "rm -rf dist && bun build.ts",
"release": "npm run build && npm run test && npm publish --access public"
},
"types": "./src/index.ts",
"types": "./dist/index.d.ts",
"dependencies": {
"@sinclair/typebox": "^0.29.4",
"fast-querystring": "^1.1.2",
Expand Down
104 changes: 0 additions & 104 deletions tsconfig.cjs.json

This file was deleted.

Loading