chore: migrate to `yarn v4` (#299)
* changeset * chore: migrate to `yarn v4` * remove changeset * fixed Github Actions for `hello` * fix gitignore * add dependencies * add ci for oauth-providers * add dependencies * add `publint` * update mswpull/300/head
parent
954069dabe
commit
bd18b966ee
|
@ -0,0 +1,25 @@
|
||||||
|
name: ci-oauth-providers
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- 'packages/oauth-providers/**'
|
||||||
|
pull_request:
|
||||||
|
branches: ['*']
|
||||||
|
paths:
|
||||||
|
- 'packages/oauth-providers/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ci:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ./packages/oauth-providers
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 18.x
|
||||||
|
- run: yarn install --frozen-lockfile
|
||||||
|
- run: yarn build
|
||||||
|
- run: yarn test
|
|
@ -1,9 +1,16 @@
|
||||||
dist
|
dist
|
||||||
|
|
||||||
node_modules
|
node_modules
|
||||||
.yarn/*
|
|
||||||
yarn-error.log
|
|
||||||
*.tgz
|
*.tgz
|
||||||
|
|
||||||
|
.yarn/*
|
||||||
|
!.yarn/cache
|
||||||
|
!.yarn/patches
|
||||||
|
!.yarn/plugins
|
||||||
|
!.yarn/releases
|
||||||
|
!.yarn/sdks
|
||||||
|
!.yarn/versions
|
||||||
|
yarn-error.log
|
||||||
|
|
||||||
# for debug or playing
|
# for debug or playing
|
||||||
sandbox
|
sandbox
|
|
@ -1,7 +1,12 @@
|
||||||
{
|
{
|
||||||
"deno.enable": false,
|
"deno.enable": false,
|
||||||
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
|
"eslint.validate": [
|
||||||
|
"javascript",
|
||||||
|
"javascriptreact",
|
||||||
|
"typescript",
|
||||||
|
"typescriptreact"
|
||||||
|
],
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.eslint": true
|
"source.fixAll.eslint": "explicit"
|
||||||
}
|
}
|
||||||
}
|
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,5 @@
|
||||||
|
nodeLinker: node-modules
|
||||||
|
|
||||||
|
yarnPath: .yarn/releases/yarn-4.0.2.cjs
|
||||||
|
|
||||||
|
nmHoistingLimits: 'workspaces'
|
|
@ -24,7 +24,7 @@
|
||||||
"build:swagger-ui": "yarn workspace @hono/swagger-ui build",
|
"build:swagger-ui": "yarn workspace @hono/swagger-ui build",
|
||||||
"build:esbuild-transpiler": "yarn workspace @hono/esbuild-transpiler build",
|
"build:esbuild-transpiler": "yarn workspace @hono/esbuild-transpiler build",
|
||||||
"build:oauth-providers": "yarn workspace @hono/oauth-providers build",
|
"build:oauth-providers": "yarn workspace @hono/oauth-providers build",
|
||||||
"build": "run-p build:*"
|
"build": "run-p 'build:*'"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
@ -57,5 +57,6 @@
|
||||||
"tsup": "^7.2.0",
|
"tsup": "^7.2.0",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.2.2",
|
||||||
"vitest": "^0.34.2"
|
"vitest": "^0.34.2"
|
||||||
}
|
},
|
||||||
|
"packageManager": "yarn@4.0.2"
|
||||||
}
|
}
|
|
@ -14,7 +14,6 @@
|
||||||
"release": "yarn publish"
|
"release": "yarn publish"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": false,
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://registry.npmjs.org",
|
"registry": "https://registry.npmjs.org",
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
@ -30,7 +29,11 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@clerk/backend": "^0.30.1",
|
"@clerk/backend": "^0.30.1",
|
||||||
|
"@types/react": "^18",
|
||||||
"hono": "^3.7.3",
|
"hono": "^3.7.3",
|
||||||
"node-fetch-native": "^1.4.0"
|
"jest": "^29.7.0",
|
||||||
|
"node-fetch-native": "^1.4.0",
|
||||||
|
"react": "^18.2.0",
|
||||||
|
"rimraf": "^5.0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": false,
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://registry.npmjs.org",
|
"registry": "https://registry.npmjs.org",
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
@ -55,9 +54,10 @@
|
||||||
"hono": ">=3.9.2"
|
"hono": ">=3.9.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"esbuild": "^0.19.5",
|
"esbuild": "^0.19.9",
|
||||||
"esbuild-wasm": "^0.19.5",
|
"esbuild-wasm": "^0.19.5",
|
||||||
"hono": "^3.9.2",
|
"hono": "^3.9.2",
|
||||||
|
"tsup": "^8.0.1",
|
||||||
"vitest": "^0.34.6"
|
"vitest": "^0.34.6"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/honojs/middleware",
|
"homepage": "https://github.com/honojs/middleware",
|
||||||
"author": "codehex",
|
"author": "codehex",
|
||||||
"private": false,
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://registry.npmjs.org",
|
"registry": "https://registry.npmjs.org",
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": false,
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public",
|
"access": "public",
|
||||||
"registry": "https://registry.npmjs.org/"
|
"registry": "https://registry.npmjs.org/"
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": false,
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://registry.npmjs.org",
|
"registry": "https://registry.npmjs.org",
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
@ -36,6 +35,8 @@
|
||||||
"hono": "*"
|
"hono": "*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"hono": "^3.9.2"
|
"hono": "^3.9.2",
|
||||||
|
"tsup": "^8.0.1",
|
||||||
|
"vitest": "^1.0.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,7 +14,6 @@
|
||||||
"release": "yarn publish"
|
"release": "yarn publish"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": false,
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://registry.npmjs.org",
|
"registry": "https://registry.npmjs.org",
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
@ -28,7 +27,9 @@
|
||||||
"hono": ">=3.8.0"
|
"hono": ">=3.8.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"hono": "^3.9.2"
|
"hono": "^3.9.2",
|
||||||
|
"jest": "^29.7.0",
|
||||||
|
"rimraf": "^5.0.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@medley/router": "^0.2.1"
|
"@medley/router": "^0.2.1"
|
||||||
|
|
|
@ -3,5 +3,5 @@ module.exports = {
|
||||||
testEnvironmentOptions: {
|
testEnvironmentOptions: {
|
||||||
customExportConditions: [''],
|
customExportConditions: [''],
|
||||||
},
|
},
|
||||||
modulePathIgnorePatterns: ['handlers']
|
modulePathIgnorePatterns: ['handlers'],
|
||||||
}
|
}
|
|
@ -103,8 +103,9 @@
|
||||||
"hono": "^3.9.2",
|
"hono": "^3.9.2",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
"jest-environment-miniflare": "^2.14.1",
|
"jest-environment-miniflare": "^2.14.1",
|
||||||
"msw": "^2.0.4",
|
"msw": "^2.0.11",
|
||||||
"patch-package": "^8.0.0",
|
"patch-package": "^8.0.0",
|
||||||
|
"publint": "^0.2.6",
|
||||||
"ts-jest": "^29.1.1",
|
"ts-jest": "^29.1.1",
|
||||||
"tsup": "^8.0.0",
|
"tsup": "^8.0.0",
|
||||||
"typescript": "^5.2.2"
|
"typescript": "^5.2.2"
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
"release": "yarn publish"
|
"release": "yarn publish"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": false,
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://registry.npmjs.org",
|
"registry": "https://registry.npmjs.org",
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
@ -34,7 +33,8 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@builder.io/qwik": "^1.2.0",
|
"@builder.io/qwik": "^1.2.0",
|
||||||
"@builder.io/qwik-city": "^1.2.0",
|
"@builder.io/qwik-city": "^1.2.0",
|
||||||
"hono": "^3.1.5"
|
"hono": "^3.1.5",
|
||||||
|
"rimraf": "^5.0.5"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
"replacer": "dist/replacer.js"
|
"replacer": "dist/replacer.js"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": false,
|
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/honojs/middleware.git"
|
"url": "https://github.com/honojs/middleware.git"
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
"release": "yarn build && yarn test && yarn publint && yarn publish"
|
"release": "yarn build && yarn test && yarn publint && yarn publish"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": false,
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://registry.npmjs.org",
|
"registry": "https://registry.npmjs.org",
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
"release": "yarn publish"
|
"release": "yarn publish"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": false,
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://registry.npmjs.org",
|
"registry": "https://registry.npmjs.org",
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
@ -34,6 +33,8 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@trpc/server": "^10.10.0",
|
"@trpc/server": "^10.10.0",
|
||||||
"hono": "^3.0.0",
|
"hono": "^3.0.0",
|
||||||
|
"jest": "^29.7.0",
|
||||||
|
"rimraf": "^5.0.5",
|
||||||
"zod": "^3.20.2"
|
"zod": "^3.20.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
"release": "yarn publish"
|
"release": "yarn publish"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": false,
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://registry.npmjs.org",
|
"registry": "https://registry.npmjs.org",
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
@ -33,6 +32,8 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sinclair/typebox": "^0.31.15",
|
"@sinclair/typebox": "^0.31.15",
|
||||||
"hono": "^3.1.2"
|
"hono": "^3.1.2",
|
||||||
|
"jest": "^29.7.0",
|
||||||
|
"rimraf": "^5.0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -33,7 +33,7 @@ describe('Basic', () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
output: {
|
output: {
|
||||||
success: true
|
success: boolean
|
||||||
message: string
|
message: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,9 @@ describe('Basic', () => {
|
||||||
age: 20,
|
age: 20,
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
})
|
})
|
||||||
const res = await app.request(req)
|
const res = await app.request(req)
|
||||||
expect(res).not.toBeNull()
|
expect(res).not.toBeNull()
|
||||||
|
@ -67,6 +70,9 @@ describe('Basic', () => {
|
||||||
age: '20',
|
age: '20',
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
})
|
})
|
||||||
const res = await app.request(req)
|
const res = await app.request(req)
|
||||||
expect(res).not.toBeNull()
|
expect(res).not.toBeNull()
|
||||||
|
@ -109,6 +115,9 @@ describe('With Hook', () => {
|
||||||
title: 'Hello',
|
title: 'Hello',
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
})
|
})
|
||||||
const res = await app.request(req)
|
const res = await app.request(req)
|
||||||
expect(res).not.toBeNull()
|
expect(res).not.toBeNull()
|
||||||
|
@ -123,6 +132,9 @@ describe('With Hook', () => {
|
||||||
title: 'Hello',
|
title: 'Hello',
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
})
|
})
|
||||||
const res = await app.request(req)
|
const res = await app.request(req)
|
||||||
expect(res).not.toBeNull()
|
expect(res).not.toBeNull()
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
"release": "yarn publish"
|
"release": "yarn publish"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": false,
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://registry.npmjs.org",
|
"registry": "https://registry.npmjs.org",
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
@ -34,6 +33,8 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"hono": "^3.5.8",
|
"hono": "^3.5.8",
|
||||||
|
"jest": "^29.7.0",
|
||||||
|
"rimraf": "^5.0.5",
|
||||||
"typia": "^5.0.4"
|
"typia": "^5.0.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
import { Hono } from 'hono'
|
import { Hono } from 'hono'
|
||||||
import type { Equal, Expect } from 'hono/utils/types'
|
import type { Equal, Expect } from 'hono/utils/types'
|
||||||
import typia, { tags } from 'typia'
|
import type { tags } from 'typia'
|
||||||
|
import typia from 'typia'
|
||||||
import { typiaValidator } from '../src'
|
import { typiaValidator } from '../src'
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
@ -49,6 +50,9 @@ describe('Basic', () => {
|
||||||
age: 30,
|
age: 30,
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
})
|
})
|
||||||
const res = await app.request(req)
|
const res = await app.request(req)
|
||||||
expect(res).not.toBeNull()
|
expect(res).not.toBeNull()
|
||||||
|
@ -66,6 +70,9 @@ describe('Basic', () => {
|
||||||
age: 18,
|
age: 18,
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
})
|
})
|
||||||
const res = await app.request(req)
|
const res = await app.request(req)
|
||||||
expect(res).not.toBeNull()
|
expect(res).not.toBeNull()
|
||||||
|
@ -110,6 +117,9 @@ describe('With Hook', () => {
|
||||||
title: 'Hello',
|
title: 'Hello',
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
})
|
})
|
||||||
const res = await app.request(req)
|
const res = await app.request(req)
|
||||||
expect(res).not.toBeNull()
|
expect(res).not.toBeNull()
|
||||||
|
@ -124,6 +134,9 @@ describe('With Hook', () => {
|
||||||
title: 'Hello',
|
title: 'Hello',
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
})
|
})
|
||||||
const res = await app.request(req)
|
const res = await app.request(req)
|
||||||
expect(res).not.toBeNull()
|
expect(res).not.toBeNull()
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
"release": "yarn publish"
|
"release": "yarn publish"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": false,
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://registry.npmjs.org",
|
"registry": "https://registry.npmjs.org",
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
@ -32,7 +31,9 @@
|
||||||
"valibot": "^0.13.1"
|
"valibot": "^0.13.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"hono": "^3.1.0",
|
"hono": "^3.11.5",
|
||||||
"valibot": "^0.13.1"
|
"jest": "^29.7.0",
|
||||||
|
"rimraf": "^5.0.5",
|
||||||
|
"valibot": "^0.24.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -33,7 +33,7 @@ describe('Basic', () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
output: {
|
output: {
|
||||||
success: true
|
success: boolean
|
||||||
message: string
|
message: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,9 @@ describe('Basic', () => {
|
||||||
name: 'Superman',
|
name: 'Superman',
|
||||||
age: 20,
|
age: 20,
|
||||||
}),
|
}),
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
})
|
})
|
||||||
const res = await app.request(req)
|
const res = await app.request(req)
|
||||||
|
@ -66,6 +69,9 @@ describe('Basic', () => {
|
||||||
name: 'Superman',
|
name: 'Superman',
|
||||||
age: '20',
|
age: '20',
|
||||||
}),
|
}),
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
})
|
})
|
||||||
const res = await app.request(req)
|
const res = await app.request(req)
|
||||||
|
@ -108,6 +114,9 @@ describe('With Hook', () => {
|
||||||
id: 123,
|
id: 123,
|
||||||
title: 'Hello',
|
title: 'Hello',
|
||||||
}),
|
}),
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
})
|
})
|
||||||
const res = await app.request(req)
|
const res = await app.request(req)
|
||||||
|
@ -122,6 +131,9 @@ describe('With Hook', () => {
|
||||||
id: '123',
|
id: '123',
|
||||||
title: 'Hello',
|
title: 'Hello',
|
||||||
}),
|
}),
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
})
|
})
|
||||||
const res = await app.request(req)
|
const res = await app.request(req)
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": false,
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://registry.npmjs.org",
|
"registry": "https://registry.npmjs.org",
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
@ -42,14 +41,16 @@
|
||||||
"zod": "3.*"
|
"zod": "3.*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@hono/zod-validator": "^0.1.11",
|
|
||||||
"hono": "^3.11.3",
|
"hono": "^3.11.3",
|
||||||
|
"jest": "^29.7.0",
|
||||||
|
"openapi3-ts": "^4.1.2",
|
||||||
|
"tsup": "^8.0.1",
|
||||||
"vitest": "^1.0.1",
|
"vitest": "^1.0.1",
|
||||||
"zod": "^3.22.1"
|
"zod": "^3.22.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@asteasolutions/zod-to-openapi": "^5.5.0",
|
"@asteasolutions/zod-to-openapi": "^5.5.0",
|
||||||
"@hono/zod-validator": "^0.1.9"
|
"@hono/zod-validator": "^0.1.11"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.0.0"
|
"node": ">=16.0.0"
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
"release": "yarn publish"
|
"release": "yarn publish"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": false,
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://registry.npmjs.org",
|
"registry": "https://registry.npmjs.org",
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
@ -33,6 +32,8 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"hono": "^3.5.2",
|
"hono": "^3.5.2",
|
||||||
|
"jest": "^29.7.0",
|
||||||
|
"rimraf": "^5.0.5",
|
||||||
"zod": "3.19.1"
|
"zod": "3.19.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,20 +14,27 @@ describe('Basic', () => {
|
||||||
age: z.number(),
|
age: z.number(),
|
||||||
})
|
})
|
||||||
|
|
||||||
const querySchema = z.object({
|
const querySchema = z
|
||||||
name: z.string().optional()
|
.object({
|
||||||
}).optional()
|
name: z.string().optional(),
|
||||||
|
|
||||||
const route = app.post('/author', zValidator('json', jsonSchema), zValidator('query', querySchema), (c) => {
|
|
||||||
const data = c.req.valid('json')
|
|
||||||
const query = c.req.valid('query')
|
|
||||||
|
|
||||||
return c.jsonT({
|
|
||||||
success: true,
|
|
||||||
message: `${data.name} is ${data.age}`,
|
|
||||||
queryName: query?.name,
|
|
||||||
})
|
})
|
||||||
})
|
.optional()
|
||||||
|
|
||||||
|
const route = app.post(
|
||||||
|
'/author',
|
||||||
|
zValidator('json', jsonSchema),
|
||||||
|
zValidator('query', querySchema),
|
||||||
|
(c) => {
|
||||||
|
const data = c.req.valid('json')
|
||||||
|
const query = c.req.valid('query')
|
||||||
|
|
||||||
|
return c.jsonT({
|
||||||
|
success: true,
|
||||||
|
message: `${data.name} is ${data.age}`,
|
||||||
|
queryName: query?.name,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
type Actual = ExtractSchema<typeof route>
|
type Actual = ExtractSchema<typeof route>
|
||||||
type Expected = {
|
type Expected = {
|
||||||
|
@ -39,9 +46,11 @@ describe('Basic', () => {
|
||||||
age: number
|
age: number
|
||||||
}
|
}
|
||||||
} & {
|
} & {
|
||||||
query?: {
|
query?:
|
||||||
name?: string | undefined
|
| {
|
||||||
} | undefined
|
name?: string | undefined
|
||||||
|
}
|
||||||
|
| undefined
|
||||||
}
|
}
|
||||||
output: {
|
output: {
|
||||||
success: boolean
|
success: boolean
|
||||||
|
@ -62,6 +71,9 @@ describe('Basic', () => {
|
||||||
age: 20,
|
age: 20,
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
})
|
})
|
||||||
const res = await app.request(req)
|
const res = await app.request(req)
|
||||||
expect(res).not.toBeNull()
|
expect(res).not.toBeNull()
|
||||||
|
@ -69,7 +81,7 @@ describe('Basic', () => {
|
||||||
expect(await res.json()).toEqual({
|
expect(await res.json()).toEqual({
|
||||||
success: true,
|
success: true,
|
||||||
message: 'Superman is 20',
|
message: 'Superman is 20',
|
||||||
queryName: 'Metallo'
|
queryName: 'Metallo',
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -122,6 +134,9 @@ describe('With Hook', () => {
|
||||||
title: 'Hello',
|
title: 'Hello',
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
})
|
})
|
||||||
const res = await app.request(req)
|
const res = await app.request(req)
|
||||||
expect(res).not.toBeNull()
|
expect(res).not.toBeNull()
|
||||||
|
@ -136,6 +151,9 @@ describe('With Hook', () => {
|
||||||
title: 'Hello',
|
title: 'Hello',
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
})
|
})
|
||||||
const res = await app.request(req)
|
const res = await app.request(req)
|
||||||
expect(res).not.toBeNull()
|
expect(res).not.toBeNull()
|
||||||
|
|
Loading…
Reference in New Issue