From ee96d2f76f1ea2bc8ff5b899e119f1a045ee8702 Mon Sep 17 00:00:00 2001 From: ice breaker <1324318532@qq.com> Date: Sun, 10 Nov 2024 01:07:48 +0800 Subject: [PATCH] chore: bump version --- .changeset/fifty-spiders-call.md | 5 ++ apps/server/package.json | 51 +++++++++++++++++++ apps/server/src/app.tsx | 41 +++++++++++++++ apps/server/src/index.ts | 7 +++ apps/server/test/index.test.tsx | 15 ++++++ apps/server/tsconfig.json | 17 +++++++ apps/server/tsup.config.ts | 13 +++++ apps/server/vitest.config.ts | 15 ++++++ apps/website/package.json | 4 +- packages/monorepo/src/program.ts | 9 ++-- .../monorepo/test/createNewProject.test.ts | 2 +- pnpm-lock.yaml | 37 ++++++++++++-- vitest.workspace.ts | 1 + 13 files changed, 206 insertions(+), 11 deletions(-) create mode 100644 .changeset/fifty-spiders-call.md create mode 100644 apps/server/package.json create mode 100644 apps/server/src/app.tsx create mode 100644 apps/server/src/index.ts create mode 100644 apps/server/test/index.test.tsx create mode 100644 apps/server/tsconfig.json create mode 100644 apps/server/tsup.config.ts create mode 100644 apps/server/vitest.config.ts diff --git a/.changeset/fifty-spiders-call.md b/.changeset/fifty-spiders-call.md new file mode 100644 index 0000000..69a4860 --- /dev/null +++ b/.changeset/fifty-spiders-call.md @@ -0,0 +1,5 @@ +--- +"@icebreakers/monorepo": patch +--- + +feat: 添加 command 的 description diff --git a/apps/server/package.json b/apps/server/package.json new file mode 100644 index 0000000..35a6988 --- /dev/null +++ b/apps/server/package.json @@ -0,0 +1,51 @@ +{ + "name": "@icebreakers/server", + "type": "module", + "version": "0.0.0", + "description": "tsup(esbuild) build package template", + "author": "ice breaker <1324318532@qq.com>", + "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" + } +} diff --git a/apps/server/src/app.tsx b/apps/server/src/app.tsx new file mode 100644 index 0000000..2cfc219 --- /dev/null +++ b/apps/server/src/app.tsx @@ -0,0 +1,41 @@ +import type { FC } from 'hono/jsx' +import { Hono } from 'hono' + +const app = new Hono() + +const Layout: FC = (props) => { + return ( + + {props.children} + + ) +} + +const Top: FC<{ messages: string[] }> = (props: { + messages: string[] +}) => { + return ( + +

Hello Hono!

+ +
+ ) +} + +app.get('/', (c) => { + const messages = ['Good Morning', 'Good Evening', 'Good Night'] + return c.html() +}) + +export { + app, +} diff --git a/apps/server/src/index.ts b/apps/server/src/index.ts new file mode 100644 index 0000000..671b1ed --- /dev/null +++ b/apps/server/src/index.ts @@ -0,0 +1,7 @@ +import { serve } from '@hono/node-server' +import { app } from './app' + +serve({ + fetch: app.fetch, + port: 10086, +}) diff --git a/apps/server/test/index.test.tsx b/apps/server/test/index.test.tsx new file mode 100644 index 0000000..1f9a0bf --- /dev/null +++ b/apps/server/test/index.test.tsx @@ -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' }) + }) +}) diff --git a/apps/server/tsconfig.json b/apps/server/tsconfig.json new file mode 100644 index 0000000..24ce8e6 --- /dev/null +++ b/apps/server/tsconfig.json @@ -0,0 +1,17 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "hono/jsx", + "baseUrl": ".", + "paths": { + "@/*": [ + "src/*" + ] + } + }, + "include": [ + "src", + "test" + ] +} diff --git a/apps/server/tsup.config.ts b/apps/server/tsup.config.ts new file mode 100644 index 0000000..fa0d099 --- /dev/null +++ b/apps/server/tsup.config.ts @@ -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, +}) diff --git a/apps/server/vitest.config.ts b/apps/server/vitest.config.ts new file mode 100644 index 0000000..925b0db --- /dev/null +++ b/apps/server/vitest.config.ts @@ -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, + }, +}) diff --git a/apps/website/package.json b/apps/website/package.json index 042d202..7da2df1 100644 --- a/apps/website/package.json +++ b/apps/website/package.json @@ -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" } } diff --git a/packages/monorepo/src/program.ts b/packages/monorepo/src/program.ts index c7c2a59..04b5c60 100644 --- a/packages/monorepo/src/program.ts +++ b/packages/monorepo/src/program.ts @@ -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) => { diff --git a/packages/monorepo/test/createNewProject.test.ts b/packages/monorepo/test/createNewProject.test.ts index 45d2f7b..f73c306 100644 --- a/packages/monorepo/test/createNewProject.test.ts +++ b/packages/monorepo/test/createNewProject.test.ts @@ -1,7 +1,7 @@ import { createNewProject } from '@/create' import path from 'pathe' -describe('createNewProject', () => { +describe.skip('createNewProject', () => { beforeAll(async () => { await import('../scripts/prepublish') }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c82dc77..57bcb33 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -157,11 +157,17 @@ importers: specifier: workspace:* version: link:../../packages/monorepo + apps/server: + devDependencies: + '@hono/node-server': + specifier: ^1.13.5 + version: 1.13.5(hono@4.6.9) + hono: + specifier: ^4.6.9 + version: 4.6.9 + apps/website: devDependencies: - '@icebreakers/cli': - specifier: workspace:* - version: link:../cli vitepress: specifier: ^1.5.0 version: 1.5.0(@algolia/client-search@5.12.0)(@types/node@22.9.0)(postcss@8.4.47)(search-insights@2.17.2)(typescript@5.6.3) @@ -1294,6 +1300,12 @@ packages: resolution: {integrity: sha512-7bQW+gkKa2kKZPeJf6+c6gFK9ARxQfn+FKy9ScTBppyKRWH2KzsmweXUoklqeEiHiNVWaeP5csIdsNq6w7QhzA==} engines: {node: '>=12.20'} + '@hono/node-server@1.13.5': + resolution: {integrity: sha512-lSo+CFlLqAFB4fX7ePqI9nauEn64wOfJHAfc9duYFTvAG3o416pC0nTGeNjuLHchLedH+XyWda5v79CVx1PIjg==} + engines: {node: '>=18.14.1'} + peerDependencies: + hono: ^4 + '@humanfs/core@0.19.1': resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==} engines: {node: '>=18.18.0'} @@ -1719,46 +1731,55 @@ packages: resolution: {integrity: sha512-KRSFHyE/RdxQ1CSeOIBVIAxStFC/hnBgVcaiCkQaVC+EYDtTe4X7z5tBkFyRoBgUGtB6Xg6t9t2kulnX6wJc6A==} cpu: [arm] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.24.3': resolution: {integrity: sha512-h6Q8MT+e05zP5BxEKz0vi0DhthLdrNEnspdLzkoFqGwnmOzakEHSlXfVyA4HJ322QtFy7biUAVFPvIDEDQa6rw==} cpu: [arm] os: [linux] + libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.24.3': resolution: {integrity: sha512-fKElSyXhXIJ9pqiYRqisfirIo2Z5pTTve5K438URf08fsypXrEkVmShkSfM8GJ1aUyvjakT+fn2W7Czlpd/0FQ==} cpu: [arm64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.24.3': resolution: {integrity: sha512-YlddZSUk8G0px9/+V9PVilVDC6ydMz7WquxozToozSnfFK6wa6ne1ATUjUvjin09jp34p84milxlY5ikueoenw==} cpu: [arm64] os: [linux] + libc: [musl] '@rollup/rollup-linux-powerpc64le-gnu@4.24.3': resolution: {integrity: sha512-yNaWw+GAO8JjVx3s3cMeG5Esz1cKVzz8PkTJSfYzE5u7A+NvGmbVFEHP+BikTIyYWuz0+DX9kaA3pH9Sqxp69g==} cpu: [ppc64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-riscv64-gnu@4.24.3': resolution: {integrity: sha512-lWKNQfsbpv14ZCtM/HkjCTm4oWTKTfxPmr7iPfp3AHSqyoTz5AgLemYkWLwOBWc+XxBbrU9SCokZP0WlBZM9lA==} cpu: [riscv64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-s390x-gnu@4.24.3': resolution: {integrity: sha512-HoojGXTC2CgCcq0Woc/dn12wQUlkNyfH0I1ABK4Ni9YXyFQa86Fkt2Q0nqgLfbhkyfQ6003i3qQk9pLh/SpAYw==} cpu: [s390x] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.24.3': resolution: {integrity: sha512-mnEOh4iE4USSccBOtcrjF5nj+5/zm6NcNhbSEfR3Ot0pxBwvEn5QVUXcuOwwPkapDtGZ6pT02xLoPaNv06w7KQ==} cpu: [x64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-musl@4.24.3': resolution: {integrity: sha512-rMTzawBPimBQkG9NKpNHvquIUTQPzrnPxPbCY1Xt+mFkW7pshvyIS5kYgcf74goxXOQk0CP3EoOC1zcEezKXhw==} cpu: [x64] os: [linux] + libc: [musl] '@rollup/rollup-win32-arm64-msvc@4.24.3': resolution: {integrity: sha512-2lg1CE305xNvnH3SyiKwPVsTVLCg4TmNCF1z7PSHX2uZY2VbUpdkgAllVoISD7JO7zu+YynpWNSKAtOrX3AiuA==} @@ -3560,6 +3581,10 @@ packages: hast-util-whitespace@3.0.0: resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==} + hono@4.6.9: + resolution: {integrity: sha512-p/pN5yZLuZaHzyAOT2nw2/Ud6HhJHYmDNGH6Ck1OWBhPMVeM1r74jbCRwNi0gyFRjjbsGgoHbOyj7mT1PDNbTw==} + engines: {node: '>=16.9.0'} + hookable@5.5.3: resolution: {integrity: sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==} @@ -7324,6 +7349,10 @@ snapshots: '@gwhitney/detect-indent@7.0.1': {} + '@hono/node-server@1.13.5(hono@4.6.9)': + dependencies: + hono: 4.6.9 + '@humanfs/core@0.19.1': {} '@humanfs/node@0.16.6': @@ -10208,6 +10237,8 @@ snapshots: dependencies: '@types/hast': 3.0.4 + hono@4.6.9: {} + hookable@5.5.3: {} hosted-git-info@2.8.9: {} diff --git a/vitest.workspace.ts b/vitest.workspace.ts index 000a206..3261254 100644 --- a/vitest.workspace.ts +++ b/vitest.workspace.ts @@ -3,5 +3,6 @@ import { defineWorkspace } from 'vitest/config' export default defineWorkspace( [ 'packages/*', + 'apps/*', ], )