mirror of
https://gitee.com/h_mo/uniapp-vue3-vite-ts-template
synced 2025-04-06 03:58:03 +08:00
commit
04e334ece1
10
.vscode/extensions.json
vendored
Normal file
10
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"CodeInChinese.EnglishChineseDictionary", // 翻译(英汉词典)
|
||||||
|
"kisstkondoros.vscode-gutter-preview", // Image 预览
|
||||||
|
"ritwickdey.LiveServer", // 为静态和动态页面启动具有实时重载功能的本地开发服务器
|
||||||
|
"antfu.unocss", // UnoCSS 原子化css
|
||||||
|
"esbenp.prettier-vscode", // 格式化
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
16
.vscode/settings.json
vendored
16
.vscode/settings.json
vendored
@ -1,5 +1,13 @@
|
|||||||
{
|
{
|
||||||
"editor.formatOnSave": true, //保存时格式化
|
// 参考:https://blog.csdn.net/weixin_46238462/article/details/125867532
|
||||||
"editor.detectIndentation": false,
|
|
||||||
"editor.tabSize": 4
|
"editor.defaultFormatter": "esbenp.prettier-vscode", // 定义一个默认格式化程序, 该格式化程序优先于所有其他格式化程序设置。必须是提供格式化程序的扩展的标识符。
|
||||||
}
|
"editor.formatOnSave": true, //在保存时格式化文件。格式化程序必须可用,延迟后文件不能保存,并且编辑器不能关闭。
|
||||||
|
"editor.detectIndentation": false, // 控制在基于文件内容打开文件时是否自动检测 #editor.tabSize# 和 #editor.insertSpaces#。
|
||||||
|
"editor.tabSize": 4,
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.fixAll": true, // 控制是否应在文件保存时运行自动修复操作。
|
||||||
|
"source.fixAll.eslint": true,
|
||||||
|
"source.fixAll.stylelint": true
|
||||||
|
}, // 要在保存时运行的代码操作种类。
|
||||||
|
}
|
21
README.md
21
README.md
@ -1,6 +1,17 @@
|
|||||||
|
# 🌈 uni-app Vue3 Vite4 pinia2 TypeScript 基础框架
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img src="https://img.shields.io/badge/-Vue3.2-34495e?logo=vue.js" />
|
||||||
|
<img src="https://img.shields.io/badge/-Vite4-646cff?logo=vite&logoColor=white" />
|
||||||
|
<img src="https://img.shields.io/badge/-Pinia2-yellow?logo=picpay&logoColor=white" />
|
||||||
|
<img src="https://img.shields.io/badge/-TypeScript4.9-blue?logo=typescript&logoColor=white" />
|
||||||
|
<img src="https://img.shields.io/badge/-ESLint8-4b32c3?logo=eslint&logoColor=white" />
|
||||||
|
<img src="https://img.shields.io/badge/-pnpm7-F69220?logo=pnpm&logoColor=white" />
|
||||||
|
</p>
|
||||||
|
|
||||||
## 简介
|
## 简介
|
||||||
|
|
||||||
- **uni-app Vue3 Vite TypeScript 基础框架**
|
- **uni-app Vue3 Vite4 pinia2 TypeScript 基础框架**
|
||||||
- cli创建的Vue3/Vite项目 与 使用HBuilderX导入插件 的包有差异,请直接访问 [开源地址](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template)
|
- cli创建的Vue3/Vite项目 与 使用HBuilderX导入插件 的包有差异,请直接访问 [开源地址](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template)
|
||||||
- 访问[uniapp插件](https://ext.dcloud.net.cn/plugin?id=8559)
|
- 访问[uniapp插件](https://ext.dcloud.net.cn/plugin?id=8559)
|
||||||
|
|
||||||
@ -12,6 +23,7 @@
|
|||||||
- 其他平台暂未测试,后续会增加;
|
- 其他平台暂未测试,后续会增加;
|
||||||
- 如发现问题或建议可在评论区留言, 或提[Issues](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/issues)及[PR](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/pulls),会及时处理;
|
- 如发现问题或建议可在评论区留言, 或提[Issues](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/issues)及[PR](https://gitee.com/h_mo/uniapp-vue3-vite-ts-template/pulls),会及时处理;
|
||||||
- 如有需求亦可在评论区留言,或在此项目基础上增加;
|
- 如有需求亦可在评论区留言,或在此项目基础上增加;
|
||||||
|
- [代码规范 & 详细解释 husky、prettier、eslint、lint-staged 的作用和使用](https://blog.csdn.net/cookcyq__/article/details/125457031)
|
||||||
|
|
||||||
## 特性
|
## 特性
|
||||||
|
|
||||||
@ -136,6 +148,13 @@ pnpm dev:h5
|
|||||||
pnpm build:h5
|
pnpm build:h5
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- 更新依赖到最新(新手请忽略)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pnpm up
|
||||||
|
# 打开HBuilder X alpha桌面程序-->点击上面的帮助-->历次更新说明-->获取最新版本号(如:3.7.2.20230217-alpha)
|
||||||
|
npx @dcloudio/uvm 3.7.2.20230217-alpha
|
||||||
|
```
|
||||||
## Git 贡献提交规范
|
## Git 贡献提交规范
|
||||||
|
|
||||||
- 参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 规范 ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular))
|
- 参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 规范 ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular))
|
||||||
|
205
package.json
205
package.json
@ -1,104 +1,105 @@
|
|||||||
{
|
{
|
||||||
"name": "uniapp_vue3_vite_ts",
|
"name": "uniapp_vue3_vite_ts",
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev:app": "uni -p app",
|
"dev:app": "uni -p app",
|
||||||
"dev:custom": "uni -p",
|
"dev:custom": "uni -p",
|
||||||
"dev:h5": "uni",
|
"dev:h5": "uni",
|
||||||
"dev:h5:ssr": "uni --ssr",
|
"dev:h5:ssr": "uni --ssr",
|
||||||
"dev:mp-alipay": "uni -p mp-alipay",
|
"dev:mp-alipay": "uni -p mp-alipay",
|
||||||
"dev:mp-baidu": "uni -p mp-baidu",
|
"dev:mp-baidu": "uni -p mp-baidu",
|
||||||
"dev:mp-kuaishou": "uni -p mp-kuaishou",
|
"dev:mp-kuaishou": "uni -p mp-kuaishou",
|
||||||
"dev:mp-lark": "uni -p mp-lark",
|
"dev:mp-lark": "uni -p mp-lark",
|
||||||
"dev:mp-qq": "uni -p mp-qq",
|
"dev:mp-qq": "uni -p mp-qq",
|
||||||
"dev:mp-toutiao": "uni -p mp-toutiao",
|
"dev:mp-toutiao": "uni -p mp-toutiao",
|
||||||
"dev:mp-weixin": "uni -p mp-weixin",
|
"dev:mp-weixin": "uni -p mp-weixin",
|
||||||
"dev:quickapp-webview": "uni -p quickapp-webview",
|
"dev:quickapp-webview": "uni -p quickapp-webview",
|
||||||
"dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",
|
"dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",
|
||||||
"dev:quickapp-webview-union": "uni -p quickapp-webview-union",
|
"dev:quickapp-webview-union": "uni -p quickapp-webview-union",
|
||||||
"build:app": "uni build -p app",
|
"build:app": "uni build -p app",
|
||||||
"build:custom": "uni build -p",
|
"build:custom": "uni build -p",
|
||||||
"build:h5": "uni build --minify",
|
"build:h5": "uni build --minify",
|
||||||
"build:h5:ssr": "uni build --ssr",
|
"build:h5:ssr": "uni build --ssr",
|
||||||
"build:mp-alipay": "uni build -p mp-alipay",
|
"build:mp-alipay": "uni build -p mp-alipay",
|
||||||
"build:mp-baidu": "uni build -p mp-baidu",
|
"build:mp-baidu": "uni build -p mp-baidu",
|
||||||
"build:mp-kuaishou": "uni build -p mp-kuaishou",
|
"build:mp-kuaishou": "uni build -p mp-kuaishou",
|
||||||
"build:mp-lark": "uni build -p mp-lark",
|
"build:mp-lark": "uni build -p mp-lark",
|
||||||
"build:mp-qq": "uni build -p mp-qq",
|
"build:mp-qq": "uni build -p mp-qq",
|
||||||
"build:mp-toutiao": "uni build -p mp-toutiao",
|
"build:mp-toutiao": "uni build -p mp-toutiao",
|
||||||
"build:mp-weixin": "uni build -p mp-weixin --minify",
|
"build:mp-weixin": "uni build -p mp-weixin --minify",
|
||||||
"build:quickapp-webview": "uni build -p quickapp-webview",
|
"build:quickapp-webview": "uni build -p quickapp-webview",
|
||||||
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
|
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
|
||||||
"build:quickapp-webview-union": "uni build -p quickapp-webview-union",
|
"build:quickapp-webview-union": "uni build -p quickapp-webview-union",
|
||||||
"lint": "eslint --cache --max-warnings 0 \"src/**/*.{vue,ts}\" --fix",
|
"lint": "eslint --cache --max-warnings 0 \"src/**/*.{vue,ts}\" --fix",
|
||||||
"prettier": "prettier --write \"src/**/*.{js,ts,json,css,scss,vue}\"",
|
"prettier": "prettier --write \"src/**/*.{js,ts,json,css,scss,vue}\"",
|
||||||
"prepare": "husky install"
|
"prepare": "husky install"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dcloudio/uni-app": "3.0.0-alpha-3070220230217001",
|
"@dcloudio/uni-app": "3.0.0-alpha-3070220230217001",
|
||||||
"@dcloudio/uni-app-plus": "3.0.0-alpha-3070220230217001",
|
"@dcloudio/uni-app-plus": "3.0.0-alpha-3070220230217001",
|
||||||
"@dcloudio/uni-components": "3.0.0-alpha-3070220230217001",
|
"@dcloudio/uni-components": "3.0.0-alpha-3070220230217001",
|
||||||
"@dcloudio/uni-h5": "3.0.0-alpha-3070220230217001",
|
"@dcloudio/uni-h5": "3.0.0-alpha-3070220230217001",
|
||||||
"@dcloudio/uni-i18n": "3.0.0-alpha-3070220230217001",
|
"@dcloudio/uni-i18n": "3.0.0-alpha-3061620230106001",
|
||||||
"@dcloudio/uni-mp-alipay": "3.0.0-alpha-3070220230217001",
|
"@dcloudio/uni-mp-alipay": "3.0.0-alpha-3070220230217001",
|
||||||
"@dcloudio/uni-mp-baidu": "3.0.0-alpha-3070220230217001",
|
"@dcloudio/uni-mp-baidu": "3.0.0-alpha-3070220230217001",
|
||||||
"@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-3070220230217001",
|
"@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-3070220230217001",
|
||||||
"@dcloudio/uni-mp-lark": "3.0.0-alpha-3070220230217001",
|
"@dcloudio/uni-mp-lark": "3.0.0-alpha-3070220230217001",
|
||||||
"@dcloudio/uni-mp-qq": "3.0.0-alpha-3070220230217001",
|
"@dcloudio/uni-mp-qq": "3.0.0-alpha-3070220230217001",
|
||||||
"@dcloudio/uni-mp-toutiao": "3.0.0-alpha-3070220230217001",
|
"@dcloudio/uni-mp-toutiao": "3.0.0-alpha-3070220230217001",
|
||||||
"@dcloudio/uni-mp-weixin": "3.0.0-alpha-3070220230217001",
|
"@dcloudio/uni-mp-weixin": "3.0.0-alpha-3070220230217001",
|
||||||
"@dcloudio/uni-quickapp-webview": "3.0.0-alpha-3070220230217001",
|
"@dcloudio/uni-quickapp-webview": "3.0.0-alpha-3070220230217001",
|
||||||
"@fortawesome/fontawesome-free": "^6.3.0",
|
"@fortawesome/fontawesome-free": "^6.3.0",
|
||||||
"@iconify/iconify": "^3.1.0",
|
"@iconify/iconify": "^3.1.0",
|
||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.1.1",
|
||||||
"echarts": "^5.4.1",
|
"echarts": "^5.4.1",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"luch-request": "^3.0.8",
|
"luch-request": "^3.0.8",
|
||||||
"pinia": "^2.0.30",
|
"pinia": "^2.0.32",
|
||||||
"qs": "^6.11.0",
|
"qs": "^6.11.0",
|
||||||
"vue": "^3.2.47",
|
"vue": "^3.2.47",
|
||||||
"vue-i18n": "^9.2.2"
|
"vue-i18n": "^9.2.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@dcloudio/types": "^2.6.12",
|
"@dcloudio/types": "^3.2.11",
|
||||||
"@dcloudio/uni-automator": "3.0.0-alpha-3070220230217001",
|
"@dcloudio/uni-automator": "3.0.0-alpha-3070220230217001",
|
||||||
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3070220230217001",
|
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3070220230217001",
|
||||||
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-3070220230217001",
|
"@dcloudio/uni-stacktracey": "3.0.0-alpha-3070220230217001",
|
||||||
"@iconify/json": "^2.2.24",
|
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-3070220230217001",
|
||||||
"@types/crypto-js": "^4.1.1",
|
"@iconify/json": "^2.2.24",
|
||||||
"@types/lodash-es": "^4.17.6",
|
"@types/crypto-js": "^4.1.1",
|
||||||
"@types/node": "^17.0.45",
|
"@types/lodash-es": "^4.17.6",
|
||||||
"@types/qs": "^6.9.7",
|
"@types/node": "^17.0.45",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.52.0",
|
"@types/qs": "^6.9.7",
|
||||||
"@typescript-eslint/parser": "^5.52.0",
|
"@typescript-eslint/eslint-plugin": "^5.53.0",
|
||||||
"@unocss/preset-icons": "^0.46.5",
|
"@typescript-eslint/parser": "^5.53.0",
|
||||||
"autoprefixer": "^10.4.13",
|
"@unocss/preset-icons": "^0.46.5",
|
||||||
"eslint": "^8.34.0",
|
"autoprefixer": "^10.4.13",
|
||||||
"eslint-config-prettier": "^8.6.0",
|
"eslint": "^8.34.0",
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-config-prettier": "^8.6.0",
|
||||||
"eslint-plugin-vue": "^9.9.0",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"husky": "^8.0.3",
|
"eslint-plugin-vue": "^9.9.0",
|
||||||
"lint-staged": "^13.1.2",
|
"husky": "^8.0.3",
|
||||||
"mrm": "^4.1.13",
|
"lint-staged": "^13.1.2",
|
||||||
"postcss": "^8.4.21",
|
"mrm": "^4.1.13",
|
||||||
"prettier": "^2.8.4",
|
"postcss": "^8.4.21",
|
||||||
"sass": "^1.58.3",
|
"prettier": "^2.8.4",
|
||||||
"typescript": "^4.9.5",
|
"sass": "^1.58.3",
|
||||||
"unocss": "^0.46.5",
|
"typescript": "^4.9.5",
|
||||||
"unocss-preset-weapp": "^0.2.5",
|
"unocss": "^0.46.5",
|
||||||
"unplugin-vue-components": "^0.22.12",
|
"unocss-preset-weapp": "^0.2.5",
|
||||||
"vite": "^4.1.2",
|
"unplugin-vue-components": "^0.22.12",
|
||||||
"vite-plugin-eslint": "^1.8.1"
|
"vite": "^4.0.3",
|
||||||
},
|
"vite-plugin-eslint": "^1.8.1"
|
||||||
"husky": {
|
},
|
||||||
"hooks": {
|
"husky": {
|
||||||
"pre-commit": "lint-staged"
|
"hooks": {
|
||||||
}
|
"pre-commit": "lint-staged"
|
||||||
},
|
}
|
||||||
"lint-staged": {
|
},
|
||||||
"*.{js,jsx,vue,ts,tsx}": [
|
"lint-staged": {
|
||||||
"prettier --write",
|
"*.{js,jsx,vue,ts,tsx}": [
|
||||||
"git add"
|
"prettier --write",
|
||||||
]
|
"git add"
|
||||||
}
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,49 @@ import { resolve } from 'path';
|
|||||||
import { loadEnv } from 'vite';
|
import { loadEnv } from 'vite';
|
||||||
import Unocss from 'unocss/vite';
|
import Unocss from 'unocss/vite';
|
||||||
|
|
||||||
|
//发布时动态修改 manifest.json
|
||||||
|
// if (process.env.NODE_ENV === 'production') {
|
||||||
|
// // 读取 manifest.json ,修改后重新写入
|
||||||
|
// const fs = require('fs');
|
||||||
|
// const manifestPath = './src/manifest.json';
|
||||||
|
// let Manifest = fs.readFileSync(manifestPath, { encoding: 'utf-8' });
|
||||||
|
// function replaceManifest(path: string, value: any) {
|
||||||
|
// const arr = path.split('.');
|
||||||
|
// const len = arr.length;
|
||||||
|
// const lastItem = arr[len - 1];
|
||||||
|
|
||||||
|
// let i = 0;
|
||||||
|
// let ManifestArr = Manifest.split(/\n/);
|
||||||
|
|
||||||
|
// for (let index = 0; index < ManifestArr.length; index++) {
|
||||||
|
// const item = ManifestArr[index];
|
||||||
|
// if (new RegExp(`"${arr[i]}"`).test(item)) ++i;
|
||||||
|
// if (i === len) {
|
||||||
|
// const hasComma = /,/.test(item);
|
||||||
|
// ManifestArr[index] = item.replace(new RegExp(`"${lastItem}"[\\s\\S]*:[\\s\\S]*`), `"${lastItem}": ${value}${hasComma ? ',' : ''}`);
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Manifest = ManifestArr.join('\n');
|
||||||
|
// }
|
||||||
|
// let Data1 = new Date().toLocaleDateString();
|
||||||
|
// let Data2 = new Date().toLocaleTimeString();
|
||||||
|
// let Data_ = Data1.replace(/\//g, '-') + ' ' + Data2;
|
||||||
|
// // 使用
|
||||||
|
// replaceManifest('description', JSON.stringify(`app平台-${Data_}`));
|
||||||
|
// replaceManifest(
|
||||||
|
// 'versionName',
|
||||||
|
// JSON.stringify(
|
||||||
|
// String(Number(JSON.parse(Manifest).versionCode) + 1)
|
||||||
|
// .split('')
|
||||||
|
// .join('.')
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
// replaceManifest('versionCode', JSON.stringify(String(Number(JSON.parse(Manifest).versionCode) + 1)));
|
||||||
|
// fs.writeFileSync(manifestPath, Manifest, { flag: 'w' });
|
||||||
|
// }
|
||||||
|
|
||||||
// https://vitejs.cn/config/
|
// https://vitejs.cn/config/
|
||||||
export default ({ mode }: ConfigEnv): UserConfig => {
|
export default ({ mode }: ConfigEnv): UserConfig => {
|
||||||
const root = process.cwd();
|
const root = process.cwd();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user