create-geekron-website 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,15 +1,89 @@
1
1
  # create-geekron-website
2
2
 
3
- To install dependencies:
3
+ A CLI tool to quickly create Geekron websites with CMS and renderer setup.
4
+
5
+ ## 使用方式
6
+
7
+ ```bash
8
+ npx create-geekron-website@latest
9
+ # 或
10
+ bunx create-geekron-website@latest
11
+ ```
12
+
13
+ ## 开发
14
+
15
+ ### 安装依赖
4
16
 
5
17
  ```bash
6
18
  bun install
7
19
  ```
8
20
 
9
- To run:
21
+ ### 开发运行
22
+
23
+ ```bash
24
+ bun run dev
25
+ # 或带参数
26
+ bun run dev my-project
27
+ ```
28
+
29
+ ### 构建
30
+
31
+ 使用交互式构建脚本(可选择更新版本号):
10
32
 
11
33
  ```bash
12
- bun run index.ts
34
+ bun run build
35
+ # 或直接执行
36
+ bash shell/build.sh
13
37
  ```
14
38
 
15
- This project was created using `bun init` in bun v1.3.4. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
39
+ 构建产物将生成到 `dist/` 目录。
40
+
41
+ ### 发布
42
+
43
+ 使用交互式发布脚本:
44
+
45
+ ```bash
46
+ npm run publish
47
+ # 或直接执行
48
+ bash shell/publish.sh
49
+ ```
50
+
51
+ 发布脚本会:
52
+ 1. 检查 npm 登录状态
53
+ 2. 检查 Git 工作区状态
54
+ 3. 可选更新版本号
55
+ 4. 构建项目
56
+ 5. 发布到 npm
57
+ 6. 可选创建 Git tag
58
+
59
+ ## 项目结构
60
+
61
+ ```
62
+ src/
63
+ ├── index.ts # CLI 入口
64
+ ├── cli.ts # 主 CLI 逻辑
65
+ ├── commands/ # 命令实现
66
+ ├── config/ # 配置
67
+ ├── types/ # 类型定义
68
+ └── utils/ # 工具函数
69
+
70
+ templates/
71
+ └── blank/ # 空白模板
72
+
73
+ shell/
74
+ ├── build.sh # 构建脚本
75
+ └── publish.sh # 发布脚本
76
+ ```
77
+
78
+ ## 功能特性
79
+
80
+ - 🚀 自动检测包管理器(npm/bun/pnpm/yarn)
81
+ - 📦 支持多种 CMS 系统(Strapi)
82
+ - 🎨 支持多种渲染器(Hono)
83
+ - 📝 可选模板系统
84
+ - 🛠️ 交互式配置流程
85
+ - 📊 友好的命令行界面
86
+
87
+ ## License
88
+
89
+ MIT
@@ -0,0 +1,2 @@
1
+ CMS_URL=http://127.0.0.1:1337
2
+ CMS_TOKEN=xxxxx
@@ -0,0 +1,11 @@
1
+ To install dependencies:
2
+ ```sh
3
+ bun install
4
+ ```
5
+
6
+ To run:
7
+ ```sh
8
+ bun run dev
9
+ ```
10
+
11
+ open http://localhost:3000
@@ -0,0 +1,62 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/latest/schema.json",
3
+ "vcs": {
4
+ "enabled": true,
5
+ "clientKind": "git",
6
+ "useIgnoreFile": true
7
+ },
8
+ "files": {
9
+ "ignoreUnknown": false,
10
+ "includes": ["src/**/*.{ts,tsx,scss,html,xsl,xml,svg}"]
11
+ },
12
+ "formatter": {
13
+ "enabled": true,
14
+ "indentStyle": "tab",
15
+ "indentWidth": 2,
16
+ "lineWidth": 80
17
+ },
18
+ "linter": {
19
+ "enabled": true,
20
+ "rules": {
21
+ "recommended": true,
22
+ "suspicious": {
23
+ "noExplicitAny": "off"
24
+ },
25
+ "a11y": {
26
+ "useValidAnchor": "off"
27
+ }
28
+ }
29
+ },
30
+ "javascript": {
31
+ "formatter": {
32
+ "quoteStyle": "single",
33
+ "semicolons": "asNeeded"
34
+ }
35
+ },
36
+ "json": {
37
+ "parser": {
38
+ "allowComments": true,
39
+ "allowTrailingCommas": true
40
+ },
41
+ "formatter": {
42
+ "enabled": true
43
+ }
44
+ },
45
+ "css": {
46
+ "formatter": {
47
+ "enabled": true,
48
+ "indentStyle": "tab",
49
+ "indentWidth": 2,
50
+ "lineWidth": 80,
51
+ "quoteStyle": "single"
52
+ }
53
+ },
54
+ "assist": {
55
+ "enabled": true,
56
+ "actions": {
57
+ "source": {
58
+ "organizeImports": "on"
59
+ }
60
+ }
61
+ }
62
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "geekron-site",
3
+ "scripts": {
4
+ "dev": "bun run --hot src/index.ts",
5
+ "format": "bunx biome format --write",
6
+ "lint": "bunx biome lint --write",
7
+ "check": "bunx biome check --write"
8
+ },
9
+ "dependencies": {
10
+ "@geekron/hono": "latest",
11
+ "hono": "latest"
12
+ },
13
+ "devDependencies": {
14
+ "@biomejs/biome": "latest",
15
+ "@types/bun": "latest"
16
+ }
17
+ }
@@ -0,0 +1,16 @@
1
+ import { setupApp } from '@geekron/hono/route'
2
+ import { setupStrapi } from '@geekron/hono/strapi'
3
+ import { serveStatic } from 'hono/bun'
4
+
5
+ // 启动 strapi
6
+ await setupStrapi()
7
+ // 启动 hono
8
+ const { app, server, routes } = setupApp()
9
+
10
+ // 配置资源目录
11
+ app.use('/assets/*', serveStatic({ root: './public' }))
12
+ app.use('/favicon.ico', serveStatic({ path: './public/favicon.ico' }))
13
+
14
+ // 打印路由表
15
+ console.table(routes)
16
+ console.log(`App is running at: ${server.url}`)
@@ -0,0 +1,5 @@
1
+ import type { RouteHandler } from '@geekron/hono/route';
2
+
3
+ export const GET: RouteHandler = async (c) => {
4
+ return c.html('<h1>Hello Geekron</h1>')
5
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "strict": true,
4
+ "target": "ES2021",
5
+ "module": "ES2022",
6
+ "moduleResolution": "bundler",
7
+ "jsx": "react-jsx",
8
+ "jsxImportSource": "hono/jsx",
9
+ "types": ["bun-types"],
10
+ "esModuleInterop": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "allowImportingTsExtensions": false,
13
+ "skipLibCheck": true,
14
+ "noEmit": true,
15
+ "baseUrl": ".",
16
+ "paths": {
17
+ "~/*": ["*"],
18
+ "@/*": ["src/*"]
19
+ }
20
+ }
21
+ }
package/package.json CHANGED
@@ -1,7 +1,13 @@
1
1
  {
2
2
  "name": "create-geekron-website",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "CLI tool to create Geekron websites",
5
+ "author": {
6
+ "name": "Geekron",
7
+ "email": "geekron.cn@gmail.com",
8
+ "url": "https://www.geekron.com"
9
+ },
10
+ "repository": "https://github.com/geekron-com/create-geekron-website.git",
5
11
  "type": "module",
6
12
  "bin": {
7
13
  "create-geekron-website": "./dist/index.js"
@@ -13,8 +19,9 @@
13
19
  ],
14
20
  "scripts": {
15
21
  "dev": "bun run src/index.ts",
16
- "build": "bun build src/index.ts --outdir dist --target node",
17
- "prepublishOnly": "bun run build"
22
+ "build": "bash shell/build.sh",
23
+ "publish": "bash shell/publish.sh",
24
+ "prepublishOnly": "bash shell/build.sh"
18
25
  },
19
26
  "dependencies": {
20
27
  "chalk": "^5.3.0",
@@ -0,0 +1,2 @@
1
+ CMS_URL=http://127.0.0.1:1337
2
+ CMS_TOKEN=xxxxx
@@ -0,0 +1,11 @@
1
+ To install dependencies:
2
+ ```sh
3
+ bun install
4
+ ```
5
+
6
+ To run:
7
+ ```sh
8
+ bun run dev
9
+ ```
10
+
11
+ open http://localhost:3000
@@ -0,0 +1,62 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/latest/schema.json",
3
+ "vcs": {
4
+ "enabled": true,
5
+ "clientKind": "git",
6
+ "useIgnoreFile": true
7
+ },
8
+ "files": {
9
+ "ignoreUnknown": false,
10
+ "includes": ["src/**/*.{ts,tsx,scss,html,xsl,xml,svg}"]
11
+ },
12
+ "formatter": {
13
+ "enabled": true,
14
+ "indentStyle": "tab",
15
+ "indentWidth": 2,
16
+ "lineWidth": 80
17
+ },
18
+ "linter": {
19
+ "enabled": true,
20
+ "rules": {
21
+ "recommended": true,
22
+ "suspicious": {
23
+ "noExplicitAny": "off"
24
+ },
25
+ "a11y": {
26
+ "useValidAnchor": "off"
27
+ }
28
+ }
29
+ },
30
+ "javascript": {
31
+ "formatter": {
32
+ "quoteStyle": "single",
33
+ "semicolons": "asNeeded"
34
+ }
35
+ },
36
+ "json": {
37
+ "parser": {
38
+ "allowComments": true,
39
+ "allowTrailingCommas": true
40
+ },
41
+ "formatter": {
42
+ "enabled": true
43
+ }
44
+ },
45
+ "css": {
46
+ "formatter": {
47
+ "enabled": true,
48
+ "indentStyle": "tab",
49
+ "indentWidth": 2,
50
+ "lineWidth": 80,
51
+ "quoteStyle": "single"
52
+ }
53
+ },
54
+ "assist": {
55
+ "enabled": true,
56
+ "actions": {
57
+ "source": {
58
+ "organizeImports": "on"
59
+ }
60
+ }
61
+ }
62
+ }
@@ -1,18 +1,17 @@
1
1
  {
2
- "name": "geekron-website",
3
- "version": "0.1.0",
4
- "type": "module",
2
+ "name": "geekron-site",
5
3
  "scripts": {
6
4
  "dev": "bun run --hot src/index.ts",
7
- "build": "bun build src/index.ts --outdir dist --target node",
8
- "start": "node dist/index.js"
5
+ "format": "bunx biome format --write",
6
+ "lint": "bunx biome lint --write",
7
+ "check": "bunx biome check --write"
9
8
  },
10
9
  "dependencies": {
11
- "hono": "latest",
12
- "@hono/node-server": "latest"
10
+ "@geekron/hono": "latest",
11
+ "hono": "latest"
13
12
  },
14
13
  "devDependencies": {
15
- "@types/bun": "latest",
16
- "typescript": "^5"
14
+ "@biomejs/biome": "latest",
15
+ "@types/bun": "latest"
17
16
  }
18
- }
17
+ }
@@ -1,57 +1,16 @@
1
- import { Hono } from "hono";
2
- import { serve } from "@hono/node-server";
1
+ import { setupApp } from '@geekron/hono/route'
2
+ import { setupStrapi } from '@geekron/hono/strapi'
3
+ import { serveStatic } from 'hono/bun'
3
4
 
