moyan-mfw-cli 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 +12 -61
- package/dist/index.cjs +35 -16
- package/dist/index.js +34 -14
- package/dist/templates/business/backend/.env.hbs +17 -0
- package/dist/templates/business/backend/nest-cli.json.hbs +10 -0
- package/dist/templates/business/backend/package.json.hbs +37 -0
- package/dist/templates/business/backend/src/app-types.config.ts.hbs +3 -0
- package/dist/templates/business/backend/src/app.modules.ts.hbs +7 -0
- package/dist/templates/business/backend/src/main.ts.hbs +46 -0
- package/dist/templates/business/backend/src/permissions.ts.hbs +4 -0
- package/dist/templates/business/backend/tsconfig.json.hbs +18 -0
- package/dist/templates/business/frontend/index.html.hbs +35 -0
- package/dist/templates/business/frontend/package.json.hbs +32 -0
- package/dist/templates/business/frontend/src/main.ts.hbs +28 -0
- package/dist/templates/business/frontend/src/permissions.ts.hbs +4 -0
- package/dist/templates/business/frontend/src/router.ts.hbs +9 -0
- package/dist/templates/business/frontend/src/views/dashboard/Index.vue.hbs +93 -0
- package/dist/templates/business/frontend/src/views/dashboard/index.ts.hbs +11 -0
- package/dist/templates/business/frontend/tsconfig.json.hbs +19 -0
- package/dist/templates/business/frontend/vite.config.ts.hbs +27 -0
- package/dist/templates/business/package.json.hbs +17 -0
- package/dist/templates/business/pnpm-workspace.yaml.hbs +35 -0
- package/dist/templates/business/shared/package.json.hbs +34 -0
- package/dist/templates/business/shared/src/index.ts.hbs +1 -0
- package/dist/templates/business/shared/src/permissions.ts.hbs +3 -0
- package/dist/templates/business/shared/tsconfig.cjs.json.hbs +13 -0
- package/dist/templates/business/shared/tsconfig.json.hbs +13 -0
- package/dist/templates/business/tsconfig.base.json.hbs +12 -0
- package/dist/templates/extension/README.md.hbs +27 -0
- package/dist/templates/extension/backend/.env.hbs +10 -0
- package/dist/templates/extension/backend/nest-cli.json.hbs +1 -0
- package/dist/templates/extension/backend/package.json.hbs +1 -0
- package/dist/templates/extension/backend/src/controller/.gitkeep +0 -0
- package/dist/templates/extension/backend/src/dto/.gitkeep +0 -0
- package/dist/templates/extension/backend/src/entities/.gitkeep +0 -0
- package/dist/templates/extension/backend/src/index.ts.hbs +1 -0
- package/dist/templates/extension/backend/src/main.ts.hbs +34 -0
- package/dist/templates/extension/backend/src/service/.gitkeep +0 -0
- package/dist/templates/extension/backend/src/{{name}}.module.ts.hbs +4 -0
- package/dist/templates/extension/backend/tsconfig.json.hbs +1 -0
- package/dist/templates/extension/frontend/api.build.cjs.hbs +8 -0
- package/dist/templates/extension/frontend/index.html.hbs +12 -0
- package/dist/templates/extension/frontend/package.json.hbs +1 -0
- package/dist/templates/extension/frontend/src/apis/.gitkeep +0 -0
- package/dist/templates/extension/frontend/src/components/.gitkeep +0 -0
- package/dist/templates/extension/frontend/src/env.d.ts.hbs +1 -0
- package/dist/templates/extension/frontend/src/index.ts.hbs +13 -0
- package/dist/templates/extension/frontend/src/main.ts.hbs +13 -0
- package/dist/templates/extension/frontend/src/views/.gitkeep +0 -0
- package/dist/templates/extension/frontend/tsconfig.json.hbs +1 -0
- package/dist/templates/extension/frontend/vite.config.mts.hbs +30 -0
- package/dist/templates/extension/package.json.hbs +1 -0
- package/dist/templates/extension/shared/package.json.hbs +1 -0
- package/dist/templates/extension/shared/src/constants.ts.hbs +12 -0
- package/dist/templates/extension/shared/src/dict.ts.hbs +8 -0
- package/dist/templates/extension/shared/src/index.ts.hbs +10 -0
- package/dist/templates/extension/shared/src/paths.ts.hbs +5 -0
- package/dist/templates/extension/shared/src/permission-values.ts.hbs +3 -0
- package/dist/templates/extension/shared/src/types.ts.hbs +5 -0
- package/dist/templates/extension/shared/tsconfig.json.hbs +1 -0
- package/dist/templates/extension/tsconfig.json.hbs +1 -0
- package/package.json +52 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="dashboard">
|
|
3
|
+
<el-card class="welcome-card">
|
|
4
|
+
<h1>欢迎使用 {{displayName}}</h1>
|
|
5
|
+
<p>基于 Moyan MFW 框架构建的管理后台</p>
|
|
6
|
+
</el-card>
|
|
7
|
+
|
|
8
|
+
<el-row :gutter="16" class="stats-row">
|
|
9
|
+
<el-col :span="8">
|
|
10
|
+
<el-card shadow="hover">
|
|
11
|
+
<div class="stat-item">
|
|
12
|
+
<div class="stat-label">后端服务</div>
|
|
13
|
+
<div class="stat-value" style="color: #22c55e">运行中</div>
|
|
14
|
+
</div>
|
|
15
|
+
</el-card>
|
|
16
|
+
</el-col>
|
|
17
|
+
<el-col :span="8">
|
|
18
|
+
<el-card shadow="hover">
|
|
19
|
+
<div class="stat-item">
|
|
20
|
+
<div class="stat-label">API 端点</div>
|
|
21
|
+
<div class="stat-value" v-text="apiCount"></div>
|
|
22
|
+
</div>
|
|
23
|
+
</el-card>
|
|
24
|
+
</el-col>
|
|
25
|
+
<el-col :span="8">
|
|
26
|
+
<el-card shadow="hover">
|
|
27
|
+
<div class="stat-item">
|
|
28
|
+
<div class="stat-label">框架版本</div>
|
|
29
|
+
<div class="stat-value">1.0.0</div>
|
|
30
|
+
</div>
|
|
31
|
+
</el-card>
|
|
32
|
+
</el-col>
|
|
33
|
+
</el-row>
|
|
34
|
+
|
|
35
|
+
<el-card class="quick-start-card">
|
|
36
|
+
<template #header>
|
|
37
|
+
<span>快速开始</span>
|
|
38
|
+
</template>
|
|
39
|
+
<el-steps :active="2" finish-status="success">
|
|
40
|
+
<el-step title="创建项目" description="通过 mfw CLI 初始化" />
|
|
41
|
+
<el-step title="添加模块" description="使用 plop 生成业务模块" />
|
|
42
|
+
<el-step title="集成扩展" description="在 AppModule 中引入扩展模块" />
|
|
43
|
+
<el-step title="部署上线" description="构建并发布到生产环境" />
|
|
44
|
+
</el-steps>
|
|
45
|
+
</el-card>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script setup lang="ts">
|
|
50
|
+
const apiCount = 0
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<style scoped>
|
|
54
|
+
.dashboard {
|
|
55
|
+
padding: 16px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.welcome-card {
|
|
59
|
+
margin-bottom: 16px;
|
|
60
|
+
text-align: center;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.welcome-card h1 {
|
|
64
|
+
font-size: 24px;
|
|
65
|
+
color: #1e293b;
|
|
66
|
+
margin-bottom: 8px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.welcome-card p {
|
|
70
|
+
color: #64748b;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.stats-row {
|
|
74
|
+
margin-bottom: 16px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.stat-item {
|
|
78
|
+
text-align: center;
|
|
79
|
+
padding: 12px 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.stat-label {
|
|
83
|
+
font-size: 13px;
|
|
84
|
+
color: #94a3b8;
|
|
85
|
+
margin-bottom: 4px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.stat-value {
|
|
89
|
+
font-size: 28px;
|
|
90
|
+
font-weight: 700;
|
|
91
|
+
color: #3b82f6;
|
|
92
|
+
}
|
|
93
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
+
"jsx": "preserve",
|
|
8
|
+
"jsxImportSource": "vue",
|
|
9
|
+
"noEmit": true,
|
|
10
|
+
"declaration": false,
|
|
11
|
+
"types": ["vite/client", "node"],
|
|
12
|
+
"baseUrl": ".",
|
|
13
|
+
"paths": {
|
|
14
|
+
"@/*": ["./src/*"]
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "src/**/*.d.ts"],
|
|
18
|
+
"exclude": ["node_modules"]
|
|
19
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import vue from '@vitejs/plugin-vue'
|
|
3
|
+
import vueJsx from '@vitejs/plugin-vue-jsx'
|
|
4
|
+
import { resolve } from 'path'
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
root: '.',
|
|
8
|
+
plugins: [vue(), vueJsx()],
|
|
9
|
+
resolve: {
|
|
10
|
+
alias: {
|
|
11
|
+
'@': resolve(__dirname, 'src'),
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
server: {
|
|
15
|
+
port: {{frontendPort}},
|
|
16
|
+
proxy: {
|
|
17
|
+
'/api': {
|
|
18
|
+
target: 'http://localhost:{{port}}',
|
|
19
|
+
changeOrigin: true,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
build: {
|
|
24
|
+
outDir: 'dist',
|
|
25
|
+
target: 'es2022',
|
|
26
|
+
},
|
|
27
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "{{description}}",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"preinstall": "npx only-allow pnpm",
|
|
8
|
+
"build": "pnpm run -r build",
|
|
9
|
+
"typecheck": "tsc --noEmit --project tsconfig.json",
|
|
10
|
+
"format": "prettier --write .",
|
|
11
|
+
"format:check": "prettier --check ."
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=20.0.0",
|
|
15
|
+
"pnpm": ">=8.0.0"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
packages:
|
|
2
|
+
- 'backend'
|
|
3
|
+
- 'frontend'
|
|
4
|
+
- 'shared'
|
|
5
|
+
catalog:
|
|
6
|
+
'@element-plus/icons-vue': ^2.3.2
|
|
7
|
+
'@nestjs/cli': ^10.4.9
|
|
8
|
+
'@nestjs/common': ^10.4.22
|
|
9
|
+
'@nestjs/core': ^10.4.22
|
|
10
|
+
'@nestjs/platform-express': ^10.4.22
|
|
11
|
+
'@nestjs/schematics': ^10.1.4
|
|
12
|
+
'@nestjs/swagger': ^7.4.2
|
|
13
|
+
'@nestjs/typeorm': ^10.0.2
|
|
14
|
+
'@types/node': ^22.15.21
|
|
15
|
+
'@vitejs/plugin-vue': ^5.2.4
|
|
16
|
+
'@vitejs/plugin-vue-jsx': ^5.1.5
|
|
17
|
+
'@vueuse/core': ^14.2.1
|
|
18
|
+
axios: ^1.6.5
|
|
19
|
+
class-transformer: ^0.5.1
|
|
20
|
+
class-validator: ^0.14.4
|
|
21
|
+
dotenv: ^17.3.1
|
|
22
|
+
element-plus: ^2.13.5
|
|
23
|
+
mysql2: ^3.11.5
|
|
24
|
+
pinia: ^2.3.0
|
|
25
|
+
reflect-metadata: ^0.1.14
|
|
26
|
+
rxjs: ^7.8.2
|
|
27
|
+
sass: ^1.70.0
|
|
28
|
+
ts-node: ^10.9.2
|
|
29
|
+
tsconfig-paths: ^4.2.0
|
|
30
|
+
typeorm: ^0.3.28
|
|
31
|
+
typescript: ^5.7.3
|
|
32
|
+
vite: ^5.4.21
|
|
33
|
+
vue: ^3.5.30
|
|
34
|
+
vue-router: ^4.5.1
|
|
35
|
+
vue-tsc: ^2.2.12
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}-shared",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Shared types, constants, and dictionary definitions for {{displayName}}",
|
|
6
|
+
"main": "./dist/cjs/index.js",
|
|
7
|
+
"module": "./dist/esm/index.js",
|
|
8
|
+
"types": "./dist/esm/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/esm/index.d.ts",
|
|
13
|
+
"default": "./dist/esm/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/cjs/index.d.ts",
|
|
17
|
+
"default": "./dist/cjs/index.js"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
23
|
+
"build:esm": "tsc -p tsconfig.json",
|
|
24
|
+
"build": "pnpm run build:cjs && pnpm run build:esm",
|
|
25
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"reflect-metadata": "catalog:",
|
|
29
|
+
"moyan-mfw-base": "^1.0.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"typescript": "catalog:"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './permissions'
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"outDir": "./dist/cjs",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationMap": true
|
|
10
|
+
},
|
|
11
|
+
"include": ["src/**/*"],
|
|
12
|
+
"exclude": ["node_modules", "dist"]
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"declarationMap": true,
|
|
8
|
+
"outDir": "./dist/esm",
|
|
9
|
+
"rootDir": "./src"
|
|
10
|
+
},
|
|
11
|
+
"include": ["src/**/*"],
|
|
12
|
+
"exclude": ["node_modules", "dist"]
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"experimentalDecorators": true,
|
|
5
|
+
"emitDecoratorMetadata": true,
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"resolveJsonModule": true
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# {{displayName}}
|
|
2
|
+
|
|
3
|
+
{{description}}
|
|
4
|
+
|
|
5
|
+
## 快速开始
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 安装依赖
|
|
9
|
+
pnpm install
|
|
10
|
+
|
|
11
|
+
# 启动后端开发服务器
|
|
12
|
+
pnpm dev:backend
|
|
13
|
+
|
|
14
|
+
# 启动前端开发服务器
|
|
15
|
+
pnpm dev:frontend
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 目录结构
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
extension-{{name}}/
|
|
22
|
+
├── src/
|
|
23
|
+
│ ├── backend/ # NestJS 后端
|
|
24
|
+
│ ├── frontend/ # Vue3 前端
|
|
25
|
+
│ └── shared/ # 共享类型与常量
|
|
26
|
+
├── database/migrations/
|
|
27
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema": "https://json.schemastore.org/nest-cli", "collection": "@nestjs/schematics", "sourceRoot": "src", "compilerOptions": {"deleteOutDir": true}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name": "@internal/{{name}}-backend", "version": "{{version}}", "type": "module", "main": "./src/index.ts", "exports": {".": {"types": "./dist/index.d.ts", "import": "./dist/index.js", "require": "./dist/index.cjs"}}, "scripts": {"build": "tsup src/index.ts --format esm,cjs --dts --clean", "typecheck": "tsc --noEmit", "dev": "tsx watch src/index.ts"}, "dependencies": {"moyan-mfw-base/backend": "workspace:*", "@internal/{{name}}-shared": "workspace:*"}, "devDependencies": {"typescript": "catalog:", "tsup": "catalog:", "tsx": "catalog:"}}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './{{name}}.module'
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview {{displayName}}扩展包后端独立启动入口
|
|
3
|
+
*/
|
|
4
|
+
import { NestFactory } from '@nestjs/core'
|
|
5
|
+
import { {{pascalCase name}}Module } from './{{name}}.module'
|
|
6
|
+
import { createExtensionBackendApp } from 'moyan-mfw-base/backend'
|
|
7
|
+
|
|
8
|
+
async function bootstrap() {
|
|
9
|
+
const startTime = Date.now()
|
|
10
|
+
|
|
11
|
+
console.log('[{{pascalCase name}}] ====== Bootstrap Start ======')
|
|
12
|
+
console.log(`[{{pascalCase name}}] Node.js: ${process.version}`)
|
|
13
|
+
console.log(`[{{pascalCase name}}] ENV: ${process.env.NODE_ENV ?? 'development'}`)
|
|
14
|
+
console.log(`[{{pascalCase name}}] PORT: ${process.env.PORT ?? '3001 (default)'}`)
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
const app = await createExtensionBackendApp({
|
|
18
|
+
name: '{{name}}',
|
|
19
|
+
module: {{pascalCase name}}Module,
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const port = Number(process.env.PORT) || 3001
|
|
23
|
+
await app.listen(port)
|
|
24
|
+
|
|
25
|
+
const elapsed = ((Date.now() - startTime) / 1000).toFixed(2)
|
|
26
|
+
console.log(`\n[{{pascalCase name}}] ✅ Server listening on http://localhost:${port} (${elapsed}s)`)
|
|
27
|
+
} catch (error) {
|
|
28
|
+
console.error('\n[{{pascalCase name}}] ❌ Bootstrap failed:')
|
|
29
|
+
console.error(error)
|
|
30
|
+
process.exit(1)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
bootstrap()
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"compilerOptions": {"target": "ES2022", "module": "ESNext", "moduleResolution": "bundler", "lib": ["ES2022"], "outDir": "dist", "rootDir": "src", "strict": true, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "resolveJsonModule": true, "declaration": true, "declarationMap": true, "sourceMap": true, "composite": true}, "include": ["src/**/*"], "exclude": ["node_modules", "dist"]}
|
|
@@ -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>{{displayName}}</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 @@
|
|
|
1
|
+
{"name": "@internal/{{name}}-frontend", "version": "{{version}}", "type": "module", "main": "./src/index.ts", "exports": {".": {"types": "./src/index.d.ts", "import": "./src/index.mjs", "require": "./src/index.js"}}, "scripts": {"build": "vite build && vue-tsc --emitOnly", "typecheck": "vue-tsc --noEmit", "dev": "vite", "preview": "vite preview"}, "dependencies": {"moyan-mfw-base/frontend": "workspace:*", "@internal/{{name}}-shared": "workspace:*", "vue": "catalog:", "vue-router": "catalog:", "element-plus": "catalog:", "@element-plus/icons-vue": "catalog:"}, "devDependencies": {"@vitejs/plugin-vue": "catalog:", "@vitejs/plugin-vue-jsx": "catalog:", "vite": "catalog:", "vue-tsc": "catalog:", "typescript": "catalog:"}}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview {{displayName}}扩展包前端入口
|
|
3
|
+
*/
|
|
4
|
+
import { buildExtensionRoutes } from 'moyan-mfw-base/frontend'
|
|
5
|
+
|
|
6
|
+
const allConfigs = import.meta.glob('./views/**/index.{ts,tsx}', {
|
|
7
|
+
eager: true,
|
|
8
|
+
import: 'default',
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const {{pascalCase name}}Routes = buildExtensionRoutes(allConfigs, '{{name}}', {
|
|
12
|
+
namespaceName: '{{displayName}}',
|
|
13
|
+
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview {{displayName}}扩展包前端自启动入口
|
|
3
|
+
*/
|
|
4
|
+
import 'moyan-mfw-base/frontend/styles/base-admin.scss'
|
|
5
|
+
import { createExtensionFrontendApp } from 'moyan-mfw-base/frontend'
|
|
6
|
+
import { {{pascalCase name}}Routes } from './index'
|
|
7
|
+
|
|
8
|
+
const app = createExtensionFrontendApp({
|
|
9
|
+
name: '{{displayName}}',
|
|
10
|
+
routes: {{pascalCase name}}Routes,
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
app.mount('#app')
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"compilerOptions": {"target": "ES2022", "module": "ESNext", "moduleResolution": "bundler", "lib": ["ES2022", "DOM", "DOM.Iterable"], "outDir": "dist", "rootDir": "src", "strict": true, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "resolveJsonModule": true, "declaration": true, "declarationMap": true, "sourceMap": true, "composite": true, "jsx": "preserve", "jsxImportSource": "vue", "types": ["vite/client"]}, "include": ["src/**/*"], "exclude": ["node_modules", "dist"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import vue from '@vitejs/plugin-vue';
|
|
3
|
+
import vueJsx from '@vitejs/plugin-vue-jsx';
|
|
4
|
+
import { resolve } from 'path';
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
root: '.',
|
|
8
|
+
plugins: [vue(), vueJsx()],
|
|
9
|
+
resolve: {
|
|
10
|
+
alias: {
|
|
11
|
+
'@': resolve(__dirname, 'src'),
|
|
12
|
+
'moyan-mfw-base/frontend/styles': resolve(__dirname, '../../../../base/src/frontend/src/styles'),
|
|
13
|
+
'moyan-mfw-base/frontend': resolve(__dirname, '../../../../base/src/frontend/src/index.ts'),
|
|
14
|
+
'moyan-mfw-base/shared': resolve(__dirname, '../../../../base/src/shared/src/index.ts'),
|
|
15
|
+
'moyan-mfw-extension-{{name}}/shared': resolve(__dirname, '../shared/src/index.ts'),
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
build: {
|
|
19
|
+
outDir: '../../dist/frontend',
|
|
20
|
+
lib: {
|
|
21
|
+
entry: resolve(__dirname, 'src/index.ts'),
|
|
22
|
+
formats: ['es'],
|
|
23
|
+
fileName: () => 'index.js',
|
|
24
|
+
},
|
|
25
|
+
rollupOptions: {
|
|
26
|
+
external: ['vue', 'vue-router', 'element-plus', '@element-plus/icons-vue', 'moyan-mfw-base/frontend', 'moyan-mfw-base/shared'],
|
|
27
|
+
output: { exports: 'named' },
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name": "moyan-mfw-extension-{{name}}", "version": "{{version}}", "description": "{{description}}", "private": true, "type": "module", "exports": {"./backend": {"import": "./src/backend/dist/index.js", "require": "./src/backend/dist/index.js", "types": "./src/backend/dist/index.d.ts"}, "./backend/*": {"import": "./src/backend/dist/*.js", "require": "./src/backend/dist/*", "types": "./src/backend/dist/*.d.ts"}, "./frontend": {"import": "./src/frontend/dist/index.mjs", "require": "./src/frontend/dist/index.js", "types": "./src/frontend/dist/index.d.ts"}, "./frontend/*": {"import": "./src/frontend/dist/*", "require": "./src/frontend/dist/*", "types": "./src/frontend/dist/*.d.ts"}, "./shared": {"import": "./src/shared/dist/index.js", "require": "./src/shared/dist/index.js", "types": "./src/shared/dist/index.d.ts"}, "./shared/*": {"import": "./src/shared/dist/*", "require": "./src/shared/dist/*", "types": "./src/shared/dist/*.d.ts"}}, "typesVersions": {"*": {"*": ["./src/*/dist/*.d.ts", "./src/*/dist/index.d.ts"]}}, "scripts": {"build:shared": "pnpm --filter @internal/{{name}}-shared build", "build:backend": "pnpm --filter moyan-mfw-base run build:shared && pnpm --filter moyan-mfw-base run build:backend && pnpm --filter @internal/{{name}}-backend build", "build:frontend": "pnpm --filter @internal/{{name}}-frontend build", "build": "pnpm run build:shared && pnpm run build:backend && pnpm run build:frontend", "dev:backend": "pnpm --filter @internal/{{name}}-backend dev", "dev:frontend": "pnpm --filter @internal/{{name}}-frontend dev", "typecheck:shared": "pnpm --filter @internal/{{name}}-shared typecheck", "typecheck:backend": "pnpm --filter @internal/{{name}}-backend typecheck", "typecheck:frontend": "pnpm --filter @internal/{{name}}-frontend typecheck", "typecheck": "pnpm run typecheck:shared && pnpm run typecheck:backend && pnpm run typecheck:frontend"}, "devDependencies": {"@internal/{{name}}-backend": "workspace:*", "@internal/{{name}}-frontend": "workspace:*", "@internal/{{name}}-shared": "workspace:*", "moyan-mfw-base": "workspace:*", "typescript": "catalog:"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name": "@internal/{{name}}-shared", "version": "{{version}}", "type": "module", "main": "./src/index.ts", "exports": {".": {"types": "./dist/index.d.ts", "import": "./dist/index.js", "require": "./dist/index.cjs"}}, "scripts": {"build": "tsup src/index.ts --format esm,cjs --dts --clean", "typecheck": "tsc --noEmit", "dev": "tsx watch src/index.ts"}, "dependencies": {"moyan-mfw-base/shared": "workspace:*"}, "devDependencies": {"typescript": "catalog:", "tsup": "catalog:", "tsx": "catalog:"}}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview {{displayName}}常量定义
|
|
3
|
+
*/
|
|
4
|
+
export const LINK_TYPE = {
|
|
5
|
+
IMAGE: 'image',
|
|
6
|
+
URL: 'url',
|
|
7
|
+
} as const
|
|
8
|
+
export type LinkType = (typeof LINK_TYPE)[keyof typeof LINK_TYPE]
|
|
9
|
+
export const LINK_TYPE_LABELS: Record<LinkType, string> = {
|
|
10
|
+
image: '图片',
|
|
11
|
+
url: '链接',
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview {{displayName}}共享类型定义
|
|
3
|
+
*/
|
|
4
|
+
export type { LinkType } from './constants'
|
|
5
|
+
export { LINK_TYPE, LINK_TYPE_LABELS } from './constants'
|
|
6
|
+
export type { {{pascalCase name}}ItemType } from './types'
|
|
7
|
+
export { {{pascalCase name}}Dict } from './dict'
|
|
8
|
+
export { {{pascalCaseUpper name}}_PATHS } from './paths'
|
|
9
|
+
export { {{pascalCaseUpper name}}_EXTENSION_PERMISSION_VALUES } from './permission-values'
|
|
10
|
+
export type { {{pascalCase name}}PermissionName } from './permission-values'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"compilerOptions": {"target": "ES2022", "module": "ESNext", "moduleResolution": "bundler", "lib": ["ES2022"], "outDir": "dist", "rootDir": "src", "strict": true, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "resolveJsonModule": true, "declaration": true, "declarationMap": true, "sourceMap": true, "composite": true}, "include": ["src/**/*"], "exclude": ["node_modules", "dist"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"references": [{"path": "./shared/tsconfig.json"}, {"path": "./backend/tsconfig.json"}, {"path": "./frontend/tsconfig.json"}], "compilerOptions": {"composite": true}}
|
package/package.json
CHANGED
|
@@ -1 +1,52 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "moyan-mfw-cli",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "MFW framework CLI — extension scaffolding, validation, and publishing tools",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"mfw": "./bin/mfw.js"
|
|
8
|
+
},
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"bin/",
|
|
18
|
+
"dist/",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"private": false,
|
|
23
|
+
"scripts": {
|
|
24
|
+
"dev": "tsx watch src/index.ts",
|
|
25
|
+
"copy-templates": "node --input-type=module -e \"import fs from 'node:fs'; fs.cpSync('src/templates','dist/templates',{recursive:true})\"",
|
|
26
|
+
"build": "tsup src/index.ts --format esm,cjs --dts --clean && pnpm copy-templates",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"release:patch": "npm version patch && pnpm build && npm publish",
|
|
29
|
+
"release:minor": "npm version minor && pnpm build && npm publish",
|
|
30
|
+
"release:major": "npm version major && pnpm build && npm publish"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"commander": "^12.0.0",
|
|
34
|
+
"inquirer": "^9.2.0",
|
|
35
|
+
"chalk": "^5.3.0",
|
|
36
|
+
"handlebars": "^4.7.8",
|
|
37
|
+
"semver": "^7.6.0",
|
|
38
|
+
"glob": "^10.3.0",
|
|
39
|
+
"execa": "^9.3.0",
|
|
40
|
+
"prettier": "^3.4.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"tsup": "^8.0.0",
|
|
44
|
+
"tsx": "^4.7.0",
|
|
45
|
+
"typescript": "^5.7.3",
|
|
46
|
+
"@types/inquirer": "^9.0.0",
|
|
47
|
+
"@types/prettier": "^3.0.0"
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=20.0.0"
|
|
51
|
+
}
|
|
52
|
+
}
|