@guchen_0521/template 0.1.0 → 0.1.1

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 (41) hide show
  1. package/package.json +1 -3
  2. package/backend/express/express-no-ts/PROJECT_STRUCTURE.md +0 -23
  3. package/backend/express/express-no-ts/app.js +0 -19
  4. package/backend/express/express-no-ts/bin/www +0 -86
  5. package/backend/express/express-no-ts/docker-compose.yml +0 -33
  6. package/backend/express/express-no-ts/package.json +0 -19
  7. package/backend/express/express-no-ts/routes/index.js +0 -11
  8. package/front/web/vue3/vue3-no-ts/.env +0 -0
  9. package/front/web/vue3/vue3-no-ts/.prettierrc.json +0 -6
  10. package/front/web/vue3/vue3-no-ts/.vscode/extensions.json +0 -6
  11. package/front/web/vue3/vue3-no-ts/PROJECT_STRUCTURE.md +0 -59
  12. package/front/web/vue3/vue3-no-ts/index.html +0 -13
  13. package/front/web/vue3/vue3-no-ts/jsconfig.json +0 -8
  14. package/front/web/vue3/vue3-no-ts/package.json +0 -26
  15. package/front/web/vue3/vue3-no-ts/public/favicon.ico +0 -0
  16. package/front/web/vue3/vue3-no-ts/src/App.vue +0 -7
  17. package/front/web/vue3/vue3-no-ts/src/assets/styles/base.css +0 -0
  18. package/front/web/vue3/vue3-no-ts/src/assets/styles/index.css +0 -0
  19. package/front/web/vue3/vue3-no-ts/src/assets/styles/variables.css +0 -0
  20. package/front/web/vue3/vue3-no-ts/src/components/common/template/constants.js +0 -0
  21. package/front/web/vue3/vue3-no-ts/src/components/common/template/index.vue +0 -0
  22. package/front/web/vue3/vue3-no-ts/src/main.js +0 -12
  23. package/front/web/vue3/vue3-no-ts/src/router/index.js +0 -8
  24. package/front/web/vue3/vue3-no-ts/src/utils/request.js +0 -0
  25. package/front/web/vue3/vue3-no-ts/src/views/view-template/constants.js +0 -0
  26. package/front/web/vue3/vue3-no-ts/src/views/view-template/index.vue +0 -0
  27. package/front/web/vue3/vue3-no-ts/vite.config.js +0 -18
  28. package/front/web/vue3/vue3-ts/.prettierrc.json +0 -6
  29. package/front/web/vue3/vue3-ts/.vscode/extensions.json +0 -6
  30. package/front/web/vue3/vue3-ts/README.md +0 -42
  31. package/front/web/vue3/vue3-ts/env.d.ts +0 -1
  32. package/front/web/vue3/vue3-ts/index.html +0 -13
  33. package/front/web/vue3/vue3-ts/package.json +0 -34
  34. package/front/web/vue3/vue3-ts/public/favicon.ico +0 -0
  35. package/front/web/vue3/vue3-ts/src/App.vue +0 -7
  36. package/front/web/vue3/vue3-ts/src/main.ts +0 -12
  37. package/front/web/vue3/vue3-ts/src/router/index.ts +0 -8
  38. package/front/web/vue3/vue3-ts/tsconfig.app.json +0 -12
  39. package/front/web/vue3/vue3-ts/tsconfig.json +0 -11
  40. package/front/web/vue3/vue3-ts/tsconfig.node.json +0 -19
  41. package/front/web/vue3/vue3-ts/vite.config.ts +0 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guchen_0521/template",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Project scaffolding CLI for local templates",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,8 +9,6 @@
9
9
  "files": [
10
10
  "bin",
11
11
  "lib",
12
- "backend",
13
- "front",
14
12
  "README.md",
15
13
  "LICENSE"
16
14
  ],