4
- const app = new Hono();
5
+ // 启动 strapi
6
+ await setupStrapi()
7
+ // 启动 hono
8
+ const { app, server, routes } = setupApp()
5
9
 
6
- app.get("/", (c) => {
7
- return c.html(`
8
- <!DOCTYPE html>
9
- <html lang="en">
10
- <head>
11
- <meta charset="UTF-8">
12
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
13
- <title>Geekron Website</title>
14
- <style>
15
- * { margin: 0; padding: 0; box-sizing: border-box; }
16
- body {
17
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
18
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
19
- min-height: 100vh;
20
- display: flex;
21
- align-items: center;
22
- justify-content: center;
23
- }
24
- .container {
25
- text-align: center;
26
- color: white;
27
- padding: 2rem;
28
- }
29
- h1 { font-size: 3rem; margin-bottom: 1rem; }
30
- p { font-size: 1.2rem; opacity: 0.9; }
31
- .emoji { font-size: 4rem; margin-bottom: 1rem; }
32
- </style>
33
- </head>
34
- <body>
35
- <div class="container">
36
- <div class="emoji">🚀</div>
37
- <h1>Welcome to Geekron</h1>
38
- <p>Your website is ready. Start building something amazing!</p>
39
- </div>
40
- </body>
41
- </html>
42
- `);
43
- });
10
+ // 配置资源目录
11
+ app.use('/assets/*', serveStatic({ root: './public' }))
12
+ app.use('/favicon.ico', serveStatic({ path: './public/favicon.ico' }))
44
13
 
