tk-vue3-template 0.0.5 → 0.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/.nvmrc +1 -0
- package/README.md +9 -5
- package/eslint.config.js +32 -1
- package/package.json +22 -22
- package/vite.config.js +22 -24
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
26
|
package/README.md
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# vue3项目模版
|
|
2
2
|
|
|
3
3
|
This template should help get you started developing with Vue 3 in Vite.
|
|
4
4
|
|
|
5
|
+
#环境要求
|
|
6
|
+
|
|
7
|
+
node >= 26, pnpm 12+
|
|
8
|
+
|
|
5
9
|
## Recommended IDE Setup
|
|
6
10
|
|
|
7
11
|
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
|
|
@@ -13,23 +17,23 @@ See [Vite Configuration Reference](https://vite.dev/config/).
|
|
|
13
17
|
## Project Setup
|
|
14
18
|
|
|
15
19
|
```sh
|
|
16
|
-
|
|
20
|
+
pnpm install
|
|
17
21
|
```
|
|
18
22
|
|
|
19
23
|
### Compile and Hot-Reload for Development
|
|
20
24
|
|
|
21
25
|
```sh
|
|
22
|
-
|
|
26
|
+
pnpm dev
|
|
23
27
|
```
|
|
24
28
|
|
|
25
29
|
### Compile and Minify for Production
|
|
26
30
|
|
|
27
31
|
```sh
|
|
28
|
-
|
|
32
|
+
pnpm build
|
|
29
33
|
```
|
|
30
34
|
|
|
31
35
|
### Lint with [ESLint](https://eslint.org/)
|
|
32
36
|
|
|
33
37
|
```sh
|
|
34
|
-
|
|
38
|
+
pnpm lint
|
|
35
39
|
```
|
package/eslint.config.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import js from '@eslint/js'
|
|
2
2
|
import pluginVue from 'eslint-plugin-vue'
|
|
3
3
|
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
|
|
4
|
+
import globals from 'globals'
|
|
4
5
|
|
|
5
6
|
export default [
|
|
6
7
|
{
|
|
@@ -10,10 +11,40 @@ export default [
|
|
|
10
11
|
|
|
11
12
|
{
|
|
12
13
|
name: 'app/files-to-ignore',
|
|
13
|
-
ignores: [
|
|
14
|
+
ignores: [
|
|
15
|
+
'**/dist/**',
|
|
16
|
+
'**/dist-ssr/**',
|
|
17
|
+
'**/coverage/**',
|
|
18
|
+
'dist/**',
|
|
19
|
+
'vite.config.js.timestamp-*.mjs',
|
|
20
|
+
],
|
|
14
21
|
},
|
|
15
22
|
|
|
16
23
|
js.configs.recommended,
|
|
17
24
|
...pluginVue.configs['flat/essential'],
|
|
25
|
+
{
|
|
26
|
+
name: 'app/browser-globals',
|
|
27
|
+
files: ['src/**/*.{js,mjs,jsx,vue}'],
|
|
28
|
+
languageOptions: {
|
|
29
|
+
globals: globals.browser,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'app/request-globals',
|
|
34
|
+
files: ['src/utils/request.js'],
|
|
35
|
+
languageOptions: {
|
|
36
|
+
globals: {
|
|
37
|
+
api_url: 'readonly',
|
|
38
|
+
focus: 'readonly',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'app/node-globals',
|
|
44
|
+
files: ['*.config.js'],
|
|
45
|
+
languageOptions: {
|
|
46
|
+
globals: globals.node,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
18
49
|
skipFormatting,
|
|
19
50
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tk-vue3-template",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Vue 3 基础模板(含通用配置)",
|
|
@@ -9,39 +9,39 @@
|
|
|
9
9
|
"dev": "vite",
|
|
10
10
|
"build": "vite build",
|
|
11
11
|
"preview": "vite preview",
|
|
12
|
-
"lint": "eslint . --
|
|
13
|
-
"format": "prettier --write src/"
|
|
12
|
+
"lint": "eslint . --max-warnings 0 --cache --cache-strategy content --cache-location node_modules/.cache/eslint/.eslintcache",
|
|
13
|
+
"format": "prettier --write src/",
|
|
14
|
+
"lint:fix": "eslint . --max-warnings 0 --fix --cache --cache-strategy content --cache-location node_modules/.cache/eslint/.eslintcache"
|
|
14
15
|
},
|
|
15
16
|
"dependencies": {
|
|
16
17
|
"ali-oss": "^6.23.0",
|
|
17
18
|
"amfe-flexible": "^2.2.1",
|
|
18
|
-
"
|
|
19
|
-
"axios": "^1.13.2",
|
|
19
|
+
"axios": "^1.21.1",
|
|
20
20
|
"crypto-js": "^4.2.0",
|
|
21
21
|
"dsbridge": "^3.1.4",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"pinia": "^2.2.6",
|
|
22
|
+
"js-md5": "^0.9.2",
|
|
23
|
+
"pinia": "^3.0.4",
|
|
25
24
|
"shelljs": "^0.10.0",
|
|
26
|
-
"vant": "^4.
|
|
27
|
-
"vue": "^3.5.
|
|
28
|
-
"vue-router": "^4.
|
|
25
|
+
"vant": "^4.10.2",
|
|
26
|
+
"vue": "^3.5.45",
|
|
27
|
+
"vue-router": "^4.6.5"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
|
-
"@eslint/js": "^
|
|
32
|
-
"@vitejs/plugin-vue": "^
|
|
33
|
-
"@vue/eslint-config-prettier": "^10.
|
|
34
|
-
"eslint": "^
|
|
35
|
-
"eslint-plugin-vue": "^
|
|
36
|
-
"less": "^4.
|
|
37
|
-
"less-loader": "^12.3.0",
|
|
30
|
+
"@eslint/js": "^10.0.1",
|
|
31
|
+
"@vitejs/plugin-vue": "^6.0.11",
|
|
32
|
+
"@vue/eslint-config-prettier": "^10.2.0",
|
|
33
|
+
"eslint": "^10.15.0",
|
|
34
|
+
"eslint-plugin-vue": "^10.12.1",
|
|
35
|
+
"less": "^4.9.1",
|
|
38
36
|
"postcss-pxtorem": "^6.1.0",
|
|
39
|
-
"prettier": "^3.
|
|
37
|
+
"prettier": "^3.10.1",
|
|
40
38
|
"vconsole": "^3.15.1",
|
|
41
|
-
"vite": "^
|
|
42
|
-
"
|
|
39
|
+
"vite": "^8.3.8",
|
|
40
|
+
"autoprefixer": "^10.6.2",
|
|
41
|
+
"globals": "^17.14.0"
|
|
43
42
|
},
|
|
44
43
|
"engines": {
|
|
45
|
-
"node": ">=
|
|
44
|
+
"node": ">=26",
|
|
45
|
+
"pnpm": ">=12"
|
|
46
46
|
}
|
|
47
47
|
}
|
package/vite.config.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { fileURLToPath, URL } from 'node:url'
|
|
2
2
|
|
|
3
|
-
import { defineConfig } from 'vite'
|
|
3
|
+
import { defineConfig, loadEnv } from 'vite'
|
|
4
4
|
import vue from '@vitejs/plugin-vue'
|
|
5
5
|
import autoprefixer from 'autoprefixer'
|
|
6
6
|
import pxtorem from 'postcss-pxtorem'
|
|
7
7
|
|
|
8
8
|
// https://vite.dev/config/
|
|
9
|
-
const outputDir = '
|
|
10
|
-
const
|
|
11
|
-
export default defineConfig(({ mode })=>{
|
|
9
|
+
const outputDir = 'dist'
|
|
10
|
+
const CWD = process.cwd()
|
|
11
|
+
export default defineConfig(({ mode }) => {
|
|
12
12
|
const isProduction = mode === 'production'
|
|
13
|
+
const { VITE_VERSION } = loadEnv(mode, CWD)
|
|
14
|
+
const staticVersion = VITE_VERSION || 'BUILD_VERSION'
|
|
13
15
|
return {
|
|
14
16
|
base: './',
|
|
15
|
-
plugins: [
|
|
16
|
-
vue()
|
|
17
|
-
],
|
|
17
|
+
plugins: [vue()],
|
|
18
18
|
resolve: {
|
|
19
19
|
alias: {
|
|
20
|
-
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
20
|
+
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
23
|
server: {
|
|
24
|
-
host: '0.0.0.0',
|
|
25
|
-
port: 3000,
|
|
24
|
+
host: '0.0.0.0', // 允许外部访问
|
|
25
|
+
port: 3000, // 指定端口,可选
|
|
26
26
|
},
|
|
27
27
|
build: {
|
|
28
28
|
outDir: outputDir,
|
|
29
29
|
assetsDir: staticVersion,
|
|
30
30
|
sourcemap: false,
|
|
31
|
-
|
|
31
|
+
target: ['es2020'],
|
|
32
32
|
// 配置代码分割
|
|
33
|
-
|
|
33
|
+
rolldownOptions: {
|
|
34
34
|
plugins: [
|
|
35
35
|
{
|
|
36
36
|
name: 'file-manager-plugin',
|
|
@@ -38,18 +38,17 @@ export default defineConfig(({ mode })=>{
|
|
|
38
38
|
if (isProduction) {
|
|
39
39
|
this.emitFile({
|
|
40
40
|
type: 'asset',
|
|
41
|
-
|
|
42
|
-
source: './version.txt'
|
|
41
|
+
source: './version.txt',
|
|
43
42
|
})
|
|
44
43
|
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
]
|
|
48
|
-
}
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
49
48
|
},
|
|
50
49
|
// 扩展依赖预构建
|
|
51
50
|
optimizeDeps: {
|
|
52
|
-
include: ['vue', 'vue-router', 'pinia', 'vant', 'axios', 'dsbridge']
|
|
51
|
+
include: ['vue', 'vue-router', 'pinia', 'vant', 'axios', 'dsbridge'],
|
|
53
52
|
},
|
|
54
53
|
css: {
|
|
55
54
|
postcss: {
|
|
@@ -58,11 +57,10 @@ export default defineConfig(({ mode })=>{
|
|
|
58
57
|
pxtorem({
|
|
59
58
|
rootValue: 37.5,
|
|
60
59
|
propList: ['*'],
|
|
61
|
-
selectorBlackList: ['van-circle__layer']
|
|
62
|
-
})
|
|
63
|
-
]
|
|
64
|
-
}
|
|
60
|
+
selectorBlackList: ['van-circle__layer'],
|
|
61
|
+
}),
|
|
62
|
+
],
|
|
63
|
+
},
|
|
65
64
|
},
|
|
66
65
|
}
|
|
67
|
-
|
|
68
66
|
})
|