@@ -1,23 +0,0 @@
1
- # 项目结构说明
2
-
3
- ```text
4
- .
5
- |-- app.js - Express 应用入口(中间件与路由挂载)
6
- |-- bin/ - 启动脚本目录
7
- | |-- www - 服务器启动脚本(读取端口并启动 HTTP)
8
- |-- config/ - 配置文件目录(数据库/缓存/第三方等)
9
- |-- controllers/ - 控制器目录(请求/响应逻辑)
10
- |-- middlewares/ - 中间件目录(鉴权/日志/限流等)
11
- |-- models/ - 数据模型目录(数据库模型/ORM)
12
- |-- node_modules/ - 依赖安装目录(不手改)
13
- |-- public/ - 静态资源目录(图片/前端构建产物等)
14
- |-- routes/ - 路由目录
15
- | |-- index.js - 路由入口示例
16
- |-- services/ - 业务服务目录(可复用业务逻辑)
17
- |-- utils/ - 工具函数目录
18
- |-- validators/ - 参数校验/规则目录
19
- |-- .env - 本地环境变量文件
20
- |-- docker-compose.yml - 本地依赖服务编排(MySQL/Redis)
21
- |-- package.json - 项目依赖与脚本
22
- `-- package-lock.json - 依赖版本锁定
23
- ```
@@ -1,19 +0,0 @@
1
- const express = require("express");
2
- const path = require("path");
3
- const cookieParser = require("cookie-parser");
4
- const logger = require("morgan");
5
- const cors = require('cors')
6
-
7
- const indexRouter = require("./routes/index");
8
-
9
- const app = express();
10
- app.use(cors()) // 默认所有
11
- app.use(logger("dev"));
12
- app.use(express.json());
13
- app.use(express.urlencoded({ extended: false }));
14
- app.use(cookieParser());
15
- app.use(express.static(path.join(__dirname, "public")));
16
-
17
- app.use("/", indexRouter);
18
-
19
- module.exports = app;
@@ -1,86 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * 依赖模块。
5
- */
6
-
7
- const app = require("../app");
8
- const debug = require("debug")("abc:server");
9
- const http = require("http");
10
-
11
- /**
12
- * 从环境变量读取端口并写入 Express 配置。
13
- */
14
-
15
- const port = normalizePort(process.env.PORT || "3000");
16
- app.set("port", port);
17
-
18
- /**
19
- * 创建 HTTP 服务器。
20
- */
21
-
22
- const server = http.createServer(app);
23
-
24
- /**
25
- * 监听指定端口,绑定所有网卡。
26
- */
27
-
28
- server.listen(port);
29
- server.on("error", onError);
30
- server.on("listening", onListening);
31
-
32
- /**
33
- * 规范化端口值,返回数字、字符串或 false。
34
- */
35
-
36
- function normalizePort(val) {
37
- const port = parseInt(val, 10);
38
-
39
- if (isNaN(port)) {
40
- // 命名管道
41
- return val;
42
- }
43
-
44
- if (port >= 0) {
45
- // 端口号
46
- return port;
47
- }
48
-
49
- return false;
50
- }
51
-
52
- /**
53
- * HTTP 服务器 "error" 事件监听器。
54
- */
55
-
56
- function onError(error) {
57
- if (error.syscall !== "listen") {
58
- throw error;
59
- }
60
-
61
- const bind = typeof port === "string" ? "Pipe " + port : "Port " + port;
62
-
63
- // 针对常见监听错误给出友好提示
64
- switch (error.code) {
65
- case "EACCES":
66
- console.error(bind + " requires elevated privileges");
67
- process.exit(1);
68
- break;
69
- case "EADDRINUSE":
70
- console.error(bind + " is already in use");
71
- process.exit(1);
72
- break;
73
- default:
74
- throw error;
75
- }
76
- }
77
-
78
- /**
79
- * HTTP 服务器 "listening" 事件监听器。
80
- */
81
-
82
- function onListening() {
83
- const addr = server.address();
84
- const bind = typeof addr === "string" ? "pipe " + addr : "port " + addr.port;
85
- debug("Listening on " + bind);
86
- }
@@ -1,33 +0,0 @@
1
- services:
2
- mysql:
3
- image: mysql:8.3.0
4
- command:
5
- - --default-authentication-plugin=mysql_native_password
6
- - --character-set-server=utf8mb4
7
- - --collation-server=utf8mb4_general_ci
8
- environment:
9
- MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-123456}
10
- MYSQL_LOWER_CASE_TABLE_NAMES: ${MYSQL_LOWER_CASE_TABLE_NAMES:-0}
11
- ports:
12
- - "${MYSQL_PORT:-3306}:3306"
13
- volumes:
14
- - ./data/mysql:/var/lib/mysql
15
- restart: unless-stopped
16
- healthcheck:
17
- test: ["CMD-SHELL", "mysqladmin ping -h 127.0.0.1 -p$${MYSQL_ROOT_PASSWORD} --silent"]
18
- interval: 10s
19
- timeout: 5s
20
- retries: 5
21
- start_period: 20s
22
- redis:
23
- image: redis:7.4
24
- ports:
25
- - "${REDIS_PORT:-6379}:6379"
26
- volumes:
27
- - ./data/redis:/data
28
- restart: unless-stopped
29
- healthcheck:
30
- test: ["CMD", "redis-cli", "ping"]
31
- interval: 10s
32
- timeout: 5s
33
- retries: 5
@@ -1,19 +0,0 @@
1
- {
2
- "name": "abc",
3
- "version": "0.0.0",
4
- "private": true,
5
- "scripts": {
6
- "dev": "nodemon ./bin/www",
7
- "start": "node ./bin/www"
8
- },
9
- "dependencies": {
10
- "cookie-parser": "~1.4.4",
11
- "cors": "^2.8.5",
12
- "debug": "4.4.3",
13
- "express": "5.2.1",
14
- "morgan": "^1.10.1"
15
- },
16
- "devDependencies": {
17
- "nodemon": "^3.1.0"
18
- }
19
- }
@@ -1,11 +0,0 @@
1
- const express = require("express");
2
-
3
- const router = express.Router();
4
-
5
- router.get("/", (req, res) => {
6
- res.json({
7
- title: "接口测试",
8
- });
9
- });
10
-
11
- module.exports = router;
File without changes
@@ -1,6 +0,0 @@
1
- {
2
- "$schema": "https://json.schemastore.org/prettierrc",
3
- "semi": false,
4
- "singleQuote": true,
5
- "printWidth": 100
6
- }
@@ -1,6 +0,0 @@
1
- {
2
- "recommendations": [
3
- "Vue.volar",
4
- "prettier.prettier-vscode"
5
- ]
6
- }
@@ -1,59 +0,0 @@
1
- # 项目结构说明
2
-
3
- ```text
4
- .
5
- |-- .env - 本地环境变量文件
6
- |-- .gitignore - Git 忽略规则
7
- |-- .prettierrc.json - Prettier 配置
8
- |-- index.html - 应用入口 HTML
9
- |-- jsconfig.json - JS 路径别名/类型提示
10
- |-- package.json - 项目依赖与脚本
11
- |-- pnpm-lock.yaml - 依赖版本锁定
12
- |-- PROJECT_STRUCTURE.md - 项目结构说明
13
- |-- public/ - 静态资源目录(不会被 Vite 处理)
14
- | `-- favicon.ico - 站点图标
15
- |-- src/ - 源码目录
16
- | |-- App.vue - 根组件
17
- | |-- main.js - 应用入口
18
- | |-- apis/ - 接口请求封装
19
- | |-- assets/ - 需要打包处理的静态资源
20
- | | |-- fonts/ - 字体资源
21
- | | |-- icons/ - 图标资源
22
- | | |-- images/ - 图片资源
23
- | | `-- styles/ - 全局样式入口
24
- | | |-- base.css - 基础样式
25
- | | |-- index.css - 样式入口
26
- | | `-- variables.css - 变量定义
27
- | |-- components/ - 组件目录
28
- | | `-- common/ - 通用组件
29
- | | `-- template/ - 组件模板
30
- | | |-- constants.js - 常量定义
31
- | | |-- index.vue - 模板组件
32
- | | |-- components/ - 子组件目录
33
- | | |-- composables/ - 模板组合式函数
34
- | | |-- styles/ - 模板样式
35
- | | `-- utils/ - 模板工具函数
36
- | |-- composables/ - 组合式函数目录
37
- | |-- config/ - 运行配置与常量聚合
38
- | |-- constants/ - 常量/枚举定义
39
- | |-- directives/ - 自定义指令
40
- | |-- layouts/ - 布局组件目录
41
- | |-- plugins/ - 插件注册(如 UI 库/全局能力)
42
- | |-- router/ - 路由配置
43
- | | |-- index.js - 路由入口
44
- | | `-- modules/ - 模块化路由
45
- | |-- services/ - 业务服务与复用逻辑
46
- | |-- stores/ - 状态管理(Pinia)
47
- | |-- utils/ - 工具函数目录
48
- | | `-- request.js - 请求封装
49
- | `-- views/ - 页面级组件目录
50
- | `-- view-template/ - 页面模板
51
- | |-- constants.js - 常量定义
52
- | |-- index.vue - 模板页面
53
- | |-- components/ - 页面子组件
54
- | |-- composables/ - 页面组合式函数
55
- | |-- styles/ - 页面样式
56
- | `-- utils/ - 页面工具函数
57
- |-- vite.config.js - Vite 配置
58
- `-- node_modules/ - 依赖安装目录(不手改)
59
- ```
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="">
3
- <head>
4
- <meta charset="UTF-8">
5
- <link rel="icon" href="/favicon.ico">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>Vite App</title>
8
- </head>
9
- <body>
10
- <div id="app"></div>
11
- <script type="module" src="/src/main.js"></script>
12
- </body>
13
- </html>
@@ -1,8 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "paths": {
4
- "@/*": ["./src/*"]
5
- }
6
- },
7
- "exclude": ["node_modules", "dist"]
8
- }
@@ -1,26 +0,0 @@
1
- {
2
- "name": "vue3-template-no-ts",
3
- "version": "0.0.0",
4
- "private": true,
5
- "type": "module",
6
- "engines": {
7
- "node": "^20.19.0 || >=22.12.0"
8
- },
9
- "scripts": {
10
- "dev": "vite",
11
- "build": "vite build",
12
- "preview": "vite preview",
13
- "format": "prettier --write --experimental-cli src/"
14
- },
15
- "dependencies": {
16
- "pinia": "^3.0.4",
17
- "vue": "^3.5.26",
18
- "vue-router": "^4.6.4"
19
- },
20
- "devDependencies": {
21
- "@vitejs/plugin-vue": "^6.0.3",
22
- "prettier": "3.7.4",
23
- "vite": "^7.3.0",
24
- "vite-plugin-vue-devtools": "^8.0.5"
25
- }
26
- }
@@ -1,7 +0,0 @@
1
- <script setup></script>
2
-
3
- <template>
4
- <h1>这是App.vue根组件</h1>
5
- </template>
6
-
7
- <style scoped></style>
@@ -1,12 +0,0 @@
1
- import { createApp } from 'vue'
2
- import { createPinia } from 'pinia'
3
-
4
- import App from './App.vue'
5
- import router from './router'
6
-
7
- const app = createApp(App)
8
-
9
- app.use(createPinia())
10
- app.use(router)
11
-
12
- app.mount('#app')
@@ -1,8 +0,0 @@
1
- import { createRouter, createWebHistory } from 'vue-router'
2
-
3
- const router = createRouter({
4
- history: createWebHistory(import.meta.env.BASE_URL),
5
- routes: [], // 需要从./modules/中导入模块路由,如用户验证模块拆分到auth.js中再导入到这里,一定要合理拆分
6
- })
7
-
8
- export default router
File without changes
@@ -1,18 +0,0 @@
1
- import { fileURLToPath, URL } from 'node:url'
2
-
3
- import { defineConfig } from 'vite'
4
- import vue from '@vitejs/plugin-vue'
5
- import vueDevTools from 'vite-plugin-vue-devtools'
6
-
7
- // https://vite.dev/config/
8
- export default defineConfig({
9
- plugins: [
10
- vue(),
11
- vueDevTools(),
12
- ],
13
- resolve: {
14
- alias: {
15
- '@': fileURLToPath(new URL('./src', import.meta.url))
16
- },
17
- },
18
- })
@@ -1,6 +0,0 @@
1
- {
2
- "$schema": "https://json.schemastore.org/prettierrc",
3
- "semi": false,
4
- "singleQuote": true,
5
- "printWidth": 100
6
- }
@@ -1,6 +0,0 @@
1
- {
2
- "recommendations": [
3
- "Vue.volar",
4
- "prettier.prettier-vscode"
5
- ]
6
- }
@@ -1,42 +0,0 @@
1
- # vue3-template-ts
2
-
3
- This template should help get you started developing with Vue 3 in Vite.
4
-
5
- ## Recommended IDE Setup
6
-
7
- [VS Code](https://code.visualstudio.com/) + [Vue (Official)](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
8
-
9
- ## Recommended Browser Setup
10
-
11
- - Chromium-based browsers (Chrome, Edge, Brave, etc.):
12
- - [Vue.js devtools](https://chromewebstore.google.com/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd)
13
- - [Turn on Custom Object Formatter in Chrome DevTools](http://bit.ly/object-formatters)
14
- - Firefox:
15
- - [Vue.js devtools](https://addons.mozilla.org/en-US/firefox/addon/vue-js-devtools/)
16
- - [Turn on Custom Object Formatter in Firefox DevTools](https://fxdx.dev/firefox-devtools-custom-object-formatters/)
17
-
18
- ## Type Support for `.vue` Imports in TS
19
-
20
- TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.
21
-
22
- ## Customize configuration
23
-
24
- See [Vite Configuration Reference](https://vite.dev/config/).
25
-
26
- ## Project Setup
27
-
28
- ```sh
29
- pnpm install
30
- ```
31
-
32
- ### Compile and Hot-Reload for Development
33
-
34
- ```sh
35
- pnpm dev
36
- ```
37
-
38
- ### Type-Check, Compile and Minify for Production
39
-
40
- ```sh
41
- pnpm build
42
- ```
@@ -1 +0,0 @@
1
- /// <reference types="vite/client" />
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="">
3
- <head>
4
- <meta charset="UTF-8">
5
- <link rel="icon" href="/favicon.ico">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>Vite App</title>
8
- </head>
9
- <body>
10
- <div id="app"></div>
11
- <script type="module" src="/src/main.ts"></script>
12
- </body>
13
- </html>
@@ -1,34 +0,0 @@
1
- {
2
- "name": "vue3-template-ts",
3
- "version": "0.0.0",
4
- "private": true,
5
- "type": "module",
6
- "engines": {
7
- "node": "^20.19.0 || >=22.12.0"
8
- },
9
- "scripts": {
10
- "dev": "vite",
11
- "build": "run-p type-check \"build-only {@}\" --",
12
- "preview": "vite preview",
13
- "build-only": "vite build",
14
- "type-check": "vue-tsc --build",
15
- "format": "prettier --write --experimental-cli src/"
16
- },
17
- "dependencies": {
18
- "pinia": "^3.0.4",
19
- "vue": "^3.5.26",
20
- "vue-router": "^4.6.4"
21
- },
22
- "devDependencies": {
23
- "@tsconfig/node24": "^24.0.3",
24
- "@types/node": "^24.10.4",
25
- "@vitejs/plugin-vue": "^6.0.3",
26
- "@vue/tsconfig": "^0.8.1",
27
- "npm-run-all2": "^8.0.4",
28
- "prettier": "3.7.4",
29
- "typescript": "~5.9.3",
30
- "vite": "^7.3.0",
31
- "vite-plugin-vue-devtools": "^8.0.5",
32
- "vue-tsc": "^3.2.1"
33
- }
34
- }
@@ -1,7 +0,0 @@
1
- <script setup lang="ts"></script>
2
-
3
- <template>
4
- <div>App根组件</div>
5
- </template>
6
-
7
- <style scoped></style>
@@ -1,12 +0,0 @@
1
- import { createApp } from 'vue'
2
- import { createPinia } from 'pinia'
3
-
4
- import App from './App.vue'
5
- import router from './router'
6
-
7
- const app = createApp(App)
8
-
9
- app.use(createPinia())
10
- app.use(router)
11
-
12
- app.mount('#app')
@@ -1,8 +0,0 @@
1
- import { createRouter, createWebHistory } from 'vue-router'
2
-
3
- const router = createRouter({
4
- history: createWebHistory(import.meta.env.BASE_URL),
5
- routes: [],
6
- })
7
-
8
- export default router
@@ -1,12 +0,0 @@
1
- {
2
- "extends": "@vue/tsconfig/tsconfig.dom.json",
3
- "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
4
- "exclude": ["src/**/__tests__/*"],
5
- "compilerOptions": {
6
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
7
-
8
- "paths": {
9
- "@/*": ["./src/*"]
10
- }
11
- }
12
- }
@@ -1,11 +0,0 @@
1
- {
2
- "files": [],
3
- "references": [
4
- {
5
- "path": "./tsconfig.node.json"
6
- },
7
- {
8
- "path": "./tsconfig.app.json"
9
- }
10
- ]
11
- }
@@ -1,19 +0,0 @@
1
- {
2
- "extends": "@tsconfig/node24/tsconfig.json",
3
- "include": [
4
- "vite.config.*",
5
- "vitest.config.*",
6
- "cypress.config.*",
7
- "nightwatch.conf.*",
8
- "playwright.config.*",
9
- "eslint.config.*"
10
- ],
11
- "compilerOptions": {
12
- "noEmit": true,
13
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
14
-
15
- "module": "ESNext",
16
- "moduleResolution": "Bundler",
17
- "types": ["node"]
18
- }
19
- }
@@ -1,18 +0,0 @@
1
- import { fileURLToPath, URL } from 'node:url'
2
-
3
- import { defineConfig } from 'vite'
4
- import vue from '@vitejs/plugin-vue'
5
- import vueDevTools from 'vite-plugin-vue-devtools'
6
-
7
- // https://vite.dev/config/
8
- export default defineConfig({
9
- plugins: [
10
- vue(),
11
- vueDevTools(),
12
- ],
13
- resolve: {
14
- alias: {
15
- '@': fileURLToPath(new URL('./src', import.meta.url))
16
- },
17
- },
18
- })