45
- // Health check endpoint
46
- app.get("/health", (c) => {
47
- return c.json({ status: "ok" });
48
- });
49
-
50
- const port = Number(process.env.PORT) || 3000;
51
-
52
- console.log(`Server is running on http://localhost:${port}`);
53
-
54
- serve({
55
- fetch: app.fetch,
56
- port,
57
- });
14
+ // 打印路由表
15
+ console.table(routes)
16
+ console.log(`App is running at: ${server.url}`)
@@ -0,0 +1,5 @@
1
+ import type { RouteHandler } from '@geekron/hono/route';
2
+
3
+ export const GET: RouteHandler = async (c) => {
4
+ return c.html('<h1>Hello Geekron</h1>')
5
+ }
@@ -1,22 +1,21 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "lib": ["ESNext"],
4
- "target": "ESNext",
5
- "module": "ESNext",
6
- "moduleDetection": "force",
7
- "jsx": "react-jsx",
8
- "allowJs": true,
9
- "moduleResolution": "bundler",
10
- "allowImportingTsExtensions": true,
11
- "verbatimModuleSyntax": true,
12
- "noEmit": true,
13
3
  "strict": true,
4
+ "target": "ES2021",
5
+ "module": "ES2022",
6
+ "moduleResolution": "bundler",
7
+ "jsx": "react-jsx",
8
+ "jsxImportSource": "hono/jsx",
9
+ "types": ["bun-types"],
10
+ "esModuleInterop": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "allowImportingTsExtensions": false,
14
13
  "skipLibCheck": true,
15
- "noFallthroughCasesInSwitch": true,
16
- "noUncheckedIndexedAccess": true,
17
- "noImplicitOverride": true,
18
- "noUnusedLocals": false,
19
- "noUnusedParameters": false,
20
- "noPropertyAccessFromIndexSignature": false
14
+ "noEmit": true,
15
+ "baseUrl": ".",
16
+ "paths": {
17
+ "~/*": ["*"],
18
+ "@/*": ["src/*"]
19
+ }
21
20
  }
22
21
  }