Commit 3e8abd20926f64862aef44d8ffcaaef877a3452c

Authored by fengwotao
2 parents bd002212 9e62035e

Merge branch 'main' into dev-ft

Too many changes to show.

To preserve performance only 3 of 80 files are displayed.

@@ -14,11 +14,14 @@ VITE_PUBLIC_PATH = / @@ -14,11 +14,14 @@ VITE_PUBLIC_PATH = /
14 # VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] 14 # VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]]
15 # 线上测试环境 15 # 线上测试环境
16 # VITE_PROXY = [["/api","http://localhost:8080/api"],["/thingskit-drawio","http://localhost:3000/"]] 16 # VITE_PROXY = [["/api","http://localhost:8080/api"],["/thingskit-drawio","http://localhost:3000/"]]
17 -VITE_PROXY = [["/api","https://dev.thingskit.com/api"],["/thingskit-drawio","http://localhost:3000/"]] 17 +# VITE_PROXY = [["/api","https://dev.thingskit.com/api"],["/thingskit-drawio","http://localhost:3000/"]]
  18 +VITE_PROXY = [["/api","http://121.37.251.8:8080/api"],["/thingskit-drawio","http://localhost:3000/"]]
  19 +# VITE_PROXY = [["/api","http://192.168.10.106:8080/api"],["/thingskit-drawio","http://192.168.10.106:8080/api"]]
18 20
19 # 实时数据的ws地址 21 # 实时数据的ws地址
20 # VITE_WEB_SOCKET = ws://localhost:8080/api/ws/plugins/telemetry?token= 22 # VITE_WEB_SOCKET = ws://localhost:8080/api/ws/plugins/telemetry?token=
21 -VITE_WEB_SOCKET = ws://44.99.141.212:8080/api/ws/plugins/telemetry?token= 23 +# VITE_WEB_SOCKET = ws://44.99.141.212:8080/api/ws/plugins/telemetry?token=
  24 +VITE_WEB_SOCKET = ws://121.37.251.8:8080/api/ws/plugins/telemetry?token=
22 25
23 # Delete console 26 # Delete console
24 VITE_DROP_CONSOLE = true 27 VITE_DROP_CONSOLE = true
@@ -36,5 +39,5 @@ VITE_GLOB_API_URL_PREFIX=/yt @@ -36,5 +39,5 @@ VITE_GLOB_API_URL_PREFIX=/yt
36 VITE_GLOB_CONFIGURATION = /thingskit-drawio 39 VITE_GLOB_CONFIGURATION = /thingskit-drawio
37 40
38 # Content Security Policy 41 # Content Security Policy
39 -VITE_CONTENT_SECURITY_POLICY = true 42 +VITE_CONTENT_SECURITY_POLICY = false
40 43
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 ], 6 ],
7 "commentTranslate.targetLanguage": "en", 7 "commentTranslate.targetLanguage": "en",
8 "cSpell.words": [ 8 "cSpell.words": [
  9 + "Cmds",
9 "unref" 10 "unref"
10 ] 11 ]
11 } 12 }
  1 +import { join, resolve } from 'path';
  2 +import inquirer from 'inquirer';
  3 +import fs from 'fs-extra';
  4 +import chalk from 'chalk';
  5 +
  6 +async function genreateIcon() {
  7 + const answers = await inquirer.prompt([
  8 + {
  9 + type: 'input',
  10 + name: 'entry',
  11 + message: 'Set Iconfont.js File Entry Location!',
  12 + default: 'src/assets/iconfont/iconfont.js',
  13 + },
  14 + {
  15 + type: 'input',
  16 + name: 'output',
  17 + message: 'Set The Location For Storing Generated File!',
  18 + default: 'src/components/Icon/data',
  19 + },
  20 + {
  21 + type: 'outputFileName',
  22 + name: 'outputFileName',
  23 + message: 'Set Generate File Name!',
  24 + default: 'iconfont.data.ts',
  25 + },
  26 + ]);
  27 +
  28 + const { entry, output, outputFileName } = answers;
  29 + if (![entry, output, outputFileName].every(Boolean)) {
  30 + global.console.log(
  31 + `${chalk.yellow('Generate:Icon: ')}${chalk.red(
  32 + 'There is a problem with the file path you set!'
  33 + )}`
  34 + );
  35 + process.exit(1);
  36 + }
  37 +
  38 + const groupReg = /<symbol[^]*?<\/symbol>/g;
  39 + const getIdReg = /id=(["'])(.*?)\1/;
  40 +
  41 + const string = await fs.readFileSync(resolve(process.cwd(), entry), { encoding: 'utf-8' });
  42 +
  43 + const iconNameList = Array.from(string.matchAll(groupReg)).map(([string]) => {
  44 + const [, , name] = string.match(getIdReg) || [];
  45 + return name.replace('iconfont-', '');
  46 + });
  47 +
  48 + await fs.writeFileSync(
  49 + join(output, outputFileName),
  50 + `export default ${JSON.stringify({ prefix: 'iconfont', icons: iconNameList }, null, 2)}`
  51 + );
  52 +
  53 + global.console.log(
  54 + `${chalk.yellow('Generate:Icon: ')}${chalk.cyan(
  55 + 'ICon generated successfully, Store Address: '
  56 + )}${chalk.cyan(join(resolve(process.cwd()), output, outputFileName))}`
  57 + );
  58 +}
  59 +
  60 +genreateIcon();