@lambertkeith/spec-go 0.2.4

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.
Files changed (143) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +163 -0
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.js +850 -0
  5. package/dist/index.js.map +1 -0
  6. package/package.json +46 -0
  7. package/templates/django/README.md +27 -0
  8. package/templates/django/_gitignore +20 -0
  9. package/templates/django/_template.json +14 -0
  10. package/templates/django/manage.py +22 -0
  11. package/templates/django/project_name/__init__.py +1 -0
  12. package/templates/django/project_name/asgi.py +11 -0
  13. package/templates/django/project_name/settings.py +75 -0
  14. package/templates/django/project_name/urls.py +16 -0
  15. package/templates/django/project_name/wsgi.py +11 -0
  16. package/templates/django/pyproject.toml +20 -0
  17. package/templates/empty/README.md +3 -0
  18. package/templates/empty/_gitignore +6 -0
  19. package/templates/empty/_template.json +6 -0
  20. package/templates/express-ts/README.md +27 -0
  21. package/templates/express-ts/_gitignore +7 -0
  22. package/templates/express-ts/_template.json +13 -0
  23. package/templates/express-ts/package.json +23 -0
  24. package/templates/express-ts/src/index.ts +17 -0
  25. package/templates/express-ts/src/middleware/error-handler.ts +14 -0
  26. package/templates/express-ts/src/routes/index.ts +11 -0
  27. package/templates/express-ts/tsconfig.json +17 -0
  28. package/templates/express-ts/tsup.config.ts +9 -0
  29. package/templates/fastapi/README.md +21 -0
  30. package/templates/fastapi/_gitignore +16 -0
  31. package/templates/fastapi/_template.json +14 -0
  32. package/templates/fastapi/pyproject.toml +21 -0
  33. package/templates/fastapi/src/project_name/__init__.py +1 -0
  34. package/templates/fastapi/src/project_name/main.py +20 -0
  35. package/templates/fastapi/src/project_name/routes/__init__.py +8 -0
  36. package/templates/flask/README.md +15 -0
  37. package/templates/flask/_gitignore +17 -0
  38. package/templates/flask/_template.json +14 -0
  39. package/templates/flask/pyproject.toml +19 -0
  40. package/templates/flask/src/project_name/__init__.py +1 -0
  41. package/templates/flask/src/project_name/app.py +15 -0
  42. package/templates/flask/src/project_name/routes/__init__.py +8 -0
  43. package/templates/fullstack-react-node/README.md +35 -0
  44. package/templates/fullstack-react-node/_gitignore +7 -0
  45. package/templates/fullstack-react-node/_template.json +14 -0
  46. package/templates/fullstack-react-node/backend/package.json +22 -0
  47. package/templates/fullstack-react-node/backend/src/index.ts +20 -0
  48. package/templates/fullstack-react-node/backend/tsconfig.json +17 -0
  49. package/templates/fullstack-react-node/backend/tsup.config.ts +9 -0
  50. package/templates/fullstack-react-node/frontend/index.html +12 -0
  51. package/templates/fullstack-react-node/frontend/package.json +22 -0
  52. package/templates/fullstack-react-node/frontend/src/App.css +16 -0
  53. package/templates/fullstack-react-node/frontend/src/App.tsx +22 -0
  54. package/templates/fullstack-react-node/frontend/src/main.tsx +9 -0
  55. package/templates/fullstack-react-node/frontend/tsconfig.json +20 -0
  56. package/templates/fullstack-react-node/frontend/vite.config.ts +14 -0
  57. package/templates/fullstack-react-node/package.json +10 -0
  58. package/templates/fullstack-react-node/pnpm-workspace.yaml +3 -0
  59. package/templates/fullstack-react-python/Makefile +35 -0
  60. package/templates/fullstack-react-python/README.md +43 -0
  61. package/templates/fullstack-react-python/_gitignore +18 -0
  62. package/templates/fullstack-react-python/_template.json +25 -0
  63. package/templates/fullstack-react-python/backend/pyproject.toml +21 -0
  64. package/templates/fullstack-react-python/backend/src/project_name/__init__.py +1 -0
  65. package/templates/fullstack-react-python/backend/src/project_name/main.py +29 -0
  66. package/templates/fullstack-react-python/backend/src/project_name/routes/__init__.py +8 -0
  67. package/templates/fullstack-react-python/frontend/index.html +12 -0
  68. package/templates/fullstack-react-python/frontend/package.json +22 -0
  69. package/templates/fullstack-react-python/frontend/src/App.css +16 -0
  70. package/templates/fullstack-react-python/frontend/src/App.tsx +22 -0
  71. package/templates/fullstack-react-python/frontend/src/main.tsx +9 -0
  72. package/templates/fullstack-react-python/frontend/tsconfig.json +20 -0
  73. package/templates/fullstack-react-python/frontend/vite.config.ts +14 -0
  74. package/templates/fullstack-vue-node/README.md +35 -0
  75. package/templates/fullstack-vue-node/_gitignore +7 -0
  76. package/templates/fullstack-vue-node/_template.json +14 -0
  77. package/templates/fullstack-vue-node/backend/package.json +22 -0
  78. package/templates/fullstack-vue-node/backend/src/index.ts +20 -0
  79. package/templates/fullstack-vue-node/backend/tsconfig.json +17 -0
  80. package/templates/fullstack-vue-node/backend/tsup.config.ts +9 -0
  81. package/templates/fullstack-vue-node/frontend/index.html +12 -0
  82. package/templates/fullstack-vue-node/frontend/package.json +20 -0
  83. package/templates/fullstack-vue-node/frontend/src/App.vue +41 -0
  84. package/templates/fullstack-vue-node/frontend/src/main.ts +4 -0
  85. package/templates/fullstack-vue-node/frontend/src/vite-env.d.ts +1 -0
  86. package/templates/fullstack-vue-node/frontend/tsconfig.json +20 -0
  87. package/templates/fullstack-vue-node/frontend/vite.config.ts +14 -0
  88. package/templates/fullstack-vue-node/package.json +10 -0
  89. package/templates/fullstack-vue-node/pnpm-workspace.yaml +3 -0
  90. package/templates/next-ts/README.md +26 -0
  91. package/templates/next-ts/_gitignore +34 -0
  92. package/templates/next-ts/_template.json +13 -0
  93. package/templates/next-ts/next.config.ts +7 -0
  94. package/templates/next-ts/package.json +22 -0
  95. package/templates/next-ts/src/app/globals.css +21 -0
  96. package/templates/next-ts/src/app/layout.tsx +19 -0
  97. package/templates/next-ts/src/app/page.tsx +10 -0
  98. package/templates/next-ts/tsconfig.json +27 -0
  99. package/templates/node-ts/README.md +21 -0
  100. package/templates/node-ts/_gitignore +7 -0
  101. package/templates/node-ts/_template.json +16 -0
  102. package/templates/node-ts/package.json +19 -0
  103. package/templates/node-ts/src/index.ts +1 -0
  104. package/templates/node-ts/tsconfig.json +17 -0
  105. package/templates/node-ts/tsup.config.ts +9 -0
  106. package/templates/python-uv/README.md +22 -0
  107. package/templates/python-uv/_gitignore +30 -0
  108. package/templates/python-uv/_template.json +14 -0
  109. package/templates/python-uv/pyproject.toml +20 -0
  110. package/templates/python-uv/src/project_name/__init__.py +10 -0
  111. package/templates/python-uv/src/project_name/__main__.py +4 -0
  112. package/templates/react-ts/_gitignore +6 -0
  113. package/templates/react-ts/_template.json +13 -0
  114. package/templates/react-ts/index.html +13 -0
  115. package/templates/react-ts/package.json +23 -0
  116. package/templates/react-ts/src/App.css +14 -0
  117. package/templates/react-ts/src/App.tsx +12 -0
  118. package/templates/react-ts/src/index.css +11 -0
  119. package/templates/react-ts/src/main.tsx +10 -0
  120. package/templates/react-ts/tsconfig.json +20 -0
  121. package/templates/react-ts/vite.config.ts +6 -0
  122. package/templates/springboot/.mvn/wrapper/maven-wrapper.properties +2 -0
  123. package/templates/springboot/README.md +27 -0
  124. package/templates/springboot/_gitignore +36 -0
  125. package/templates/springboot/_template.json +14 -0
  126. package/templates/springboot/mvnw +19 -0
  127. package/templates/springboot/mvnw.cmd +13 -0
  128. package/templates/springboot/pom.xml +46 -0
  129. package/templates/springboot/src/main/java/com/example/project_name/Application.java +12 -0
  130. package/templates/springboot/src/main/java/com/example/project_name/controller/HelloController.java +25 -0
  131. package/templates/springboot/src/main/resources/application.yml +6 -0
  132. package/templates/springboot/src/test/java/com/example/project_name/ApplicationTests.java +12 -0
  133. package/templates/template.config.json +102 -0
  134. package/templates/vue-ts/_gitignore +6 -0
  135. package/templates/vue-ts/_template.json +13 -0
  136. package/templates/vue-ts/index.html +13 -0
  137. package/templates/vue-ts/package.json +20 -0
  138. package/templates/vue-ts/src/App.vue +37 -0
  139. package/templates/vue-ts/src/main.ts +5 -0
  140. package/templates/vue-ts/src/style.css +11 -0
  141. package/templates/vue-ts/src/vite-env.d.ts +7 -0
  142. package/templates/vue-ts/tsconfig.json +20 -0
  143. package/templates/vue-ts/vite.config.ts +6 -0
