Commit 418ca2405e5920239f5a78f652a715e68449582d

Authored by zuihou
2 parents 923ecdab 7c21eb9b

Merge remote-tracking branch 'origin/main'

Too many changes to show.

To preserve performance only 14 of 83 files are displayed.

.eslintrc.js
1   -// @ts-check
2   -const { defineConfig } = require('eslint-define-config');
3   -module.exports = defineConfig({
  1 +module.exports = {
4 2 root: true,
5 3 env: {
6 4 browser: true,
... ... @@ -20,9 +18,7 @@ module.exports = defineConfig({
20 18 extends: [
21 19 'plugin:vue/vue3-recommended',
22 20 'plugin:@typescript-eslint/recommended',
23   - 'prettier',
24 21 'plugin:prettier/recommended',
25   - 'plugin:jest/recommended',
26 22 ],
27 23 rules: {
28 24 'vue/script-setup-uses-vars': 'error',
... ... @@ -77,4 +73,4 @@ module.exports = defineConfig({
77 73 ],
78 74 'vue/multi-word-component-names': 'off',
79 75 },
80   -});
  76 +};
... ...
.vscode/settings.json
... ... @@ -55,7 +55,7 @@
55 55 "**/yarn.lock": true
56 56 },
57 57 "stylelint.enable": true,
58   - "stylelint.packageManager": "yarn",
  58 + "stylelint.validate": ["css", "less", "postcss", "scss", "vue", "sass"],
59 59 "path-intellisense.mappings": {
60 60 "/@/": "${workspaceRoot}/src"
61 61 },
... ... @@ -88,7 +88,8 @@
88 88 },
89 89 "[vue]": {
90 90 "editor.codeActionsOnSave": {
91   - "source.fixAll.eslint": false
  91 + "source.fixAll.eslint": true,
  92 + "source.fixAll.stylelint": true
92 93 }
93 94 },
94 95 "i18n-ally.localesPaths": ["src/locales/lang"],
... ...
build/generate/icon/index.ts
1 1 import path from 'path';
2 2 import fs from 'fs-extra';
3 3 import inquirer from 'inquirer';
4   -import chalk from 'chalk';
  4 +import colors from 'picocolors';
5 5 import pkg from '../../../package.json';
6 6  
7 7 async function generateIcon() {
... ... @@ -64,7 +64,7 @@ async function generateIcon() {
64 64 }
65 65 fs.emptyDir(path.join(process.cwd(), 'node_modules/.vite'));
66 66 console.log(
67   - `✨ ${chalk.cyan(`[${pkg.name}]`)}` + ' - Icon generated successfully:' + `[${prefixSet}]`,
  67 + `✨ ${colors.cyan(`[${pkg.name}]`)}` + ' - Icon generated successfully:' + `[${prefixSet}]`,
68 68 );
69 69 });
70 70 }
... ...
build/script/buildConf.ts
... ... @@ -3,7 +3,7 @@
3 3 */
4 4 import { GLOB_CONFIG_FILE_NAME, OUTPUT_DIR } from '../constant';
5 5 import fs, { writeFileSync } from 'fs-extra';
6   -import chalk from 'chalk';
  6 +import colors from 'picocolors';
7 7  
8 8 import { getEnvConfig, getRootPath } from '../utils';
9 9 import { getConfigFileName } from '../getConfigFileName';
... ... @@ -31,10 +31,10 @@ function createConfig(params: CreateConfigParams) {
31 31 fs.mkdirp(getRootPath(OUTPUT_DIR));
32 32 writeFileSync(getRootPath(`${OUTPUT_DIR}/${configFileName}`), configStr);
33 33  
34   - console.log(chalk.cyan(`✨ [${pkg.name}]`) + ` - configuration file is build successfully:`);
35   - console.log(chalk.gray(OUTPUT_DIR + '/' + chalk.green(configFileName)) + '\n');
  34 + console.log(colors.cyan(`✨ [${pkg.name}]`) + ` - configuration file is build successfully:`);
  35 + console.log(colors.gray(OUTPUT_DIR + '/' + colors.green(configFileName)) + '\n');
36 36 } catch (error) {
37   - console.log(chalk.red('configuration file configuration file failed to package:\n' + error));
  37 + console.log(colors.red('configuration file configuration file failed to package:\n' + error));
38 38 }
39 39 }
40 40  
... ...
build/script/postBuild.ts
1 1 // #!/usr/bin/env node
2 2  
3 3 import { runBuildConfig } from './buildConf';
4   -import chalk from 'chalk';
  4 +import colors from 'picocolors';
