pandax 0.0.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.
- package/README.md +83 -0
- package/bin/pandax.js +592 -0
- package/package.json +33 -0
- package/skills/pandax-frontend-api-mock/SKILL.md +62 -0
- package/skills/pandax-frontend-architecture/SKILL.md +1239 -0
- package/skills/pandax-frontend-component-review/SKILL.md +114 -0
- package/skills/pandax-frontend-requirement/SKILL.md +142 -0
- package/skills/pandax-frontend-standards/SKILL.md +468 -0
- package/skills/pandax-frontend-use-modal/SKILL.md +621 -0
- package/templates/pandax-monorepo/.editorconfig +16 -0
- package/templates/pandax-monorepo/.husky/commit-msg +2 -0
- package/templates/pandax-monorepo/.husky/pre-commit +2 -0
- package/templates/pandax-monorepo/.prettierrc.json +28 -0
- package/templates/pandax-monorepo/apps/base/env.d.ts +1 -0
- package/templates/pandax-monorepo/apps/base/index.html +13 -0
- package/templates/pandax-monorepo/apps/base/package.json +30 -0
- package/templates/pandax-monorepo/apps/base/src/App.vue +15 -0
- package/templates/pandax-monorepo/apps/base/src/layouts/default-layout/index.vue +23 -0
- package/templates/pandax-monorepo/apps/base/src/main.ts +31 -0
- package/templates/pandax-monorepo/apps/base/src/router/index.ts +22 -0
- package/templates/pandax-monorepo/apps/base/src/stores/index.ts +15 -0
- package/templates/pandax-monorepo/apps/base/src/styles/global.scss +19 -0
- package/templates/pandax-monorepo/apps/base/src/styles/variables.scss +4 -0
- package/templates/pandax-monorepo/apps/base/src/types/wujie.d.ts +16 -0
- package/templates/pandax-monorepo/apps/base/src/views/home/index.vue +21 -0
- package/templates/pandax-monorepo/apps/base/tsconfig.json +25 -0
- package/templates/pandax-monorepo/apps/base/tsconfig.node.json +11 -0
- package/templates/pandax-monorepo/apps/base/vite.config.ts +26 -0
- package/templates/pandax-monorepo/apps/main/env.d.ts +1 -0
- package/templates/pandax-monorepo/apps/main/index.html +13 -0
- package/templates/pandax-monorepo/apps/main/package.json +32 -0
- package/templates/pandax-monorepo/apps/main/src/App.vue +15 -0
- package/templates/pandax-monorepo/apps/main/src/layouts/MicroApp.vue +29 -0
- package/templates/pandax-monorepo/apps/main/src/layouts/default-layout/index.vue +48 -0
- package/templates/pandax-monorepo/apps/main/src/main.ts +27 -0
- package/templates/pandax-monorepo/apps/main/src/router/index.ts +22 -0
- package/templates/pandax-monorepo/apps/main/src/stores/index.ts +23 -0
- package/templates/pandax-monorepo/apps/main/src/styles/global.scss +23 -0
- package/templates/pandax-monorepo/apps/main/src/styles/variables.scss +8 -0
- package/templates/pandax-monorepo/apps/main/src/views/home/index.vue +25 -0
- package/templates/pandax-monorepo/apps/main/tsconfig.json +25 -0
- package/templates/pandax-monorepo/apps/main/tsconfig.node.json +11 -0
- package/templates/pandax-monorepo/apps/main/vite.config.ts +24 -0
- package/templates/pandax-monorepo/commitlint.config.js +38 -0
- package/templates/pandax-monorepo/eslint.config.js +61 -0
- package/templates/pandax-monorepo/package.json +50 -0
- package/templates/pandax-monorepo/packages/components/package.json +20 -0
- package/templates/pandax-monorepo/packages/components/src/PandaButton.vue +15 -0
- package/templates/pandax-monorepo/packages/components/src/PandaCard.vue +16 -0
- package/templates/pandax-monorepo/packages/components/src/index.ts +2 -0
- package/templates/pandax-monorepo/packages/core/package.json +20 -0
- package/templates/pandax-monorepo/packages/core/src/index.ts +2 -0
- package/templates/pandax-monorepo/packages/core/src/request.ts +24 -0
- package/templates/pandax-monorepo/packages/core/src/utils.ts +7 -0
- package/templates/pandax-monorepo/packages/hooks/package.json +19 -0
- package/templates/pandax-monorepo/packages/hooks/src/index.ts +2 -0
- package/templates/pandax-monorepo/packages/hooks/src/useCounter.ts +27 -0
- package/templates/pandax-monorepo/packages/hooks/src/useToggle.ts +19 -0
- package/templates/pandax-monorepo/packages/styles/package.json +19 -0
- package/templates/pandax-monorepo/packages/styles/src/index.ts +1 -0
- package/templates/pandax-monorepo/packages/styles/src/uno.ts +19 -0
- package/templates/pandax-monorepo/packages/styles/src/variables.scss +14 -0
- package/templates/pandax-monorepo/pnpm-workspace.yaml +32 -0
- package/templates/pandax-monorepo/turbo.json +23 -0
- package/templates/vue3/.eslintrc.cjs +16 -0
- package/templates/vue3/.prettierrc +7 -0
- package/templates/vue3/env.d.ts +1 -0
- package/templates/vue3/index.html +13 -0
- package/templates/vue3/package.json +34 -0
- package/templates/vue3/src/App.vue +14 -0
- package/templates/vue3/src/api/index.ts +27 -0
- package/templates/vue3/src/assets/.gitkeep +1 -0
- package/templates/vue3/src/components/.gitkeep +1 -0
- package/templates/vue3/src/composables/.gitkeep +1 -0
- package/templates/vue3/src/constants/.gitkeep +1 -0
- package/templates/vue3/src/directives/.gitkeep +1 -0
- package/templates/vue3/src/layouts/default-layout/index.vue +33 -0
- package/templates/vue3/src/locales/.gitkeep +1 -0
- package/templates/vue3/src/main.ts +17 -0
- package/templates/vue3/src/router/index.ts +17 -0
- package/templates/vue3/src/services/.gitkeep +1 -0
- package/templates/vue3/src/stores/index.ts +12 -0
- package/templates/vue3/src/styles/global.scss +18 -0
- package/templates/vue3/src/styles/variables.scss +17 -0
- package/templates/vue3/src/types/global.d.ts +9 -0
- package/templates/vue3/src/utils/format.ts +11 -0
- package/templates/vue3/src/views/home/index.vue +19 -0
- package/templates/vue3/tsconfig.json +25 -0
- package/templates/vue3/tsconfig.node.json +10 -0
- package/templates/vue3/vite.config.ts +20 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Vue 3 官方推荐的 ESLint 9 flat config
|
|
2
|
+
// 参考:https://eslint.vuejs.org/ + https://github.com/vuejs/eslint-config-typescript
|
|
3
|
+
// 使用 @vue/eslint-config-typescript v14.9+ 的 withVueTs + vueTsConfigs API
|
|
4
|
+
import pluginVue from 'eslint-plugin-vue';
|
|
5
|
+
import { withVueTs, vueTsConfigs } from '@vue/eslint-config-typescript';
|
|
6
|
+
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';
|
|
7
|
+
|
|
8
|
+
export default withVueTs(
|
|
9
|
+
// 1. 待 lint 的文件范围
|
|
10
|
+
{
|
|
11
|
+
name: 'pandax/files-to-lint',
|
|
12
|
+
files: ['**/*.{ts,tsx,cts,mts,vue,js,jsx,cjs,mjs}'],
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
// 2. Vue 3 官方推荐规则(包含 vue 解析器)
|
|
16
|
+
pluginVue.configs['flat/recommended'],
|
|
17
|
+
|
|
18
|
+
// 3. TypeScript 推荐规则(不开 type-checked,类型检查交给 vue-tsc / tsc,保持 lint 速度)
|
|
19
|
+
// 如需深度类型感知 lint,可改为 vueTsConfigs.recommendedTypeChecked
|
|
20
|
+
vueTsConfigs.recommended,
|
|
21
|
+
|
|
22
|
+
// 4. 项目自定义规则(遵循 pandax-frontend-standards)
|
|
23
|
+
{
|
|
24
|
+
name: 'pandax/custom-rules',
|
|
25
|
+
rules: {
|
|
26
|
+
// 允许单个单词的组件名(如 Home、App)
|
|
27
|
+
'vue/multi-word-component-names': 'off',
|
|
28
|
+
// 允许 v-html(按需在业务代码中自行规避 XSS)
|
|
29
|
+
'vue/no-v-html': 'off',
|
|
30
|
+
// 未使用变量:以下划线开头视为有意保留
|
|
31
|
+
'@typescript-eslint/no-unused-vars': [
|
|
32
|
+
'warn',
|
|
33
|
+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', ignoreRestSiblings: true },
|
|
34
|
+
],
|
|
35
|
+
// 显式 any 仅警告,不阻断提交
|
|
36
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
37
|
+
// 禁止 console.log,但允许 console.warn / console.error
|
|
38
|
+
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
|
39
|
+
// 调试器一律报错
|
|
40
|
+
'no-debugger': 'error',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
// 5. 忽略目录
|
|
45
|
+
{
|
|
46
|
+
name: 'pandax/files-to-ignore',
|
|
47
|
+
ignores: [
|
|
48
|
+
'**/dist/**',
|
|
49
|
+
'**/dist-ssr/**',
|
|
50
|
+
'**/coverage/**',
|
|
51
|
+
'**/.turbo/**',
|
|
52
|
+
'**/node_modules/**',
|
|
53
|
+
'**/.husky/**',
|
|
54
|
+
'**/*.d.ts',
|
|
55
|
+
'eslint.config.js',
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
// 6. 关闭与 Prettier 冲突的格式规则(放在最后)
|
|
60
|
+
skipFormatting,
|
|
61
|
+
);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pandax-monorepo",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"packageManager": "pnpm@10.0.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "turbo run dev --parallel",
|
|
9
|
+
"build": "turbo run build",
|
|
10
|
+
"build:main": "pnpm --filter pandax-main build",
|
|
11
|
+
"build:apps": "turbo run build --filter=!./apps/main",
|
|
12
|
+
"lint": "turbo run lint",
|
|
13
|
+
"lint:fix": "turbo run lint:fix",
|
|
14
|
+
"format": "prettier --write \"**/*.{ts,tsx,cts,mts,vue,js,jsx,cjs,mjs,json,scss,md,yml,yaml}\"",
|
|
15
|
+
"format:check": "prettier --check \"**/*.{ts,tsx,cts,mts,vue,js,jsx,cjs,mjs,json,scss,md,yml,yaml}\"",
|
|
16
|
+
"typecheck": "turbo run typecheck",
|
|
17
|
+
"clean": "pnpm -r exec rm -rf node_modules dist .turbo",
|
|
18
|
+
"prepare": "husky",
|
|
19
|
+
"commit": "cz",
|
|
20
|
+
"commitlint": "commitlint --from=HEAD~1 --to=HEAD --verbose"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"turbo": "^2.4.0",
|
|
24
|
+
"@vitejs/plugin-vue": "^5.2.0",
|
|
25
|
+
"vue-tsc": "catalog:",
|
|
26
|
+
"sass": "^1.86.0",
|
|
27
|
+
"unocss": "^66.0.0",
|
|
28
|
+
"@unocss/preset-uno": "^66.0.0",
|
|
29
|
+
"eslint": "catalog:",
|
|
30
|
+
"eslint-plugin-vue": "catalog:",
|
|
31
|
+
"@vue/eslint-config-typescript": "catalog:",
|
|
32
|
+
"@vue/eslint-config-prettier": "catalog:",
|
|
33
|
+
"prettier": "catalog:",
|
|
34
|
+
"husky": "catalog:",
|
|
35
|
+
"lint-staged": "catalog:",
|
|
36
|
+
"@commitlint/cli": "catalog:",
|
|
37
|
+
"@commitlint/config-conventional": "catalog:",
|
|
38
|
+
"commitizen": "catalog:",
|
|
39
|
+
"cz-conventional-changelog": "catalog:"
|
|
40
|
+
},
|
|
41
|
+
"lint-staged": {
|
|
42
|
+
"*.{ts,tsx,cts,mts,vue,js,jsx,cjs,mjs}": "eslint --fix",
|
|
43
|
+
"*.{ts,tsx,cts,mts,vue,js,jsx,cjs,mjs,json,scss,md,yml,yaml}": "prettier --write"
|
|
44
|
+
},
|
|
45
|
+
"config": {
|
|
46
|
+
"commitizen": {
|
|
47
|
+
"path": "cz-conventional-changelog"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pandax-components",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./src/index.ts",
|
|
6
|
+
"types": "./src/index.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/index.ts"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"lint": "eslint . --ext .vue,.ts,.tsx --fix"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"vue": "catalog:",
|
|
15
|
+
"element-plus": "catalog:"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "catalog:"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
type?: 'primary' | 'success' | 'warning' | 'danger' | 'info';
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
7
|
+
type: 'primary',
|
|
8
|
+
});
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<el-button :type="props.type">
|
|
13
|
+
<slot />
|
|
14
|
+
</el-button>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
title?: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const props = defineProps<Props>();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<el-card shadow="never">
|
|
11
|
+
<template v-if="props.title" #header>
|
|
12
|
+
<div class="font-bold">{{ props.title }}</div>
|
|
13
|
+
</template>
|
|
14
|
+
<slot />
|
|
15
|
+
</el-card>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pandax-core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./src/index.ts",
|
|
6
|
+
"types": "./src/index.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/index.ts",
|
|
9
|
+
"./request": "./src/request.ts"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"lint": "eslint . --ext .ts,.tsx --fix"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"axios": "catalog:"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "catalog:"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
|
|
3
|
+
const request = axios.create({
|
|
4
|
+
baseURL: import.meta.env.VITE_API_BASE_URL || '/api',
|
|
5
|
+
timeout: 10000,
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
request.interceptors.request.use((config) => {
|
|
9
|
+
const token = localStorage.getItem('token');
|
|
10
|
+
if (token) {
|
|
11
|
+
config.headers.Authorization = `Bearer ${token}`;
|
|
12
|
+
}
|
|
13
|
+
return config;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
request.interceptors.response.use(
|
|
17
|
+
(response) => response.data,
|
|
18
|
+
(error) => {
|
|
19
|
+
// 统一错误处理
|
|
20
|
+
return Promise.reject(error);
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export default request;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function isObject(value: unknown): value is Record<string, any> {
|
|
2
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function sleep(ms: number): Promise<void> {
|
|
6
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pandax-hooks",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./src/index.ts",
|
|
6
|
+
"types": "./src/index.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/index.ts"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"lint": "eslint . --ext .ts,.tsx --fix"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"vue": "catalog:"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"typescript": "catalog:"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ref, computed } from 'vue';
|
|
2
|
+
|
|
3
|
+
export function useCounter(initial = 0) {
|
|
4
|
+
const count = ref(initial);
|
|
5
|
+
|
|
6
|
+
const double = computed(() => count.value * 2);
|
|
7
|
+
|
|
8
|
+
function increment() {
|
|
9
|
+
count.value += 1;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function decrement() {
|
|
13
|
+
count.value -= 1;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function reset() {
|
|
17
|
+
count.value = initial;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
count,
|
|
22
|
+
double,
|
|
23
|
+
increment,
|
|
24
|
+
decrement,
|
|
25
|
+
reset,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
export function useToggle(initial = false) {
|
|
4
|
+
const state = ref(initial);
|
|
5
|
+
|
|
6
|
+
function toggle() {
|
|
7
|
+
state.value = !state.value;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function set(value: boolean) {
|
|
11
|
+
state.value = value;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
state,
|
|
16
|
+
toggle,
|
|
17
|
+
set,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pandax-styles",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./src/index.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./src/index.ts",
|
|
8
|
+
"./variables": "./src/variables.scss",
|
|
9
|
+
"./uno": "./src/uno.ts"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"lint": "eslint . --ext .ts,.tsx --fix"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"typescript": "catalog:",
|
|
16
|
+
"unocss": "^66.0.0",
|
|
17
|
+
"@unocss/preset-uno": "^66.0.0"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as unoConfig } from './uno';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineConfig } from 'unocss';
|
|
2
|
+
import presetUno from '@unocss/preset-uno';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
presets: [presetUno()],
|
|
6
|
+
shortcuts: {
|
|
7
|
+
'flex-center': 'flex items-center justify-center',
|
|
8
|
+
'text-ellipsis': 'overflow-hidden text-ellipsis whitespace-nowrap',
|
|
9
|
+
},
|
|
10
|
+
theme: {
|
|
11
|
+
colors: {
|
|
12
|
+
primary: '#409eff',
|
|
13
|
+
success: '#67c23a',
|
|
14
|
+
warning: '#e6a23c',
|
|
15
|
+
danger: '#f56c6c',
|
|
16
|
+
info: '#909399',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Pandax 主题变量
|
|
2
|
+
:root {
|
|
3
|
+
--pandax-primary: #409eff;
|
|
4
|
+
--pandax-success: #67c23a;
|
|
5
|
+
--pandax-warning: #e6a23c;
|
|
6
|
+
--pandax-danger: #f56c6c;
|
|
7
|
+
--pandax-info: #909399;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
$primary: var(--pandax-primary);
|
|
11
|
+
$success: var(--pandax-success);
|
|
12
|
+
$warning: var(--pandax-warning);
|
|
13
|
+
$danger: var(--pandax-danger);
|
|
14
|
+
$info: var(--pandax-info);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
packages:
|
|
2
|
+
- 'apps/*'
|
|
3
|
+
- 'packages/*'
|
|
4
|
+
|
|
5
|
+
# 统一各子包共享依赖的版本,避免多版本冲突
|
|
6
|
+
catalog:
|
|
7
|
+
vue: ^3.5.0
|
|
8
|
+
vue-router: ^4.5.0
|
|
9
|
+
pinia: ^2.3.0
|
|
10
|
+
axios: ^1.8.0
|
|
11
|
+
# TypeScript 6.0 是 5.x → 7.0 的官方推荐过渡版本
|
|
12
|
+
# 暂不升 7.0:vue-tsc / Volar 等 Vue 工具链依赖 TS programmatic API,
|
|
13
|
+
# TS 7.0 未提供稳定 API(要等 7.1,约 2026-10),强行升 7 会导致 vue-tsc 报
|
|
14
|
+
# ERR_PACKAGE_PATH_NOT_EXPORTED。详见 SKILL.md「工程规范配置」章节
|
|
15
|
+
typescript: ^6.0.3
|
|
16
|
+
vue-tsc: ^3.3.11
|
|
17
|
+
vite: ^8.0.0
|
|
18
|
+
element-plus: ^2.9.0
|
|
19
|
+
'@element-plus/icons-vue': ^2.3.0
|
|
20
|
+
# 代码规范(Vue 3 官方推荐:ESLint 9 + flat config)
|
|
21
|
+
eslint: ^9.18.0
|
|
22
|
+
eslint-plugin-vue: ^9.33.0
|
|
23
|
+
'@vue/eslint-config-typescript': ^14.9.0
|
|
24
|
+
'@vue/eslint-config-prettier': ^10.1.0
|
|
25
|
+
prettier: ^3.5.0
|
|
26
|
+
# 提交规范(Conventional Commits)
|
|
27
|
+
husky: ^9.1.7
|
|
28
|
+
lint-staged: ^15.3.0
|
|
29
|
+
'@commitlint/cli': ^19.6.1
|
|
30
|
+
'@commitlint/config-conventional': ^19.6.0
|
|
31
|
+
commitizen: ^4.3.1
|
|
32
|
+
cz-conventional-changelog: ^3.3.0
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://turbo.build/schema.json",
|
|
3
|
+
"globalDependencies": ["**/.env.*local"],
|
|
4
|
+
"pipeline": {
|
|
5
|
+
"build": {
|
|
6
|
+
"dependsOn": ["^build"],
|
|
7
|
+
"outputs": ["dist/**"]
|
|
8
|
+
},
|
|
9
|
+
"typecheck": {
|
|
10
|
+
"dependsOn": ["^build"]
|
|
11
|
+
},
|
|
12
|
+
"lint": {
|
|
13
|
+
"outputs": []
|
|
14
|
+
},
|
|
15
|
+
"lint:fix": {
|
|
16
|
+
"outputs": []
|
|
17
|
+
},
|
|
18
|
+
"dev": {
|
|
19
|
+
"cache": false,
|
|
20
|
+
"persistent": true
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* eslint-env node */
|
|
2
|
+
module.exports = {
|
|
3
|
+
root: true,
|
|
4
|
+
extends: [
|
|
5
|
+
'plugin:vue/vue3-essential',
|
|
6
|
+
'eslint:recommended',
|
|
7
|
+
'@vue/eslint-config-typescript',
|
|
8
|
+
],
|
|
9
|
+
parserOptions: {
|
|
10
|
+
ecmaVersion: 'latest',
|
|
11
|
+
},
|
|
12
|
+
rules: {
|
|
13
|
+
'vue/multi-word-component-names': 'off',
|
|
14
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
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>Vue3 Project</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/src/main.ts"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vue3-project",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "vue-tsc --noEmit && vite build",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix",
|
|
11
|
+
"format": "prettier --write ."
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"vue": "^3.4.21",
|
|
15
|
+
"vue-router": "^4.3.0",
|
|
16
|
+
"pinia": "^2.1.7",
|
|
17
|
+
"axios": "^1.6.8",
|
|
18
|
+
"element-plus": "^2.6.1",
|
|
19
|
+
"@element-plus/icons-vue": "^2.3.1"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@vitejs/plugin-vue": "^5.0.4",
|
|
23
|
+
"vite": "^5.2.0",
|
|
24
|
+
"vue-tsc": "^2.0.6",
|
|
25
|
+
"typescript": "^5.4.0",
|
|
26
|
+
"eslint": "^8.57.0",
|
|
27
|
+
"@vue/eslint-config-typescript": "^13.0.0",
|
|
28
|
+
"eslint-plugin-vue": "^9.24.0",
|
|
29
|
+
"prettier": "^3.2.5",
|
|
30
|
+
"sass": "^1.72.0",
|
|
31
|
+
"unocss": "^0.58.6",
|
|
32
|
+
"@unocss/preset-uno": "^0.58.6"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
|
|
3
|
+
const request = axios.create({
|
|
4
|
+
baseURL: import.meta.env.VITE_API_BASE_URL || '/api',
|
|
5
|
+
timeout: 10000,
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
request.interceptors.request.use(
|
|
9
|
+
(config) => {
|
|
10
|
+
// 请求拦截
|
|
11
|
+
return config;
|
|
12
|
+
},
|
|
13
|
+
(error) => {
|
|
14
|
+
return Promise.reject(error);
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
request.interceptors.response.use(
|
|
19
|
+
(response) => {
|
|
20
|
+
return response.data;
|
|
21
|
+
},
|
|
22
|
+
(error) => {
|
|
23
|
+
return Promise.reject(error);
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export default request;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# placeholder
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# placeholder
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# placeholder
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# placeholder
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# placeholder
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { RouterView } from 'vue-router';
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<div class="default-layout">
|
|
7
|
+
<header class="layout-header">Header</header>
|
|
8
|
+
<main class="layout-main">
|
|
9
|
+
<RouterView />
|
|
10
|
+
</main>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<style scoped lang="scss">
|
|
15
|
+
.default-layout {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.layout-header {
|
|
23
|
+
height: 60px;
|
|
24
|
+
padding: 0 24px;
|
|
25
|
+
background-color: $bg-color-base;
|
|
26
|
+
border-bottom: 1px solid $border-color-base;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.layout-main {
|
|
30
|
+
flex: 1;
|
|
31
|
+
overflow: auto;
|
|
32
|
+
}
|
|
33
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# placeholder
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createApp } from 'vue';
|
|
2
|
+
import { createPinia } from 'pinia';
|
|
3
|
+
import ElementPlus from 'element-plus';
|
|
4
|
+
import 'element-plus/dist/index.css';
|
|
5
|
+
import 'virtual:uno.css';
|
|
6
|
+
import './styles/global.scss';
|
|
7
|
+
|
|
8
|
+
import App from './App.vue';
|
|
9
|
+
import router from './router';
|
|
10
|
+
|
|
11
|
+
const app = createApp(App);
|
|
12
|
+
|
|
13
|
+
app.use(createPinia());
|
|
14
|
+
app.use(router);
|
|
15
|
+
app.use(ElementPlus);
|
|
16
|
+
|
|
17
|
+
app.mount('#app');
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createRouter, createWebHistory } from 'vue-router';
|
|
2
|
+
import type { RouteRecordRaw } from 'vue-router';
|
|
3
|
+
|
|
4
|
+
const routes: RouteRecordRaw[] = [
|
|
5
|
+
{
|
|
6
|
+
path: '/',
|
|
7
|
+
name: 'Home',
|
|
8
|
+
component: () => import('@/views/home/index.vue'),
|
|
9
|
+
},
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
const router = createRouter({
|
|
13
|
+
history: createWebHistory(),
|
|
14
|
+
routes,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export default router;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# placeholder
|