@@ -0,0 +1,16 @@
1
+ .app {
2
+ max-width: 800px;
3
+ margin: 0 auto;
4
+ padding: 2rem;
5
+ text-align: center;
6
+ }
7
+
8
+ h1 {
9
+ font-size: 2.5rem;
10
+ color: #333;
11
+ }
12
+
13
+ p {
14
+ font-size: 1.2rem;
15
+ color: #666;
16
+ }
@@ -0,0 +1,22 @@
1
+ import { useState, useEffect } from 'react'
2
+ import './App.css'
3
+
4
+ function App() {
5
+ const [message, setMessage] = useState<string>('')
6
+
7
+ useEffect(() => {
8
+ fetch('/api/hello')
9
+ .then(res => res.json())
10
+ .then(data => setMessage(data.message))
11
+ .catch(err => console.error(err))
12
+ }, [])
13
+
14
+ return (
15
+ <div className="app">
16
+ <h1>{{projectName}}</h1>
17
+ <p>来自 FastAPI 后端的消息: {message || '加载中...'}</p>
18
+ </div>
19
+ )
20
+ }
21
+
22
+ export default App
@@ -0,0 +1,9 @@
1
+ import { StrictMode } from 'react'
2
+ import { createRoot } from 'react-dom/client'
3
+ import App from './App.tsx'
4
+
5
+ createRoot(document.getElementById('root')!).render(
6
+ <StrictMode>
7
+ <App />
8
+ </StrictMode>,
9
+ )
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "module": "ESNext",
7
+ "skipLibCheck": true,
8
+ "moduleResolution": "bundler",
9
+ "allowImportingTsExtensions": true,
10
+ "resolveJsonModule": true,
11
+ "isolatedModules": true,
12
+ "noEmit": true,
13
+ "jsx": "react-jsx",
14
+ "strict": true,
15
+ "noUnusedLocals": true,
16
+ "noUnusedParameters": true,
17
+ "noFallthroughCasesInSwitch": true
18
+ },
19
+ "include": ["src"]
20
+ }
@@ -0,0 +1,14 @@
1
+ import { defineConfig } from 'vite'
2
+ import react from '@vitejs/plugin-react'
3
+
4
+ export default defineConfig({
5
+ plugins: [react()],
6
+ server: {
7
+ proxy: {
8
+ '/api': {
9
+ target: 'http://localhost:8000',
10
+ changeOrigin: true
11
+ }
12
+ }
13
+ }
14
+ })
@@ -0,0 +1,35 @@
1
+ # {{projectName}}
2
+
3
+ Vue + Node.js 全栈项目 (pnpm workspace)
4
+
5
+ ## 项目结构
6
+
7
+ ```
8
+ {{projectName}}/
9
+ ├── frontend/ # Vue 3 前端 (Vite)
10
+ ├── backend/ # Express 后端
11
+ └── package.json # Workspace 根配置
12
+ ```
13
+
14
+ ## 开发
15
+
16
+ 同时启动前后端开发服务器:
17
+
18
+ ```bash
19
+ pnpm dev
20
+ ```
21
+
22
+ - 前端: http://localhost:5173
23
+ - 后端: http://localhost:3001
24
+
25
+ ## 构建
26
+
27
+ ```bash
28
+ pnpm build
29
+ ```
30
+
31
+ ## 测试
32
+
33
+ ```bash
34
+ pnpm test
35
+ ```
@@ -0,0 +1,7 @@
1
+ node_modules/
2
+ dist/
3
+ *.log
4
+ .DS_Store
5
+ .env
6
+ .env.local
7
+ coverage/
@@ -0,0 +1,14 @@
1
+ {
2
+ "description": "Vue + Node.js 全栈项目模板",
3
+ "packageManager": "pnpm",
4
+ "type": "workspace",
5
+ "postInit": [
6
+ {
7
+ "command": "pnpm install",
8
+ "description": "安装依赖"
9
+ }
10
+ ],
11
+ "fileRenames": {
12
+ "_gitignore": ".gitignore"
13
+ }
14
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "{{projectName}}-backend",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "tsx watch src/index.ts",
7
+ "build": "tsup",
8
+ "start": "node dist/index.js"
9
+ },
10
+ "dependencies": {
11
+ "cors": "^2.8.5",
12
+ "express": "^4.21.2"
13
+ },
14
+ "devDependencies": {
15
+ "@types/cors": "^2.8.17",
16
+ "@types/express": "^5.0.0",
17
+ "@types/node": "^22.10.7",
18
+ "tsup": "^8.3.5",
19
+ "tsx": "^4.19.2",
20
+ "typescript": "^5.7.3"
21
+ }
22
+ }
@@ -0,0 +1,20 @@
1
+ import express from 'express'
2
+ import cors from 'cors'
3
+
4
+ const app = express()
5
+ const PORT = process.env.PORT || 3001
6
+
7
+ app.use(cors())
8
+ app.use(express.json())
9
+
10
+ app.get('/api/health', (_req, res) => {
11
+ res.json({ status: 'ok' })
12
+ })
13
+
14
+ app.get('/api/hello', (_req, res) => {
15
+ res.json({ message: 'Hello from {{projectName}} backend!' })
16
+ })
17
+
18
+ app.listen(PORT, () => {
19
+ console.log(`Backend server is running on http://localhost:${PORT}`)
20
+ })
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "outDir": "./dist",
11
+ "rootDir": "./src",
12
+ "declaration": true,
13
+ "resolveJsonModule": true
14
+ },
15
+ "include": ["src/**/*"],
16
+ "exclude": ["node_modules", "dist"]
17
+ }
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from 'tsup'
2
+
3
+ export default defineConfig({
4
+ entry: ['src/index.ts'],
5
+ format: ['esm'],
6
+ target: 'node18',
7
+ clean: true,
8
+ dts: true
9
+ })
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>{{projectName}}</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="/src/main.ts"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "{{projectName}}-frontend",
3
+ "private": true,
4
+ "version": "0.1.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vue-tsc -b && vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "vue": "^3.5.13"
13
+ },
14
+ "devDependencies": {
15
+ "@vitejs/plugin-vue": "^5.2.1",
16
+ "typescript": "^5.7.3",
17
+ "vite": "^6.0.7",
18
+ "vue-tsc": "^2.2.0"
19
+ }
20
+ }
@@ -0,0 +1,41 @@
1
+ <script setup lang="ts">
2
+ import { ref, onMounted } from 'vue'
3
+
4
+ const message = ref<string>('')
5
+
6
+ onMounted(async () => {
7
+ try {
8
+ const res = await fetch('/api/hello')
9
+ const data = await res.json()
10
+ message.value = data.message
11
+ } catch (err) {
12
+ console.error(err)
13
+ }
14
+ })
15
+ </script>
16
+
17
+ <template>
18
+ <div class="app">
19
+ <h1>{{projectName}}</h1>
20
+ <p>来自后端的消息: {{ message || '加载中...' }}</p>
21
+ </div>
22
+ </template>
23
+
24
+ <style scoped>
25
+ .app {
26
+ max-width: 800px;
27
+ margin: 0 auto;
28
+ padding: 2rem;
29
+ text-align: center;
30
+ }
31
+
32
+ h1 {
33
+ font-size: 2.5rem;
34
+ color: #333;
35
+ }
36
+
37
+ p {
38
+ font-size: 1.2rem;
39
+ color: #666;
40
+ }
41
+ </style>
@@ -0,0 +1,4 @@
1
+ import { createApp } from 'vue'
2
+ import App from './App.vue'
3
+
4
+ createApp(App).mount('#app')
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "module": "ESNext",
6
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
7
+ "skipLibCheck": true,
8
+ "moduleResolution": "bundler",
9
+ "allowImportingTsExtensions": true,
10
+ "resolveJsonModule": true,
11
+ "isolatedModules": true,
12
+ "noEmit": true,
13
+ "jsx": "preserve",
14
+ "strict": true,
15
+ "noUnusedLocals": true,
16
+ "noUnusedParameters": true,
17
+ "noFallthroughCasesInSwitch": true
18
+ },
19
+ "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
20
+ }
@@ -0,0 +1,14 @@
1
+ import { defineConfig } from 'vite'
2
+ import vue from '@vitejs/plugin-vue'
3
+
4
+ export default defineConfig({
5
+ plugins: [vue()],
6
+ server: {
7
+ proxy: {
8
+ '/api': {
9
+ target: 'http://localhost:3001',
10
+ changeOrigin: true
11
+ }
12
+ }
13
+ }
14
+ })
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "pnpm -r --parallel dev",
7
+ "build": "pnpm -r build",
8
+ "test": "pnpm -r test"
9
+ }
10
+ }
@@ -0,0 +1,3 @@
1
+ packages:
2
+ - 'frontend'
3
+ - 'backend'
@@ -0,0 +1,26 @@
1
+ # {{projectName}}
2
+
3
+ Next.js + TypeScript 项目
4
+
5
+ ## 开发
6
+
7
+ ```bash
8
+ pnpm dev
9
+ ```
10
+
11
+ ## 构建
12
+
13
+ ```bash
14
+ pnpm build
15
+ ```
16
+
17
+ ## 运行生产版本
18
+
19
+ ```bash
20
+ pnpm start
21
+ ```
22
+
23
+ ## 了解更多
24
+
25
+ - [Next.js 文档](https://nextjs.org/docs)
26
+ - [Learn Next.js](https://nextjs.org/learn)
@@ -0,0 +1,34 @@
1
+ # dependencies
2
+ node_modules/
3
+ .pnp/
4
+ .pnp.js
5
+
6
+ # testing
7
+ coverage/
8
+
9
+ # next.js
10
+ .next/
11
+ out/
12
+
13
+ # production
14
+ build/
15
+
16
+ # misc
17
+ .DS_Store
18
+ *.pem
19
+
20
+ # debug
21
+ npm-debug.log*
22
+ yarn-debug.log*
23
+ yarn-error.log*
24
+
25
+ # local env files
26
+ .env*.local
27
+ .env
28
+
29
+ # vercel
30
+ .vercel
31
+
32
+ # typescript
33
+ *.tsbuildinfo
34
+ next-env.d.ts
@@ -0,0 +1,13 @@
1
+ {
2
+ "description": "Next.js + TypeScript 项目模板",
3
+ "packageManager": "pnpm",
4
+ "postInit": [
5
+ {
6
+ "command": "pnpm install",
7
+ "description": "安装依赖"
8
+ }
9
+ ],
10
+ "fileRenames": {
11
+ "_gitignore": ".gitignore"
12
+ }
13
+ }
@@ -0,0 +1,7 @@
1
+ import type { NextConfig } from 'next'
2
+
3
+ const nextConfig: NextConfig = {
4
+ /* config options here */
5
+ }
6
+
7
+ export default nextConfig
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "next dev",
7
+ "build": "next build",
8
+ "start": "next start",
9
+ "lint": "next lint"
10
+ },
11
+ "dependencies": {
12
+ "next": "^14.2.21",
13
+ "react": "^18.3.1",
14
+ "react-dom": "^18.3.1"
15
+ },
16
+ "devDependencies": {
17
+ "@types/node": "^22.10.7",
18
+ "@types/react": "^18.3.18",
19
+ "@types/react-dom": "^18.3.5",
20
+ "typescript": "^5.7.3"
21
+ }
22
+ }
@@ -0,0 +1,21 @@
1
+ * {
2
+ box-sizing: border-box;
3
+ padding: 0;
4
+ margin: 0;
5
+ }
6
+
7
+ html,
8
+ body {
9
+ max-width: 100vw;
10
+ overflow-x: hidden;
11
+ }
12
+
13
+ body {
14
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
15
+ Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
16
+ }
17
+
18
+ a {
19
+ color: inherit;
20
+ text-decoration: none;
21
+ }
@@ -0,0 +1,19 @@
1
+ import type { Metadata } from 'next'
2
+ import './globals.css'
3
+
4
+ export const metadata: Metadata = {
5
+ title: '{{projectName}}',
6
+ description: 'Created with spec-go',
7
+ }
8
+
9
+ export default function RootLayout({
10
+ children,
11
+ }: {
12
+ children: React.ReactNode
13
+ }) {
14
+ return (
15
+ <html lang="zh-CN">
16
+ <body>{children}</body>
17
+ </html>
18
+ )
19
+ }
@@ -0,0 +1,10 @@
1
+ export default function Home() {
2
+ return (
3
+ <main className="flex min-h-screen flex-col items-center justify-center p-24">
4
+ <h1 className="text-4xl font-bold">欢迎来到 {{projectName}}</h1>
5
+ <p className="mt-4 text-lg text-gray-600">
6
+ 开始编辑 <code className="bg-gray-100 px-2 py-1 rounded">src/app/page.tsx</code>
7
+ </p>
8
+ </main>
9
+ )
10
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2017",
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "allowJs": true,
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "noEmit": true,
9
+ "esModuleInterop": true,
10
+ "module": "esnext",
11
+ "moduleResolution": "bundler",
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "jsx": "preserve",
15
+ "incremental": true,
16
+ "plugins": [
17
+ {
18
+ "name": "next"
19
+ }
20
+ ],
21
+ "paths": {
22
+ "@/*": ["./src/*"]
23
+ }
24
+ },
25
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
26
+ "exclude": ["node_modules"]
27
+ }
@@ -0,0 +1,21 @@
1
+ # {{projectName}}
2
+
3
+ Node.js + TypeScript 项目
4
+
5
+ ## 开发
6
+
7
+ ```bash
8
+ pnpm dev
9
+ ```
10
+
11
+ ## 构建
12
+
13
+ ```bash
14
+ pnpm build
15
+ ```
16
+
17
+ ## 测试
18
+
19
+ ```bash
20
+ pnpm test
21
+ ```
@@ -0,0 +1,7 @@
1
+ node_modules/
2
+ dist/
3
+ *.log
4
+ .DS_Store
5
+ .env
6
+ .env.local
7
+ coverage/
@@ -0,0 +1,16 @@
1
+ {
2
+ "description": "Node.js + TypeScript 项目模板",
3
+ "packageManager": "pnpm",
4
+ "postInit": [
5
+ {
6
+ "command": "pnpm install",
7
+ "description": "安装依赖"
8
+ }
9
+ ],
10
+ "variables": {
11
+ "PROJECT_NAME": "{{projectName}}"
12
+ },
13
+ "fileRenames": {
14
+ "_gitignore": ".gitignore"
15
+ }
16
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "tsx watch src/index.ts",
7
+ "build": "tsup",
8
+ "start": "node dist/index.js",
9
+ "test": "vitest",
10
+ "test:run": "vitest run"
11
+ },
12
+ "devDependencies": {
13
+ "@types/node": "^22.10.7",
14
+ "tsup": "^8.3.5",
15
+ "tsx": "^4.19.2",
16
+ "typescript": "^5.7.3",
17
+ "vitest": "^3.0.4"
18
+ }
19
+ }
@@ -0,0 +1 @@
1
+ console.log('Hello from {{projectName}}!')
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "outDir": "./dist",
11
+ "rootDir": "./src",
12
+ "declaration": true,
13
+ "resolveJsonModule": true
14
+ },
15
+ "include": ["src/**/*"],
16
+ "exclude": ["node_modules", "dist"]
17
+ }
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from 'tsup'
2
+
3
+ export default defineConfig({
4
+ entry: ['src/index.ts'],
5
+ format: ['esm'],
6
+ target: 'node18',
7
+ clean: true,
8
+ dts: true
9
+ })