|
@@ -0,0 +1,100 @@
|
|
|
|
|
+# 升级指南
|
|
|
|
|
+
|
|
|
|
|
+分为4部分的内容:
|
|
|
|
|
+
|
|
|
|
|
+- uniapp sdk 升级
|
|
|
|
|
+- uni-helper 插件升级
|
|
|
|
|
+- oxlint 升级
|
|
|
|
|
+- 移除 eslint, stylelint
|
|
|
|
|
+- unocss 升级(可选)
|
|
|
|
|
+
|
|
|
|
|
+## uniapp sdk 升级
|
|
|
|
|
+
|
|
|
|
|
+```sh
|
|
|
|
|
+pnpm uvm # 升级 uniapp sdk
|
|
|
|
|
+# 如果以上命令不存在,请使用下面的
|
|
|
|
|
+npx @dcloudio/uvm@latest
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+然后进入交互式的升级模式,按照提示进行升级。期间包管理器选择 `pnpm`。
|
|
|
|
|
+
|
|
|
|
|
+升级完后,会自动引入 `vue-i18n`,不需要的可以删除它。(可选)
|
|
|
|
|
+
|
|
|
|
|
+## uni-helper 插件升级
|
|
|
|
|
+
|
|
|
|
|
+```sh
|
|
|
|
|
+"@uni-helper/uni-types": "1.0.0-alpha.3",
|
|
|
|
|
+"@uni-helper/unocss-preset-uni": "^0.2.11",
|
|
|
|
|
+"@uni-helper/vite-plugin-uni-components": "0.2.0",
|
|
|
|
|
+"@uni-helper/vite-plugin-uni-layouts": "0.1.10",
|
|
|
|
|
+"@uni-helper/vite-plugin-uni-manifest": "0.2.8",
|
|
|
|
|
+"@uni-helper/vite-plugin-uni-pages": "0.2.28",
|
|
|
|
|
+"@uni-helper/vite-plugin-uni-platform": "0.0.4",
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+把你项目里面的 `package.json` 里面的相关依赖包版本改成上面的。然后执行 `pnpm i` 安装。
|
|
|
|
|
+
|
|
|
|
|
+## oxlint 升级
|
|
|
|
|
+
|
|
|
|
|
+```sh
|
|
|
|
|
+pnpm add -D oxlint@v1.0.0 # 主要不要贪最新,最新的 v1.1.0 有问题,会报错。
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+`package.json` 里面的 `"lint-staged"` 内容改为:
|
|
|
|
|
+
|
|
|
|
|
+```json
|
|
|
|
|
+"lint-staged": {
|
|
|
|
|
+ "**/*.{html,cjs,json,md,scss,css,txt}": [
|
|
|
|
|
+ "prettier --write --cache"
|
|
|
|
|
+ ],
|
|
|
|
|
+ "**/*.{js,jsx,ts,tsx,vue,mjs,cjs,mts,cts}": [
|
|
|
|
|
+ "oxlint --fix",
|
|
|
|
|
+ "prettier --write --cache"
|
|
|
|
|
+ ],
|
|
|
|
|
+ "!**/{node_modules,dist}/**": []
|
|
|
|
|
+},
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+`package.json` 里面的 `scripts` 添加:
|
|
|
|
|
+
|
|
|
|
|
+```json
|
|
|
|
|
+scripts: {
|
|
|
|
|
+ // ... 其他
|
|
|
|
|
+ "lint": "oxlint",
|
|
|
|
|
+ "lint-fix": "oxlint --fix"
|
|
|
|
|
+}
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+然后在项目根目录新建 `.oxlintrc.json` 文件,内容如下:
|
|
|
|
|
+
|
|
|
|
|
+```json
|
|
|
|
|
+{
|
|
|
|
|
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
|
|
|
+ "extends": ["config:recommended"],
|
|
|
|
|
+ "plugins": ["import", "typescript", "unicorn"],
|
|
|
|
|
+ "rules": {
|
|
|
|
|
+ "no-console": "off",
|
|
|
|
|
+ "no-unused-vars": "off"
|
|
|
|
|
+ },
|
|
|
|
|
+ "env": {
|
|
|
|
|
+ "es6": true
|
|
|
|
|
+ },
|
|
|
|
|
+ "globals": {
|
|
|
|
|
+ "foo": "readonly"
|
|
|
|
|
+ },
|
|
|
|
|
+ "ignorePatterns": ["node_modules", "dist", "src/static/**", "src/uni_modules/**"],
|
|
|
|
|
+ "settings": {},
|
|
|
|
|
+ "overrides": [
|
|
|
|
|
+ {
|
|
|
|
|
+ "files": ["*.test.ts", "*.spec.ts"],
|
|
|
|
|
+ "rules": {
|
|
|
|
|
+ "@typescript-eslint/no-explicit-any": "off"
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+}
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+## unocss 升级(可选)
|
|
|
|
|
+
|
|
|
|
|
+有空再写,忙。
|