Bläddra i källkod

vite-config中将ant-design-vue升级到版本4 (#3089)

* fix: #3077 最新代码 ApiTransfer编辑后无法正常显示数据

* feat: 升级ant-design-vue至4.0.3

* feat: vite-config up to antd v4

* fix: 去掉console
黄小民 1 år sedan
förälder
incheckning
c315aa9801
4 ändrade filer med 30 tillägg och 44 borttagningar
  1. 1 1
      internal/vite-config/package.json
  2. 11 4
      internal/vite-config/src/utils/modifyVars.ts
  3. 1 1
      package.json
  4. 17 38
      pnpm-lock.yaml

+ 1 - 1
internal/vite-config/package.json

@@ -38,7 +38,7 @@
     "@types/fs-extra": "^11.0.1",
     "@vitejs/plugin-vue": "^4.2.3",
     "@vitejs/plugin-vue-jsx": "^3.0.1",
-    "ant-design-vue": "^3.2.20",
+    "ant-design-vue": "^4.0.3",
     "dayjs": "^1.11.9",
     "dotenv": "^16.3.1",
     "fs-extra": "^11.1.1",

+ 11 - 4
internal/vite-config/src/utils/modifyVars.ts

@@ -2,7 +2,11 @@ import { resolve } from 'node:path';
 
 import { generate } from '@ant-design/colors';
 // @ts-ignore: typo
-import { getThemeVariables } from 'ant-design-vue/dist/theme';
+/* import { getThemeVariables } from 'ant-design-vue/dist/theme'; */
+import { theme } from 'ant-design-vue/lib';
+import convertLegacyToken from 'ant-design-vue/lib/theme/convertLegacyToken';
+
+const { defaultAlgorithm, defaultSeed } = theme;
 
 const primaryColor = '#0960bd';
 
@@ -25,11 +29,14 @@ export function generateModifyVars() {
     primaryColorObj[`primary-${index + 1}`] = palettes[index];
   }
 
-  const modifyVars = getThemeVariables();
+  // const modifyVars = getThemeVariables();
+  const mapToken = defaultAlgorithm(defaultSeed);
+  const v3Token = convertLegacyToken(mapToken);
+
   return {
-    ...modifyVars,
+    ...v3Token,
     // reference:  Avoid repeated references
-    hack: `${modifyVars.hack} @import (reference) "${resolve('src/design/config.less')}";`,
+    hack: `true; @import (reference) "${resolve('src/design/config.less')}";`,
     'primary-color': primary,
     ...primaryColorObj,
     'info-color': primary,

+ 1 - 1
package.json

@@ -76,7 +76,7 @@
     "@vueuse/core": "^10.2.1",
     "@vueuse/shared": "^10.2.1",
     "@zxcvbn-ts/core": "^3.0.2",
-    "ant-design-vue": "^4.0.2",
+    "ant-design-vue": "^4.0.3",
     "axios": "^1.4.0",
     "codemirror": "^5.65.12",
     "cropperjs": "^1.5.13",

+ 17 - 38
pnpm-lock.yaml

@@ -36,8 +36,8 @@ importers:
         specifier: ^3.0.2
         version: 3.0.2
       ant-design-vue:
-        specifier: ^4.0.2
-        version: 4.0.2(vue@3.3.4)
+        specifier: ^4.0.3
+        version: 4.0.3(vue@3.3.4)
       axios:
         specifier: ^1.4.0
         version: 1.4.0
@@ -405,8 +405,8 @@ importers:
         specifier: ^3.0.1
         version: 3.0.1(vite@4.4.0)(vue@3.3.4)
       ant-design-vue:
-        specifier: ^3.2.20
-        version: 3.2.20(vue@3.3.4)
+        specifier: ^4.0.3
+        version: 4.0.3(vue@3.3.4)
       dayjs:
         specifier: ^1.11.9
         version: 1.11.9
@@ -504,6 +504,16 @@ packages:
       '@ant-design/colors': 6.0.0
       '@ant-design/icons-svg': 4.2.1
       vue: 3.3.4
+    dev: false
+
+  /@ant-design/icons-vue@7.0.0(vue@3.3.4):
+    resolution: {integrity: sha512-VEb0r/Jqo2qi9olfBephYlyxbmhQVZ5+tJ3Zw5VaBd5h0wV1zdjGt5mJxSbRRs2mnnOWpsa1s4PeoLwNnkLV/w==}
+    peerDependencies:
+      vue: '>=3.0.3'
+    dependencies:
+      '@ant-design/colors': 6.0.0
+      '@ant-design/icons-svg': 4.2.1
+      vue: 3.3.4
 
   /@antfu/install-pkg@0.1.1:
     resolution: {integrity: sha512-LyB/8+bSfa0DFGC06zpCEfs89/XoWZwws5ygEa5D+Xsm3OfI+aXQ86VgVG7Acyef+rSZ5HE7J8rrxzrQeM3PjQ==}
@@ -1128,11 +1138,9 @@ packages:
 
   /@emotion/hash@0.9.1:
     resolution: {integrity: sha512-gJB6HLm5rYwSLI6PQa+X1t5CFGrv1J1TWG+sOyMCeKz2ojaj6Fnl/rZEspogG+cvqbt4AE/2eIyD2QfLKTBNlQ==}
-    dev: false
 
   /@emotion/unitless@0.8.1:
     resolution: {integrity: sha512-KOEGMu6dmJZtpadb476IsZBclKvILjopjUii3V+7MnXIQCYh8W3NgNcgwo21n9LXZX6EDIKvqfjYxXebDwxKmQ==}
-    dev: false
 
   /@esbuild/android-arm64@0.17.19:
     resolution: {integrity: sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==}
@@ -3390,40 +3398,14 @@ packages:
     engines: {node: '>=12'}
     dev: true
 
-  /ant-design-vue@3.2.20(vue@3.3.4):
-    resolution: {integrity: sha512-YWpMfGaGoRastIXEYfCoJiaRiDHk4chqtYhlKQM5GqPt6NfvrM1Vg2e60yHtjxlZjed91wCMm0rAmyUr7Hwzdg==}
-    engines: {node: '>=12.22.0'}
-    peerDependencies:
-      vue: '>=3.2.0'
-    dependencies:
-      '@ant-design/colors': 6.0.0
-      '@ant-design/icons-vue': 6.1.0(vue@3.3.4)
-      '@babel/runtime': 7.22.6
-      '@ctrl/tinycolor': 3.6.0
-      '@simonwep/pickr': 1.8.2
-      array-tree-filter: 2.1.0
-      async-validator: 4.2.5
-      dayjs: 1.11.9
-      dom-align: 1.12.4
-      dom-scroll-into-view: 2.0.1
-      lodash: 4.17.21
-      lodash-es: 4.17.21
-      resize-observer-polyfill: 1.5.1
-      scroll-into-view-if-needed: 2.2.31
-      shallow-equal: 1.2.1
-      vue: 3.3.4
-      vue-types: 3.0.2(vue@3.3.4)
-      warning: 4.0.3
-    dev: true
-
-  /ant-design-vue@4.0.2(vue@3.3.4):
-    resolution: {integrity: sha512-4vD/mVXne1avmYo5j3V9bqAlMfxTu2D+k0j6dTN++OJZOjkuaV3waMLP1EJY0nj1xl0qUV96u7OD5xgTYfdtBQ==}
+  /ant-design-vue@4.0.3(vue@3.3.4):
+    resolution: {integrity: sha512-fbgZbbirLx7rc19ytaGxApwS01CKLRzvEZmH0TVF06niQA9ekx7xkvfQGlmiSaCs4b8nWZi4Bo7gUzRNRt5YJA==}
     engines: {node: '>=12.22.0'}
     peerDependencies:
       vue: '>=3.2.0'
     dependencies:
       '@ant-design/colors': 6.0.0
-      '@ant-design/icons-vue': 6.1.0(vue@3.3.4)
+      '@ant-design/icons-vue': 7.0.0(vue@3.3.4)
       '@babel/runtime': 7.22.6
       '@ctrl/tinycolor': 3.6.0
       '@emotion/hash': 0.9.1
@@ -3445,7 +3427,6 @@ packages:
       vue: 3.3.4
       vue-types: 3.0.2(vue@3.3.4)
       warning: 4.0.3
-    dev: false
 
   /any-promise@1.3.0:
     resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==}
@@ -10562,7 +10543,6 @@ packages:
 
   /stylis@4.3.0:
     resolution: {integrity: sha512-E87pIogpwUsUwXw7dNyU4QDjdgVMy52m+XEOPEKUn161cCzWjjhPSQhByfd1CcNvrOLnXQ6OnnZDwnJrz/Z4YQ==}
-    dev: false
 
   /sucrase@3.32.0:
     resolution: {integrity: sha512-ydQOU34rpSyj2TGyz4D2p8rbktIOZ8QY9s+DGLvFU1i5pWJE8vkpruCjGCMHsdXwnD7JDcS+noSwM/a7zyNFDQ==}
@@ -10767,7 +10747,6 @@ packages:
   /throttle-debounce@5.0.0:
     resolution: {integrity: sha512-2iQTSgkkc1Zyk0MeVrt/3BvuOXYPl/R8Z0U2xxo9rjwNciaHDG3R+Lm6dh4EeUci49DanvBnuqI6jshoQQRGEg==}
     engines: {node: '>=12.22'}
-    dev: false
 
   /through2@4.0.2:
     resolution: {integrity: sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==}