Skip to content

Commit

Permalink
🧹 chore: support optional path parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
SaltyAom committed Jul 15, 2024
1 parent ff6e88e commit ebf0e54
Show file tree
Hide file tree
Showing 13 changed files with 813 additions and 796 deletions.
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ CHANGELOG.md
.eslintrc.js
tsconfig.cjs.json
tsconfig.esm.json
tsconfig.dts.json

src
build.ts
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"useTabs": true,
"tabWidth": 4,
"semi": false,
"singleQuote": true,
"trailingComma": "none"
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

# 1.1.0-rc.0 - 12 Jul 2024
Change:
- Add support for Elysia 1.1


# 1.0.2 - 18 Mar 2024
Change:
- Add support for Elysia 1.0
Expand Down
37 changes: 37 additions & 0 deletions build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { $ } from 'bun'
import { build, type Options } from 'tsup'

await $`rm -rf dist`

const tsupConfig: Options = {
entry: ['src/**/*.ts'],
splitting: false,
sourcemap: false,
clean: true,
bundle: true
} 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 Promise.all([$`cp dist/*.d.ts dist/cjs`])

process.exit()
Binary file modified bun.lockb
Binary file not shown.
5 changes: 2 additions & 3 deletions example/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const app = new Elysia()
}
})
)
.use(plugin)
// .use(plugin)
.get('/id/:id?', 'a')
.listen(3000)

console.log(app.routes)
132 changes: 79 additions & 53 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,55 +1,81 @@
{
"name": "@elysiajs/swagger",
"version": "1.0.4",
"description": "Plugin for Elysia to auto-generate Swagger page",
"author": {
"name": "saltyAom",
"url": "https://github.com/SaltyAom",
"email": "[email protected]"
},
"main": "./dist/index.js",
"exports": {
"bun": "./dist/index.js",
"node": "./dist/cjs/index.js",
"require": "./dist/cjs/index.js",
"import": "./dist/index.js",
"default": "./dist/index.js"
},
"types": "./dist/index.d.ts",
"keywords": [
"elysia",
"swagger"
],
"homepage": "https://github.com/elysiajs/elysia-swagger",
"repository": {
"type": "git",
"url": "https://github.com/elysiajs/elysia-swagger"
},
"bugs": "https://github.com/elysiajs/elysia-swagger/issues",
"license": "MIT",
"scripts": {
"dev": "bun run --watch example/index.ts",
"test": "bun test && 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"
},
"peerDependencies": {
"elysia": ">= 1.0.2"
},
"devDependencies": {
"@apidevtools/swagger-parser": "^10.1.0",
"@scalar/api-reference": "^1.12.5",
"@types/bun": "^1.0.4",
"@types/lodash.clonedeep": "^4.5.7",
"@types/node": "^20.1.4",
"elysia": "1.0.2",
"eslint": "^8.40.0",
"rimraf": "4.3",
"typescript": "^5.0.4"
},
"dependencies": {
"lodash.clonedeep": "^4.5.0",
"openapi-types": "^12.1.3"
}
"name": "@elysiajs/swagger",
"version": "1.1.0-rc.1",
"description": "Plugin for Elysia to auto-generate Swagger page",
"author": {
"name": "saltyAom",
"url": "https://github.com/SaltyAom",
"email": "[email protected]"
},
"main": "./dist/cjs/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/cjs/index.js"
},
"./types": {
"types": "./dist/types.d.ts",
"import": "./dist/types.mjs",
"require": "./dist/cjs/types.js"
},
"./utils": {
"types": "./dist/utils.d.ts",
"import": "./dist/utils.mjs",
"require": "./dist/cjs/utils.js"
},
"./scalar": {
"types": "./dist/scalar/index.d.ts",
"import": "./dist/scalar/index.mjs",
"require": "./dist/cjs/scalar/index.js"
},
"./scalar/theme": {
"types": "./dist/scalar/theme.d.ts",
"import": "./dist/scalar/theme.mjs",
"require": "./dist/cjs/scalar/theme.js"
},
"./scalar/types": {
"types": "./dist/scalar/types/index.d.ts",
"import": "./dist/scalar/types/index.mjs",
"require": "./dist/cjs/scalar/types/index.js"
}
},
"keywords": [
"elysia",
"swagger"
],
"homepage": "https://github.com/elysiajs/elysia-swagger",
"repository": {
"type": "git",
"url": "https://github.com/elysiajs/elysia-swagger"
},
"bugs": "https://github.com/elysiajs/elysia-swagger/issues",
"license": "MIT",
"scripts": {
"dev": "bun run --watch example/index.ts",
"test": "bun test && 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": "bun build.ts",
"release": "npm run build && npm run test && npm publish --access public"
},
"peerDependencies": {
"elysia": ">= 1.1.0-rc.2"
},
"devDependencies": {
"@apidevtools/swagger-parser": "^10.1.0",
"@scalar/api-reference": "^1.12.5",
"@types/bun": "1.1.6",
"@types/lodash.clonedeep": "^4.5.9",
"elysia": ">= 1.1.0-rc.2",
"eslint": "9.6.0",
"tsup": "^8.1.0",
"typescript": "^5.5.3"
},
"dependencies": {
"lodash.clonedeep": "^4.5.0",
"openapi-types": "^12.1.3"
}
}
Loading

0 comments on commit ebf0e54

Please sign in to comment.