-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f1eedd9
commit ee96d2f
Showing
13 changed files
with
206 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@icebreakers/monorepo": patch | ||
--- | ||
|
||
feat: 添加 command 的 description |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"name": "@icebreakers/server", | ||
"type": "module", | ||
"version": "0.0.0", | ||
"description": "tsup(esbuild) build package template", | ||
"author": "ice breaker <[email protected]>", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/sonofmagic/monorepo-template.git", | ||
"directory": "packages/bar" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/sonofmagic/monorepo-template/issues" | ||
}, | ||
"keywords": [], | ||
"sideEffects": false, | ||
"exports": { | ||
".": "./src/index.ts" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"dev": "tsx watch src/index.ts", | ||
"start": "node dist/index.js", | ||
"build:watch": "tsup --watch --sourcemap", | ||
"build": "tsup", | ||
"test": "vitest run", | ||
"test:dev": "vitest", | ||
"release": "pnpm publish", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint . --fix" | ||
}, | ||
"publishConfig": { | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.cjs" | ||
} | ||
}, | ||
"main": "./dist/index.cjs", | ||
"module": "./dist/index.js", | ||
"types": "./dist/index.d.ts" | ||
}, | ||
"devDependencies": { | ||
"@hono/node-server": "^1.13.5", | ||
"hono": "^4.6.9" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import type { FC } from 'hono/jsx' | ||
import { Hono } from 'hono' | ||
|
||
const app = new Hono() | ||
|
||
const Layout: FC = (props) => { | ||
return ( | ||
<html> | ||
<body>{props.children}</body> | ||
</html> | ||
) | ||
} | ||
|
||
const Top: FC<{ messages: string[] }> = (props: { | ||
messages: string[] | ||
}) => { | ||
return ( | ||
<Layout> | ||
<h1>Hello Hono!</h1> | ||
<ul> | ||
{props.messages.map((message) => { | ||
return ( | ||
<li> | ||
{message} | ||
!! | ||
</li> | ||
) | ||
})} | ||
</ul> | ||
</Layout> | ||
) | ||
} | ||
|
||
app.get('/', (c) => { | ||
const messages = ['Good Morning', 'Good Evening', 'Good Night'] | ||
return c.html(<Top messages={messages} />) | ||
}) | ||
|
||
export { | ||
app, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { serve } from '@hono/node-server' | ||
import { app } from './app' | ||
|
||
serve({ | ||
fetch: app.fetch, | ||
port: 10086, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// import { app } from '@/app' | ||
import { Hono } from 'hono' | ||
import { testClient } from 'hono/testing' | ||
|
||
describe('index', () => { | ||
it('foo bar', async () => { | ||
const app = new Hono().get('/search', c => | ||
c.json({ hello: 'world' })) | ||
const res = await testClient(app).search.$get() | ||
|
||
expect(await res.json()).toEqual({ hello: 'world' }) | ||
|
||
// expect(await res.json()).toEqual({ hello: 'world' }) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"jsx": "react-jsx", | ||
"jsxImportSource": "hono/jsx", | ||
"baseUrl": ".", | ||
"paths": { | ||
"@/*": [ | ||
"src/*" | ||
] | ||
} | ||
}, | ||
"include": [ | ||
"src", | ||
"test" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { defineConfig } from 'tsup' | ||
|
||
export default defineConfig({ | ||
entry: ['src/index.ts'], // , 'src/cli.ts'], | ||
shims: true, | ||
format: ['esm'], | ||
clean: true, | ||
dts: false, | ||
// https://github.com/egoist/tsup/pull/1056 | ||
// https://github.com/egoist/tsup/issues?q=cjsInterop | ||
// cjsInterop: true, | ||
// splitting: true, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import path from 'node:path' | ||
import { defineProject } from 'vitest/config' | ||
|
||
export default defineProject({ | ||
test: { | ||
alias: [ | ||
{ | ||
find: '@', | ||
replacement: path.resolve(__dirname, './src'), | ||
}, | ||
], | ||
globals: true, | ||
testTimeout: 60_000, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ import { defineWorkspace } from 'vitest/config' | |
export default defineWorkspace( | ||
[ | ||
'packages/*', | ||
'apps/*', | ||
], | ||
) |