Skip to content

Commit ebf0e54

Browse files
committed
🧹 chore: support optional path parameter
1 parent ff6e88e commit ebf0e54

File tree

13 files changed

+813
-796
lines changed

13 files changed

+813
-796
lines changed

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ CHANGELOG.md
1919
.eslintrc.js
2020
tsconfig.cjs.json
2121
tsconfig.esm.json
22+
tsconfig.dts.json
2223

24+
src
25+
build.ts

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"useTabs": true,
3+
"tabWidth": 4,
4+
"semi": false,
5+
"singleQuote": true,
6+
"trailingComma": "none"
7+
}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11

2+
# 1.1.0-rc.0 - 12 Jul 2024
3+
Change:
4+
- Add support for Elysia 1.1
5+
6+
27
# 1.0.2 - 18 Mar 2024
38
Change:
49
- Add support for Elysia 1.0

build.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { $ } from 'bun'
2+
import { build, type Options } from 'tsup'
3+
4+
await $`rm -rf dist`
5+
6+
const tsupConfig: Options = {
7+
entry: ['src/**/*.ts'],
8+
splitting: false,
9+
sourcemap: false,
10+
clean: true,
11+
bundle: true
12+
} satisfies Options
13+
14+
await Promise.all([
15+
// ? tsup esm
16+
build({
17+
outDir: 'dist',
18+
format: 'esm',
19+
target: 'node20',
20+
cjsInterop: false,
21+
...tsupConfig
22+
}),
23+
// ? tsup cjs
24+
build({
25+
outDir: 'dist/cjs',
26+
format: 'cjs',
27+
target: 'node20',
28+
// dts: true,
29+
...tsupConfig
30+
})
31+
])
32+
33+
await $`tsc --project tsconfig.dts.json`
34+
35+
await Promise.all([$`cp dist/*.d.ts dist/cjs`])
36+
37+
process.exit()

bun.lockb

222 KB
Binary file not shown.

example/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ const app = new Elysia()
3939
}
4040
})
4141
)
42-
.use(plugin)
42+
// .use(plugin)
43+
.get('/id/:id?', 'a')
4344
.listen(3000)
44-
45-
console.log(app.routes)

package.json

Lines changed: 79 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,81 @@
11
{
2-
"name": "@elysiajs/swagger",
3-
"version": "1.0.4",
4-
"description": "Plugin for Elysia to auto-generate Swagger page",
5-
"author": {
6-
"name": "saltyAom",
7-
"url": "https://github.com/SaltyAom",
8-
"email": "[email protected]"
9-
},
10-
"main": "./dist/index.js",
11-
"exports": {
12-
"bun": "./dist/index.js",
13-
"node": "./dist/cjs/index.js",
14-
"require": "./dist/cjs/index.js",
15-
"import": "./dist/index.js",
16-
"default": "./dist/index.js"
17-
},
18-
"types": "./dist/index.d.ts",
19-
"keywords": [
20-
"elysia",
21-
"swagger"
22-
],
23-
"homepage": "https://github.com/elysiajs/elysia-swagger",
24-
"repository": {
25-
"type": "git",
26-
"url": "https://github.com/elysiajs/elysia-swagger"
27-
},
28-
"bugs": "https://github.com/elysiajs/elysia-swagger/issues",
29-
"license": "MIT",
30-
"scripts": {
31-
"dev": "bun run --watch example/index.ts",
32-
"test": "bun test && npm run test:node",
33-
"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",
34-
"build": "rimraf dist && tsc --project tsconfig.esm.json && tsc --project tsconfig.cjs.json",
35-
"release": "npm run build && npm run test && npm publish --access public"
36-
},
37-
"peerDependencies": {
38-
"elysia": ">= 1.0.2"
39-
},
40-
"devDependencies": {
41-
"@apidevtools/swagger-parser": "^10.1.0",
42-
"@scalar/api-reference": "^1.12.5",
43-
"@types/bun": "^1.0.4",
44-
"@types/lodash.clonedeep": "^4.5.7",
45-
"@types/node": "^20.1.4",
46-
"elysia": "1.0.2",
47-
"eslint": "^8.40.0",
48-
"rimraf": "4.3",
49-
"typescript": "^5.0.4"
50-
},
51-
"dependencies": {
52-
"lodash.clonedeep": "^4.5.0",
53-
"openapi-types": "^12.1.3"
54-
}
2+
"name": "@elysiajs/swagger",
3+
"version": "1.1.0-rc.1",
4+
"description": "Plugin for Elysia to auto-generate Swagger page",
5+
"author": {
6+
"name": "saltyAom",
7+
"url": "https://github.com/SaltyAom",
8+
"email": "[email protected]"
9+
},
10+
"main": "./dist/cjs/index.js",
11+
"module": "./dist/index.mjs",
12+
"types": "./dist/index.d.ts",
13+
"exports": {
14+
"./package.json": "./package.json",
15+
".": {
16+
"types": "./dist/index.d.ts",
17+
"import": "./dist/index.mjs",
18+
"require": "./dist/cjs/index.js"
19+
},
20+
"./types": {
21+
"types": "./dist/types.d.ts",
22+
"import": "./dist/types.mjs",
23+
"require": "./dist/cjs/types.js"
24+
},
25+
"./utils": {
26+
"types": "./dist/utils.d.ts",
27+
"import": "./dist/utils.mjs",
28+
"require": "./dist/cjs/utils.js"
29+
},
30+
"./scalar": {
31+
"types": "./dist/scalar/index.d.ts",
32+
"import": "./dist/scalar/index.mjs",
33+
"require": "./dist/cjs/scalar/index.js"
34+
},
35+
"./scalar/theme": {
36+
"types": "./dist/scalar/theme.d.ts",
37+
"import": "./dist/scalar/theme.mjs",
38+
"require": "./dist/cjs/scalar/theme.js"
39+
},
40+
"./scalar/types": {
41+
"types": "./dist/scalar/types/index.d.ts",
42+
"import": "./dist/scalar/types/index.mjs",
43+
"require": "./dist/cjs/scalar/types/index.js"
44+
}
45+
},
46+
"keywords": [
47+
"elysia",
48+
"swagger"
49+
],
50+
"homepage": "https://github.com/elysiajs/elysia-swagger",
51+
"repository": {
52+
"type": "git",
53+
"url": "https://github.com/elysiajs/elysia-swagger"
54+
},
55+
"bugs": "https://github.com/elysiajs/elysia-swagger/issues",
56+
"license": "MIT",
57+
"scripts": {
58+
"dev": "bun run --watch example/index.ts",
59+
"test": "bun test && npm run test:node",
60+
"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",
61+
"build": "bun build.ts",
62+
"release": "npm run build && npm run test && npm publish --access public"
63+
},
64+
"peerDependencies": {
65+
"elysia": ">= 1.1.0-rc.2"
66+
},
67+
"devDependencies": {
68+
"@apidevtools/swagger-parser": "^10.1.0",
69+
"@scalar/api-reference": "^1.12.5",
70+
"@types/bun": "1.1.6",
71+
"@types/lodash.clonedeep": "^4.5.9",
72+
"elysia": ">= 1.1.0-rc.2",
73+
"eslint": "9.6.0",
74+
"tsup": "^8.1.0",
75+
"typescript": "^5.5.3"
76+
},
77+
"dependencies": {
78+
"lodash.clonedeep": "^4.5.0",
79+
"openapi-types": "^12.1.3"
80+
}
5581
}

0 commit comments

Comments
 (0)