5 5  
6 6 import pkg from '../../package.json';
7 7  
... ... @@ -14,9 +14,9 @@ export const runBuild = async () => {
14 14 runBuildConfig();
15 15 }
16 16  
17   - console.log(`✨ ${chalk.cyan(`[${pkg.name}]`)}` + ' - build successfully!');
  17 + console.log(`✨ ${colors.cyan(`[${pkg.name}]`)}` + ' - build successfully!');
18 18 } catch (error) {
19   - console.log(chalk.red('vite build error:\n' + error));
  19 + console.log(colors.red('vite build error:\n' + error));
20 20 process.exit(1);
21 21 }
22 22 };
... ...
build/vite/plugin/compress.ts
... ... @@ -2,16 +2,16 @@
2 2 * Used to package and output gzip. Note that this does not work properly in Vite, the specific reason is still being investigated
3 3 * https://github.com/anncwb/vite-plugin-compression
4 4 */
5   -import type { Plugin } from 'vite';
  5 +import type { PluginOption } from 'vite';
6 6 import compressPlugin from 'vite-plugin-compression';
7 7  
8 8 export function configCompressPlugin(
9 9 compress: 'gzip' | 'brotli' | 'none',
10 10 deleteOriginFile = false,
11   -): Plugin | Plugin[] {
  11 +): PluginOption | PluginOption[] {
12 12 const compressList = compress.split(',');
13 13  
14   - const plugins: Plugin[] = [];
  14 + const plugins: PluginOption[] = [];
15 15  
16 16 if (compressList.includes('gzip')) {
17 17 plugins.push(
... ...
build/vite/plugin/html.ts
... ... @@ -2,8 +2,8 @@
2 2 * Plugin to minimize and use ejs template syntax in index.html.
3 3 * https://github.com/anncwb/vite-plugin-html
4 4 */
5   -import type { Plugin } from 'vite';
6   -import html from 'vite-plugin-html';
  5 +import type { PluginOption } from 'vite';
  6 +import { createHtmlPlugin } from 'vite-plugin-html';
7 7 import pkg from '../../../package.json';
8 8 import { GLOB_CONFIG_FILE_NAME } from '../../constant';
9 9  
... ... @@ -16,7 +16,7 @@ export function configHtmlPlugin(env: ViteEnv, isBuild: boolean) {
16 16 return `${path || '/'}${GLOB_CONFIG_FILE_NAME}?v=${pkg.version}-${new Date().getTime()}`;
17 17 };
18 18  
19   - const htmlPlugin: Plugin[] = html({
  19 + const htmlPlugin: PluginOption[] = createHtmlPlugin({
20 20 minify: isBuild,
21 21 inject: {
22 22 // Inject data into ejs template
... ...
build/vite/plugin/index.ts
1   -import type { Plugin } from 'vite';
  1 +import { PluginOption } from 'vite';
2 2 import vue from '@vitejs/plugin-vue';
3 3 import vueJsx from '@vitejs/plugin-vue-jsx';
4 4 import legacy from '@vitejs/plugin-legacy';
5 5 import purgeIcons from 'vite-plugin-purge-icons';
6 6 import windiCSS from 'vite-plugin-windicss';
  7 +import VitePluginCertificate from 'vite-plugin-mkcert';
7 8 import vueSetupExtend from 'vite-plugin-vue-setup-extend';
8 9 import { configHtmlPlugin } from './html';
9 10 import { configPwaConfig } from './pwa';
... ... @@ -24,13 +25,16 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
24 25 VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE,
25 26 } = viteEnv;
26 27  
27   - const vitePlugins: (Plugin | Plugin[])[] = [
  28 + const vitePlugins: (PluginOption | PluginOption[])[] = [
28 29 // have to
29 30 vue(),
30 31 // have to
31 32 vueJsx(),
32 33 // support name
33 34 vueSetupExtend(),
  35 + VitePluginCertificate({
  36 + source: 'coding',
  37 + }),
34 38 ];
35 39  
36 40 // vite-plugin-windicss
... ...
build/vite/plugin/styleImport.ts
... ... @@ -2,13 +2,13 @@
2 2 * Introduces component library styles on demand.
3 3 * https://github.com/anncwb/vite-plugin-style-import
4 4 */
5   -import styleImport from 'vite-plugin-style-import';
  5 +import { createStyleImportPlugin } from 'vite-plugin-style-import';
6 6  
7 7 export function configStyleImportPlugin(_isBuild: boolean) {
8 8 // if (!isBuild) {
9 9 // return [];
10 10 // }
11   - const styleImportPlugin = styleImport({
  11 + const styleImportPlugin = createStyleImportPlugin({
12 12 libs: [
13 13 {
14 14 libraryName: 'ant-design-vue',
... ...
build/vite/plugin/svgSprite.ts
... ... @@ -3,11 +3,11 @@
3 3 * https://github.com/anncwb/vite-plugin-svg-icons
4 4 */
5 5  
6   -import SvgIconsPlugin from 'vite-plugin-svg-icons';
  6 +import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
7 7 import path from 'path';
8 8  
9 9 export function configSvgIconsPlugin(isBuild: boolean) {
10   - const svgIconsPlugin = SvgIconsPlugin({
  10 + const svgIconsPlugin = createSvgIconsPlugin({
11 11 iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
12 12 svgoOptions: isBuild,
13 13 // default
... ...
build/vite/plugin/theme.ts
... ... @@ -2,7 +2,7 @@
2 2 * Vite plugin for website theme color switching
3 3 * https://github.com/anncwb/vite-plugin-theme
4 4 */
5   -import type { Plugin } from 'vite';
  5 +import type { PluginOption } from 'vite';
6 6 import path from 'path';
7 7 import {
8 8 viteThemePlugin,
... ... @@ -14,7 +14,7 @@ import {
14 14 import { getThemeColors, generateColors } from '../../config/themeConfig';
15 15 import { generateModifyVars } from '../../generate/generateModifyVars';
16 16  
17   -export function configThemePlugin(isBuild: boolean): Plugin[] {
  17 +export function configThemePlugin(isBuild: boolean): PluginOption[] {
18 18 const colors = generateColors({
19 19 mixDarken,
20 20 mixLighten,
... ... @@ -85,5 +85,5 @@ export function configThemePlugin(isBuild: boolean): Plugin[] {
85 85 }),
86 86 ];
87 87  
88   - return plugin as unknown as Plugin[];
  88 + return plugin as unknown as PluginOption[];
89 89 }
... ...
jest.config.mjs deleted 100644 → 0
1   -export default {
2   - preset: 'ts-jest',
3   - roots: ['<rootDir>/tests/'],
4   - clearMocks: true,
5   - moduleDirectories: ['node_modules', 'src'],
6   - moduleFileExtensions: ['js', 'ts', 'vue', 'tsx', 'jsx', 'json', 'node'],
7   - modulePaths: ['<rootDir>/src', '<rootDir>/node_modules'],
8   - testMatch: [
9   - '**/tests/**/*.[jt]s?(x)',
10   - '**/?(*.)+(spec|test).[tj]s?(x)',
11   - '(/__tests__/.*|(\\.|/)(test|spec))\\.(js|ts)$',
12   - ],
13   - testPathIgnorePatterns: [
14   - '<rootDir>/tests/server/',
15   - '<rootDir>/tests/__mocks__/',
16   - '/node_modules/',
17   - ],
18   - transform: {
19   - '^.+\\.tsx?$': 'ts-jest',
20   - },
21   - transformIgnorePatterns: ['<rootDir>/tests/__mocks__/', '/node_modules/'],
22   - // A map from regular expressions to module names that allow to stub out resources with a single module
23   - moduleNameMapper: {
24   - '\\.(vs|fs|vert|frag|glsl|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
25   - '<rootDir>/tests/__mocks__/fileMock.ts',
26   - '\\.(sass|s?css|less)$': '<rootDir>/tests/__mocks__/styleMock.ts',
27   - '\\?worker$': '<rootDir>/tests/__mocks__/workerMock.ts',
28   - '^/@/(.*)$': '<rootDir>/src/$1',
29   - },
30   - testEnvironment: 'jsdom',
31   - verbose: true,
32   - collectCoverage: false,
33   - coverageDirectory: 'coverage',
34   - collectCoverageFrom: ['src/**/*.{js,ts,vue}'],
35   - coveragePathIgnorePatterns: ['^.+\\.d\\.ts$'],
36   -};
mock/sys/user.ts
... ... @@ -111,4 +111,12 @@ export default [
111 111 return resultSuccess(undefined, { message: 'Token has been destroyed' });
112 112 },
113 113 },
  114 + {
  115 + url: '/basic-api/testRetry',
  116 + statusCode: 405,
  117 + method: 'get',
  118 + response: () => {
  119 + return resultError('Error!');
  120 + },
  121 + },
114 122 ] as MockMethod[];
... ...
package.json
... ... @@ -25,7 +25,6 @@
25 25 "lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
26 26 "lint:lint-staged": "lint-staged",
27 27 "test:unit": "jest",
28   - "test:unit-coverage": "jest --coverage",
29 28 "test:gzip": "npx http-server dist --cors --gzip -c-1",
30 29 "test:br": "npx http-server dist --cors --brotli -c-1",
31 30 "reinstall": "rimraf pnpm-lock.yaml && rimraf package.lock.json && rimraf node_modules && npm run bootstrap",
... ... @@ -34,117 +33,115 @@
34 33 },
35 34 "dependencies": {
36 35 "@ant-design/colors": "^6.0.0",
37   - "@ant-design/icons-vue": "^6.0.1",
38   - "@iconify/iconify": "^2.1.0",
39   - "@logicflow/core": "^0.7.16",
40   - "@logicflow/extension": "^0.7.16",
41   - "@vue/runtime-core": "^3.2.26",
42   - "@vue/shared": "^3.2.26",
43   - "@vueuse/core": "^7.4.1",
44   - "@vueuse/shared": "^7.4.1",
45   - "@zxcvbn-ts/core": "^1.2.0",
46   - "ant-design-vue": "3.0.0-beta.3",
47   - "axios": "^0.24.0",
48   - "codemirror": "^5.65.0",
  36 + "@ant-design/icons-vue": "^6.1.0",
  37 + "@iconify/iconify": "^2.1.2",
  38 + "@logicflow/core": "^1.1.7",
  39 + "@logicflow/extension": "^1.1.7",
  40 + "@vue/runtime-core": "^3.2.31",
  41 + "@vue/shared": "^3.2.31",
  42 + "@vueuse/core": "^8.1.1",
  43 + "@vueuse/shared": "^8.1.1",
  44 + "@zxcvbn-ts/core": "^2.0.1",
  45 + "ant-design-vue": "3.1.0-rc.1",
  46 + "axios": "^0.26.1",
  47 + "codemirror": "^5.65.2",
49 48 "cropperjs": "^1.5.12",
50 49 "crypto-js": "^4.1.1",
51   - "dayjs": "^1.10.7",
52   - "echarts": "^5.2.2",
53   - "intro.js": "^4.3.0",
  50 + "dayjs": "^1.11.0",
  51 + "echarts": "^5.3.1",
  52 + "intro.js": "^5.0.0",
54 53 "lodash-es": "^4.17.21",
55 54 "mockjs": "^1.1.0",
56 55 "nprogress": "^0.2.0",
57 56 "path-to-regexp": "^6.2.0",
58   - "pinia": "2.0.9",
  57 + "pinia": "2.0.12",
59 58 "print-js": "^1.6.0",
60 59 "qrcode": "^1.5.0",
61   - "qs": "^6.10.2",
  60 + "qs": "^6.10.3",
62 61 "resize-observer-polyfill": "^1.5.1",
63   - "showdown": "^1.9.1",
  62 + "showdown": "^2.0.3",
64 63 "sortablejs": "^1.14.0",
65   - "tinymce": "^5.10.2",
66   - "vditor": "^3.8.10",
67   - "vue": "^3.2.26",
  64 + "tinymce": "^5.10.3",
  65 + "vditor": "^3.8.12",
  66 + "vue": "^3.2.31",
68 67 "vue-i18n": "^9.1.9",
69   - "vue-json-pretty": "^1.8.2",
70   - "vue-router": "^4.0.12",
  68 + "vue-json-pretty": "^2.0.6",
  69 + "vue-router": "^4.0.14",
71 70 "vue-types": "^4.1.1",
72   - "xlsx": "^0.17.4"
  71 + "xlsx": "^0.18.4"
73 72 },
74 73 "devDependencies": {
75   - "@commitlint/cli": "^16.0.1",
76   - "@commitlint/config-conventional": "^16.0.0",
77   - "@iconify/json": "^2.0.16",
78   - "@purge-icons/generated": "^0.7.0",
  74 + "@commitlint/cli": "^16.2.3",
  75 + "@commitlint/config-conventional": "^16.2.1",
  76 + "@iconify/json": "^2.1.17",
  77 + "@purge-icons/generated": "^0.8.1",
79 78 "@types/codemirror": "^5.60.5",
80   - "@types/crypto-js": "^4.0.2",
  79 + "@types/crypto-js": "^4.1.1",
81 80 "@types/fs-extra": "^9.0.13",
82   - "@types/inquirer": "^8.1.3",
  81 + "@types/inquirer": "^8.2.0",
83 82 "@types/intro.js": "^3.0.2",
84   - "@types/jest": "^27.0.3",
85   - "@types/lodash-es": "^4.17.5",
86   - "@types/mockjs": "^1.0.4",
87   - "@types/node": "^17.0.5",
  83 + "@types/lodash-es": "^4.17.6",
  84 + "@types/mockjs": "^1.0.6",
  85 + "@types/node": "^17.0.21",
88 86 "@types/nprogress": "^0.2.0",
89 87 "@types/qrcode": "^1.4.2",
90 88 "@types/qs": "^6.9.7",
91 89 "@types/showdown": "^1.9.4",
92 90 "@types/sortablejs": "^1.10.7",
93   - "@typescript-eslint/eslint-plugin": "^5.8.1",
94   - "@typescript-eslint/parser": "^5.8.1",
95   - "@vitejs/plugin-legacy": "^1.6.4",
96   - "@vitejs/plugin-vue": "^2.0.1",
97   - "@vitejs/plugin-vue-jsx": "^1.3.3",
98   - "@vue/compiler-sfc": "3.2.26",
  91 + "@typescript-eslint/eslint-plugin": "^5.15.0",
  92 + "@typescript-eslint/parser": "^5.15.0",
  93 + "@vitejs/plugin-legacy": "^1.7.1",
  94 + "@vitejs/plugin-vue": "^2.2.4",
  95 + "@vitejs/plugin-vue-jsx": "^1.3.8",
  96 + "@vue/compiler-sfc": "3.2.31",
99 97 "@vue/test-utils": "^2.0.0-rc.18",
100   - "autoprefixer": "^10.4.0",
  98 + "autoprefixer": "^10.4.4",
101 99 "commitizen": "^4.2.4",
102 100 "conventional-changelog-cli": "^2.2.2",
103 101 "cross-env": "^7.0.3",
104   - "dotenv": "^10.0.0",
105   - "eslint": "^8.5.0",
106   - "eslint-config-prettier": "^8.3.0",
107   - "eslint-define-config": "^1.2.1",
108   - "eslint-plugin-jest": "^25.3.2",
  102 + "dotenv": "^16.0.0",
  103 + "eslint": "^8.11.0",
  104 + "eslint-config-prettier": "^8.5.0",
109 105 "eslint-plugin-prettier": "^4.0.0",
110   - "eslint-plugin-vue": "^8.2.0",
111   - "esno": "^0.13.0",
112   - "fs-extra": "^10.0.0",
  106 + "eslint-plugin-vue": "^8.5.0",
  107 + "esno": "^0.14.1",
  108 + "fs-extra": "^10.0.1",
113 109 "husky": "^7.0.4",
114   - "inquirer": "^8.2.0",
115   - "jest": "^27.4.5",
  110 + "inquirer": "^8.2.1",
116 111 "less": "^4.1.2",
117   - "lint-staged": "12.1.4",
  112 + "lint-staged": "12.3.7",
118 113 "npm-run-all": "^4.1.5",
119   - "postcss": "^8.4.5",
  114 + "picocolors": "^1.0.0",
  115 + "postcss": "^8.4.12",
120 116 "postcss-html": "^1.3.0",
121   - "postcss-less": "^5.0.0",
122   - "prettier": "^2.5.1",
  117 + "postcss-less": "^6.0.0",
  118 + "prettier": "^2.6.0",
123 119 "rimraf": "^3.0.2",
124   - "rollup-plugin-visualizer": "^5.5.2",
125   - "stylelint": "^14.2.0",
126   - "stylelint-config-html": "^1.0.0",
  120 + "rollup": "^2.70.1",
  121 + "rollup-plugin-visualizer": "^5.6.0",
  122 + "stylelint": "^14.6.0",
127 123 "stylelint-config-prettier": "^9.0.3",
128   - "stylelint-config-recommended": "^6.0.0",
129   - "stylelint-config-standard": "^24.0.0",
  124 + "stylelint-config-recommended": "^7.0.0",
  125 + "stylelint-config-recommended-vue": "^1.3.0",
  126 + "stylelint-config-standard": "^25.0.0",
130 127 "stylelint-order": "^5.0.0",
131   - "ts-jest": "^27.1.2",
132   - "ts-node": "^10.4.0",
133   - "typescript": "^4.5.4",
134   - "vite": "^2.7.8",
135   - "vite-plugin-compression": "^0.4.0",
136   - "vite-plugin-html": "^2.1.2",
137   - "vite-plugin-imagemin": "^0.5.1",
  128 + "ts-node": "^10.7.0",
  129 + "typescript": "^4.6.2",
  130 + "vite": "^2.9.0-beta.3",
  131 + "vite-plugin-compression": "^0.5.1",
  132 + "vite-plugin-html": "^3.2.0",
  133 + "vite-plugin-imagemin": "^0.6.1",
  134 + "vite-plugin-mkcert": "^1.6.0",
138 135 "vite-plugin-mock": "^2.9.6",
139   - "vite-plugin-purge-icons": "^0.7.0",
140   - "vite-plugin-pwa": "^0.11.12",
141   - "vite-plugin-style-import": "^1.4.1",
142   - "vite-plugin-svg-icons": "^1.0.5",
  136 + "vite-plugin-purge-icons": "^0.8.1",
  137 + "vite-plugin-pwa": "^0.11.13",
  138 + "vite-plugin-style-import": "^2.0.0",
  139 + "vite-plugin-svg-icons": "^2.0.1",
143 140 "vite-plugin-theme": "^0.8.1",
144   - "vite-plugin-vue-setup-extend": "^0.3.0",
145   - "vite-plugin-windicss": "^1.6.1",
146   - "vue-eslint-parser": "^8.0.1",
147   - "vue-tsc": "^0.30.1"
  141 + "vite-plugin-vue-setup-extend": "^0.4.0",
  142 + "vite-plugin-windicss": "^1.8.3",
  143 + "vue-eslint-parser": "^8.3.0",
  144 + "vue-tsc": "^0.33.2"
148 145 },
149 146 "resolutions": {
150 147 "bin-wrapper": "npm:bin-wrapper-china",
... ...