@svton/cli 1.0.5 → 1.0.7
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/dist/index.js +148 -75
- package/dist/index.mjs +148 -75
- package/package.json +1 -2
- package/templates/apps/admin/next-env.d.ts +0 -2
- package/templates/apps/admin/next.config.js +0 -15
- package/templates/apps/admin/package.json.tpl +0 -54
- package/templates/apps/admin/postcss.config.js +0 -6
- package/templates/apps/admin/src/app/globals.css +0 -37
- package/templates/apps/admin/src/app/layout.tsx +0 -19
- package/templates/apps/admin/src/app/login/page.tsx +0 -96
- package/templates/apps/admin/src/app/page.tsx +0 -8
- package/templates/apps/admin/src/app/users/page.tsx +0 -165
- package/templates/apps/admin/src/components/ui/switch.tsx +0 -29
- package/templates/apps/admin/src/hooks/useAPI.ts +0 -130
- package/templates/apps/admin/src/lib/api-client.ts +0 -100
- package/templates/apps/admin/tailwind.config.js +0 -54
- package/templates/apps/admin/tsconfig.json +0 -22
- package/templates/apps/backend/.env.example +0 -14
- package/templates/apps/backend/nest-cli.json +0 -8
- package/templates/apps/backend/package.json.tpl +0 -57
- package/templates/apps/backend/prisma/schema.prisma +0 -72
- package/templates/apps/backend/prisma/seed.ts +0 -32
- package/templates/apps/backend/src/app.controller.ts +0 -15
- package/templates/apps/backend/src/app.module.ts +0 -19
- package/templates/apps/backend/src/app.service.ts +0 -12
- package/templates/apps/backend/src/auth/auth.controller.ts +0 -31
- package/templates/apps/backend/src/auth/auth.module.ts +0 -27
- package/templates/apps/backend/src/auth/auth.service.ts +0 -89
- package/templates/apps/backend/src/auth/jwt-auth.guard.ts +0 -5
- package/templates/apps/backend/src/auth/jwt.strategy.ts +0 -27
- package/templates/apps/backend/src/main.ts +0 -40
- package/templates/apps/backend/src/prisma/prisma.module.ts +0 -9
- package/templates/apps/backend/src/prisma/prisma.service.ts +0 -13
- package/templates/apps/backend/src/user/user.controller.ts +0 -50
- package/templates/apps/backend/src/user/user.module.ts +0 -12
- package/templates/apps/backend/src/user/user.service.ts +0 -117
- package/templates/apps/backend/tsconfig.json +0 -23
- package/templates/apps/mobile/babel.config.js +0 -8
- package/templates/apps/mobile/config/index.ts +0 -65
- package/templates/apps/mobile/package.json.tpl +0 -48
- package/templates/apps/mobile/project.config.json.tpl +0 -17
- package/templates/apps/mobile/src/app.config.ts +0 -9
- package/templates/apps/mobile/src/app.scss +0 -4
- package/templates/apps/mobile/src/app.ts +0 -8
- package/templates/apps/mobile/src/pages/index/index.scss +0 -7
- package/templates/apps/mobile/src/pages/index/index.tsx +0 -49
- package/templates/apps/mobile/tsconfig.json +0 -21
- package/templates/packages/types/package.json.tpl +0 -16
- package/templates/packages/types/src/api.ts +0 -88
- package/templates/packages/types/src/common.ts +0 -89
- package/templates/packages/types/src/index.ts +0 -3
- package/templates/packages/types/tsconfig.json +0 -16
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { UserConfigExport } from '@tarojs/cli';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
projectName: 'mobile',
|
|
5
|
-
date: '2024-1-1',
|
|
6
|
-
designWidth: 750,
|
|
7
|
-
deviceRatio: {
|
|
8
|
-
640: 2.34 / 2,
|
|
9
|
-
750: 1,
|
|
10
|
-
828: 1.81 / 2,
|
|
11
|
-
},
|
|
12
|
-
sourceRoot: 'src',
|
|
13
|
-
outputRoot: 'dist',
|
|
14
|
-
plugins: [],
|
|
15
|
-
defineConstants: {},
|
|
16
|
-
copy: {
|
|
17
|
-
patterns: [],
|
|
18
|
-
options: {},
|
|
19
|
-
},
|
|
20
|
-
framework: 'react',
|
|
21
|
-
compiler: {
|
|
22
|
-
type: 'webpack5',
|
|
23
|
-
prebundle: {
|
|
24
|
-
enable: false,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
mini: {
|
|
28
|
-
postcss: {
|
|
29
|
-
pxtransform: {
|
|
30
|
-
enable: true,
|
|
31
|
-
config: {},
|
|
32
|
-
},
|
|
33
|
-
url: {
|
|
34
|
-
enable: true,
|
|
35
|
-
config: {
|
|
36
|
-
limit: 1024,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
cssModules: {
|
|
40
|
-
enable: false,
|
|
41
|
-
config: {
|
|
42
|
-
namingPattern: 'module',
|
|
43
|
-
generateScopedName: '[name]__[local]___[hash:base64:5]',
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
h5: {
|
|
49
|
-
publicPath: '/',
|
|
50
|
-
staticDirectory: 'static',
|
|
51
|
-
postcss: {
|
|
52
|
-
autoprefixer: {
|
|
53
|
-
enable: true,
|
|
54
|
-
config: {},
|
|
55
|
-
},
|
|
56
|
-
cssModules: {
|
|
57
|
-
enable: false,
|
|
58
|
-
config: {
|
|
59
|
-
namingPattern: 'module',
|
|
60
|
-
generateScopedName: '[name]__[local]___[hash:base64:5]',
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
} satisfies UserConfigExport;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "{{ORG_NAME}}/mobile",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "{{PROJECT_NAME}} 移动端小程序",
|
|
5
|
-
"private": true,
|
|
6
|
-
"templateInfo": {
|
|
7
|
-
"name": "default",
|
|
8
|
-
"typescript": true,
|
|
9
|
-
"css": "sass"
|
|
10
|
-
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build:weapp": "taro build --type weapp",
|
|
13
|
-
"dev": "npm run dev:weapp",
|
|
14
|
-
"dev:weapp": "npm run build:weapp -- --watch",
|
|
15
|
-
"dev:h5": "taro build --type h5 --watch",
|
|
16
|
-
"lint": "eslint \"src/**/*.{ts,tsx}\"",
|
|
17
|
-
"type-check": "tsc --noEmit"
|
|
18
|
-
},
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"@babel/runtime": "^7.23.6",
|
|
21
|
-
"@svton/api-client": "^1.0.0",
|
|
22
|
-
"@svton/hooks": "^1.0.0",
|
|
23
|
-
"@svton/taro-ui": "^1.0.0",
|
|
24
|
-
"@svton/types": "^1.0.0",
|
|
25
|
-
"@tarojs/components": "3.6.23",
|
|
26
|
-
"@tarojs/helper": "3.6.23",
|
|
27
|
-
"@tarojs/plugin-framework-react": "3.6.23",
|
|
28
|
-
"@tarojs/plugin-platform-weapp": "3.6.23",
|
|
29
|
-
"@tarojs/react": "3.6.23",
|
|
30
|
-
"@tarojs/runtime": "3.6.23",
|
|
31
|
-
"@tarojs/taro": "3.6.23",
|
|
32
|
-
"react": "^18.2.0",
|
|
33
|
-
"react-dom": "^18.2.0",
|
|
34
|
-
"zustand": "^4.4.7"
|
|
35
|
-
},
|
|
36
|
-
"devDependencies": {
|
|
37
|
-
"@babel/core": "^7.23.6",
|
|
38
|
-
"@tarojs/cli": "3.6.23",
|
|
39
|
-
"@tarojs/webpack5-runner": "3.6.23",
|
|
40
|
-
"@types/react": "^18.2.45",
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "^6.15.0",
|
|
42
|
-
"@typescript-eslint/parser": "^6.15.0",
|
|
43
|
-
"babel-preset-taro": "3.6.23",
|
|
44
|
-
"eslint": "^8.56.0",
|
|
45
|
-
"eslint-config-taro": "3.6.23",
|
|
46
|
-
"typescript": "^5.3.3"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"miniprogramRoot": "dist/",
|
|
3
|
-
"projectname": "{{PROJECT_NAME}}",
|
|
4
|
-
"description": "{{PROJECT_NAME}} 小程序",
|
|
5
|
-
"appid": "",
|
|
6
|
-
"setting": {
|
|
7
|
-
"urlCheck": true,
|
|
8
|
-
"es6": false,
|
|
9
|
-
"enhance": false,
|
|
10
|
-
"compileHotReLoad": false,
|
|
11
|
-
"postcss": false,
|
|
12
|
-
"minified": false,
|
|
13
|
-
"bundle": false,
|
|
14
|
-
"nodeModules": false
|
|
15
|
-
},
|
|
16
|
-
"compileType": "miniprogram"
|
|
17
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { View } from '@tarojs/components';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { usePersistFn, useMount } from '@svton/hooks';
|
|
4
|
-
import { NavBar, StatusBar, Loading, Empty } from '@svton/taro-ui';
|
|
5
|
-
import type { ContentVo } from '{{ORG_NAME}}/types';
|
|
6
|
-
import './index.scss';
|
|
7
|
-
|
|
8
|
-
export default function Index() {
|
|
9
|
-
const [loading, setLoading] = useState(true);
|
|
10
|
-
const [contents, setContents] = useState<ContentVo[]>([]);
|
|
11
|
-
|
|
12
|
-
const fetchContents = usePersistFn(async () => {
|
|
13
|
-
try {
|
|
14
|
-
setLoading(true);
|
|
15
|
-
// 这里应该使用 @svton/api-client 的 API
|
|
16
|
-
// const response = await apiClient.contents.list({ page: 1, pageSize: 10 });
|
|
17
|
-
// setContents(response.data.list);
|
|
18
|
-
|
|
19
|
-
// 模拟数据
|
|
20
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
21
|
-
setContents([]);
|
|
22
|
-
} catch (error) {
|
|
23
|
-
console.error('获取内容列表失败', error);
|
|
24
|
-
} finally {
|
|
25
|
-
setLoading(false);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
useMount(() => {
|
|
30
|
-
fetchContents();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<View className="index">
|
|
35
|
-
<StatusBar />
|
|
36
|
-
<NavBar title="首页" />
|
|
37
|
-
|
|
38
|
-
<View className="content">
|
|
39
|
-
{loading && <Loading text="加载中..." />}
|
|
40
|
-
{!loading && contents.length === 0 && <Empty text="暂无内容" />}
|
|
41
|
-
{!loading && contents.length > 0 && (
|
|
42
|
-
<View className="content-list">
|
|
43
|
-
{/* 内容列表 */}
|
|
44
|
-
</View>
|
|
45
|
-
)}
|
|
46
|
-
</View>
|
|
47
|
-
</View>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2017",
|
|
4
|
-
"module": "CommonJS",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"strict": true,
|
|
8
|
-
"jsx": "react-jsx",
|
|
9
|
-
"allowSyntheticDefaultImports": true,
|
|
10
|
-
"resolveJsonModule": true,
|
|
11
|
-
"typeRoots": ["node_modules/@types"],
|
|
12
|
-
"noEmit": true,
|
|
13
|
-
"skipLibCheck": true,
|
|
14
|
-
"baseUrl": ".",
|
|
15
|
-
"paths": {
|
|
16
|
-
"@/*": ["./src/*"]
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"include": ["src/**/*", "types/**/*", "config/**/*"],
|
|
20
|
-
"exclude": ["node_modules", "dist"]
|
|
21
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@svton/types",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "{{PROJECT_NAME}} 共享类型定义",
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc",
|
|
9
|
-
"dev": "tsc --watch",
|
|
10
|
-
"clean": "rm -rf dist",
|
|
11
|
-
"type-check": "tsc --noEmit"
|
|
12
|
-
},
|
|
13
|
-
"devDependencies": {
|
|
14
|
-
"typescript": "^5.3.0"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
// ============================================================
|
|
2
|
-
// API 请求/响应类型定义
|
|
3
|
-
// ============================================================
|
|
4
|
-
|
|
5
|
-
import type { UserVo, UserRole, PaginationParams, ContentStatus } from './common';
|
|
6
|
-
|
|
7
|
-
// ============================================================
|
|
8
|
-
// 认证相关
|
|
9
|
-
// ============================================================
|
|
10
|
-
|
|
11
|
-
// 登录请求
|
|
12
|
-
export interface LoginDto {
|
|
13
|
-
phone: string;
|
|
14
|
-
password: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// 登录响应
|
|
18
|
-
export interface LoginVo {
|
|
19
|
-
accessToken: string;
|
|
20
|
-
refreshToken: string;
|
|
21
|
-
user: UserVo;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// 注册请求
|
|
25
|
-
export interface RegisterDto {
|
|
26
|
-
phone: string;
|
|
27
|
-
password: string;
|
|
28
|
-
nickname: string;
|
|
29
|
-
code?: string; // 验证码
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// 刷新 Token
|
|
33
|
-
export interface RefreshTokenDto {
|
|
34
|
-
refreshToken: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// ============================================================
|
|
38
|
-
// 用户管理
|
|
39
|
-
// ============================================================
|
|
40
|
-
|
|
41
|
-
// 用户列表查询
|
|
42
|
-
export interface UserListParams extends PaginationParams {
|
|
43
|
-
keyword?: string;
|
|
44
|
-
role?: UserRole;
|
|
45
|
-
status?: number;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// 创建用户
|
|
49
|
-
export interface CreateUserDto {
|
|
50
|
-
phone: string;
|
|
51
|
-
password: string;
|
|
52
|
-
nickname: string;
|
|
53
|
-
role?: UserRole;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// 更新用户
|
|
57
|
-
export interface UpdateUserDto {
|
|
58
|
-
nickname?: string;
|
|
59
|
-
avatar?: string;
|
|
60
|
-
role?: UserRole;
|
|
61
|
-
status?: number;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// ============================================================
|
|
65
|
-
// 内容管理
|
|
66
|
-
// ============================================================
|
|
67
|
-
|
|
68
|
-
// 内容列表查询
|
|
69
|
-
export interface ContentListParams extends PaginationParams {
|
|
70
|
-
keyword?: string;
|
|
71
|
-
status?: ContentStatus;
|
|
72
|
-
authorId?: number;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// 创建内容
|
|
76
|
-
export interface CreateContentDto {
|
|
77
|
-
title: string;
|
|
78
|
-
content: string;
|
|
79
|
-
images?: string[];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// 更新内容
|
|
83
|
-
export interface UpdateContentDto {
|
|
84
|
-
title?: string;
|
|
85
|
-
content?: string;
|
|
86
|
-
images?: string[];
|
|
87
|
-
status?: ContentStatus;
|
|
88
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
// ============================================================
|
|
2
|
-
// 通用类型定义
|
|
3
|
-
// ============================================================
|
|
4
|
-
|
|
5
|
-
// 分页请求参数
|
|
6
|
-
export interface PaginationParams {
|
|
7
|
-
page?: number;
|
|
8
|
-
pageSize?: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// 分页响应
|
|
12
|
-
export interface PaginatedResponse<T> {
|
|
13
|
-
list: T[];
|
|
14
|
-
total: number;
|
|
15
|
-
page: number;
|
|
16
|
-
pageSize: number;
|
|
17
|
-
totalPages: number;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// 通用 API 响应
|
|
21
|
-
export interface ApiResponse<T = unknown> {
|
|
22
|
-
code: number;
|
|
23
|
-
message: string;
|
|
24
|
-
data: T;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// ============================================================
|
|
28
|
-
// 用户相关类型
|
|
29
|
-
// ============================================================
|
|
30
|
-
|
|
31
|
-
// 用户角色
|
|
32
|
-
export type UserRole = 'user' | 'admin' | 'super_admin';
|
|
33
|
-
|
|
34
|
-
// 用户状态
|
|
35
|
-
export type UserStatus = 0 | 1; // 0: 禁用, 1: 启用
|
|
36
|
-
|
|
37
|
-
// 用户基础信息
|
|
38
|
-
export interface UserVo {
|
|
39
|
-
id: number;
|
|
40
|
-
phone: string;
|
|
41
|
-
nickname: string;
|
|
42
|
-
avatar?: string;
|
|
43
|
-
role: UserRole;
|
|
44
|
-
status: UserStatus;
|
|
45
|
-
createdAt: string;
|
|
46
|
-
updatedAt: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// 用户详情(包含更多字段)
|
|
50
|
-
export interface UserDetailVo extends UserVo {
|
|
51
|
-
email?: string;
|
|
52
|
-
bio?: string;
|
|
53
|
-
lastLoginAt?: string;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// ============================================================
|
|
57
|
-
// 内容相关类型
|
|
58
|
-
// ============================================================
|
|
59
|
-
|
|
60
|
-
// 内容状态
|
|
61
|
-
export type ContentStatus = 'draft' | 'pending' | 'published' | 'rejected';
|
|
62
|
-
|
|
63
|
-
// 内容基础信息
|
|
64
|
-
export interface ContentVo {
|
|
65
|
-
id: number;
|
|
66
|
-
title: string;
|
|
67
|
-
content: string;
|
|
68
|
-
images: string[];
|
|
69
|
-
status: ContentStatus;
|
|
70
|
-
viewCount: number;
|
|
71
|
-
likeCount: number;
|
|
72
|
-
commentCount: number;
|
|
73
|
-
author: UserVo;
|
|
74
|
-
createdAt: string;
|
|
75
|
-
updatedAt: string;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// ============================================================
|
|
79
|
-
// 通用工具类型
|
|
80
|
-
// ============================================================
|
|
81
|
-
|
|
82
|
-
// 可选的 ID
|
|
83
|
-
export type WithOptionalId<T> = Omit<T, 'id'> & { id?: number };
|
|
84
|
-
|
|
85
|
-
// 创建 DTO(移除系统字段)
|
|
86
|
-
export type CreateDto<T> = Omit<T, 'id' | 'createdAt' | 'updatedAt'>;
|
|
87
|
-
|
|
88
|
-
// 更新 DTO
|
|
89
|
-
export type UpdateDto<T> = Partial<CreateDto<T>> & { id: number };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"declaration": true,
|
|
6
|
-
"declarationMap": true,
|
|
7
|
-
"strict": true,
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"forceConsistentCasingInFileNames": true,
|
|
11
|
-
"outDir": "./dist",
|
|
12
|
-
"rootDir": "./src"
|
|
13
|
-
},
|
|
14
|
-
"include": ["src/**/*"],
|
|
15
|
-
"exclude": ["node_modules", "dist"]
|
|
16
|
-
}
|