Skip to content

Commit

Permalink
chore: bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
sonofmagic committed Nov 9, 2024
1 parent f1eedd9 commit ee96d2f
Show file tree
Hide file tree
Showing 13 changed files with 206 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/fifty-spiders-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@icebreakers/monorepo": patch
---

feat: 添加 command 的 description
51 changes: 51 additions & 0 deletions apps/server/package.json
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"
}
}
41 changes: 41 additions & 0 deletions apps/server/src/app.tsx
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,
}
7 changes: 7 additions & 0 deletions apps/server/src/index.ts
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,
})
15 changes: 15 additions & 0 deletions apps/server/test/index.test.tsx
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' })
})
})
17 changes: 17 additions & 0 deletions apps/server/tsconfig.json
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"
]
}
13 changes: 13 additions & 0 deletions apps/server/tsup.config.ts
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,
})
15 changes: 15 additions & 0 deletions apps/server/vitest.config.ts
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,
},
})
4 changes: 1 addition & 3 deletions apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
"scripts": {
"dev": "vitepress dev",
"build": "vitepress build",
"preview": "vitepress preview",
"ice": "ice"
"preview": "vitepress preview"
},
"devDependencies": {
"@icebreakers/cli": "workspace:*",
"vitepress": "^1.5.0"
}
}
9 changes: 5 additions & 4 deletions packages/monorepo/src/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,28 @@ program
logger.success('upgrade @icebreakers/monorepo ok!')
})

program.command('init').action(async () => {
program.command('init').description('初始化 package.json 和 README.md').action(async () => {
await init(cwd)
logger.success('init finished!')
})

program.command('sync').action(async () => {
program.command('sync').description('向 npmmirror 同步所有子包').action(async () => {
await syncNpmMirror(cwd)
logger.success('sync npm mirror finished!')
})

program.command('clean').action(async () => {
program.command('clean').description('清除所有默认包').action(async () => {
await cleanProjects(cwd)
logger.success('clean projects finished!')
})

program.command('mirror').action(async () => {
program.command('mirror').description('设置 VscodeBinaryMirror').action(async () => {
await setVscodeBinaryMirror(cwd)
logger.success('set vscode binary mirror finished!')
})

program.command('new')
.description('创建一个新的子包')
.alias('create')
.argument('[name]')
.action(async (name: string) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/monorepo/test/createNewProject.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createNewProject } from '@/create'
import path from 'pathe'

describe('createNewProject', () => {
describe.skip('createNewProject', () => {
beforeAll(async () => {
await import('../scripts/prepublish')
})
Expand Down
37 changes: 34 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vitest.workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ import { defineWorkspace } from 'vitest/config'
export default defineWorkspace(
[
'packages/*',
'apps/*',
],
)

0 comments on commit ee96d2f

Please sign in to comment.