This is an automated email from the ASF dual-hosted git repository.
benjobs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
The following commit(s) were added to refs/heads/dev by this push:
new 699bfbcc3 [Improve]: update FE dependencies, use pnpm (#2852)
699bfbcc3 is described below
commit 699bfbcc3d88c512825e3bc2ce4254c16d6e8cbf
Author: Kriszu <[email protected]>
AuthorDate: Thu Jul 13 21:25:15 2023 +0800
[Improve]: update FE dependencies, use pnpm (#2852)
* [Improve]: update FE dependencies, use pnpm
* [Style]: eslint code
---
.../streampark-console-service/pom.xml | 12 +--
.../streampark-console-webapp/.gitpod.yml | 21 ----
.../build/script/buildConf.ts | 58 -----------
.../build/vite/plugin/appConfig.ts | 105 +++++++++++++++++++
.../build/vite/plugin/html.ts | 31 +-----
.../build/vite/plugin/index.ts | 11 +-
.../build/vite/utils/env.ts | 60 +++++++++++
.../{script/postBuild.ts => vite/utils/hash.ts} | 27 ++---
.../streampark-console-webapp/commitlint.config.js | 49 ---------
.../streampark-console-webapp/index.html | 3 +-
.../streampark-console-webapp/package.json | 112 ++++++++++-----------
.../Application/src/AppDarkModeToggle.vue | 4 +-
.../Container/src/collapse/CollapseContainer.vue | 4 +-
.../src/components/ContextMenu/src/ContextMenu.vue | 4 +-
.../src/components/Form/src/BasicForm.vue | 2 +-
.../src/components/Icon/src/SvgIcon.vue | 3 +-
.../src/components/Page/src/PageFooter.vue | 4 +-
.../src/hooks/web/useLockPage.ts | 9 +-
.../streampark-console-webapp/src/utils/env.ts | 9 +-
.../streampark-console-webapp/src/utils/props.ts | 2 +-
.../src/views/base/login/Login.vue | 9 +-
.../src/views/flink/project/Add.vue | 2 +-
.../src/views/flink/project/Edit.vue | 2 +-
.../views/setting/Alarm/components/AlertModal.vue | 2 +-
.../streampark-console-webapp/stylelint.config.js | 2 +-
.../streampark-console-webapp/vite.config.ts | 38 +++----
26 files changed, 289 insertions(+), 296 deletions(-)
diff --git a/streampark-console/streampark-console-service/pom.xml
b/streampark-console/streampark-console-service/pom.xml
index 38af2f101..bbc761000 100644
--- a/streampark-console/streampark-console-service/pom.xml
+++ b/streampark-console/streampark-console-service/pom.xml
@@ -604,29 +604,29 @@
</configuration>
<executions>
<execution>
- <id>install node and npm</id>
+ <id>install node and pnpm</id>
<goals>
- <goal>install-node-and-npm</goal>
+ <goal>install-node-and-pnpm</goal>
</goals>
<configuration>
<nodeVersion>v16.16.0</nodeVersion>
- <npmVersion>8.11.0</npmVersion>
+ <pnpmVersion>8.5.0</pnpmVersion>
</configuration>
</execution>
<execution>
<id>install</id>
<goals>
- <goal>npm</goal>
+ <goal>pnpm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
- <arguments>install</arguments>
+ <arguments>install
--ignore-scripts</arguments>
</configuration>
</execution>
<execution>
<id>build</id>
<goals>
- <goal>npm</goal>
+ <goal>pnpm</goal>
</goals>
<configuration>
<arguments>run build:no-cache</arguments>
diff --git a/streampark-console/streampark-console-webapp/.gitpod.yml
b/streampark-console/streampark-console-webapp/.gitpod.yml
deleted file mode 100644
index 560bcad83..000000000
--- a/streampark-console/streampark-console-webapp/.gitpod.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-ports:
- - port: 3344
- onOpen: open-preview
-tasks:
- - init: pnpm install
- command: pnpm run dev
diff --git
a/streampark-console/streampark-console-webapp/build/script/buildConf.ts
b/streampark-console/streampark-console-webapp/build/script/buildConf.ts
deleted file mode 100644
index 76acd3905..000000000
--- a/streampark-console/streampark-console-webapp/build/script/buildConf.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { GLOB_CONFIG_FILE_NAME, OUTPUT_DIR } from '../constant';
-import fs, { writeFileSync } from 'fs-extra';
-import colors from 'picocolors';
-
-import { getEnvConfig, getRootPath } from '../utils';
-import { getConfigFileName } from '../getConfigFileName';
-
-import pkg from '../../package.json';
-
-interface CreateConfigParams {
- configName: string;
- config: any;
- configFileName?: string;
-}
-
-function createConfig(params: CreateConfigParams) {
- const { configName, config, configFileName } = params;
- try {
- const windowConf = `window.${configName}`;
- // Ensure that the variable will not be modified
- const configStr = `${windowConf}=${JSON.stringify(config)};
- Object.freeze(${windowConf});
- Object.defineProperty(window, "${configName}", {
- configurable: false,
- writable: false,
- });
- `.replace(/\s/g, '');
- fs.mkdirp(getRootPath(OUTPUT_DIR));
- writeFileSync(getRootPath(`${OUTPUT_DIR}/${configFileName}`), configStr);
-
- console.log(colors.cyan(`✨ [${pkg.name}]`) + ` - configuration file is
build successfully:`);
- console.log(colors.gray(OUTPUT_DIR + '/' + colors.green(configFileName)) +
'\n');
- } catch (error) {
- console.log(colors.red('configuration file configuration file failed to
package:\n' + error));
- }
-}
-
-export function runBuildConfig() {
- const config = getEnvConfig();
- const configFileName = getConfigFileName(config);
- createConfig({ config, configName: configFileName, configFileName:
GLOB_CONFIG_FILE_NAME });
-}
diff --git
a/streampark-console/streampark-console-webapp/build/vite/plugin/appConfig.ts
b/streampark-console/streampark-console-webapp/build/vite/plugin/appConfig.ts
new file mode 100644
index 000000000..275920471
--- /dev/null
+++
b/streampark-console/streampark-console-webapp/build/vite/plugin/appConfig.ts
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import colors from 'picocolors';
+import pkg from '../../../package.json';
+import { type PluginOption } from 'vite';
+
+import { getEnvConfig } from '../utils/env';
+import { createContentHash } from '../utils/hash';
+
+const GLOBAL_CONFIG_FILE_NAME = '_app.config.js';
+const PLUGIN_NAME = 'app-config';
+
+async function createAppConfigPlugin(isBuild: boolean): Promise<PluginOption> {
+ let publicPath: string;
+ let source: string;
+ if (!isBuild) {
+ return {
+ name: PLUGIN_NAME,
+ };
+ }
+
+ return {
+ name: PLUGIN_NAME,
+ async configResolved(_config) {
+ let appTitle = _config?.env?.VITE_GLOB_APP_TITLE ?? '';
+ appTitle = appTitle.replace(/\s/g, '_').replace(/-/g, '_');
+ publicPath = _config.base;
+ source = await getConfigSource(appTitle);
+ },
+ transformIndexHtml(html) {
+ publicPath = publicPath.endsWith('/') ? publicPath : `${publicPath}/`;
+
+ const appConfigSrc = `${publicPath || '/'}${GLOBAL_CONFIG_FILE_NAME}?v=${
+ pkg.version
+ }-${createContentHash(source)}`;
+
+ return {
+ html,
+ tags: [
+ {
+ tag: 'script',
+ attrs: {
+ src: appConfigSrc,
+ },
+ },
+ ],
+ };
+ },
+ generateBundle() {
+ try {
+ this.emitFile({
+ type: 'asset',
+ fileName: GLOBAL_CONFIG_FILE_NAME,
+ source,
+ });
+
+ console.log(colors.cyan(`✨configuration file is build successfully!`));
+ } catch (error) {
+ console.log(
+ colors.red('configuration file configuration file failed to
package:\n' + error),
+ );
+ }
+ },
+ };
+}
+
+/**
+ * Get the configuration file variable name
+ * @param env
+ */
+const getVariableName = (title: string) => {
+ return `__PRODUCTION__${title ||
'__APP'}__CONF__`.toUpperCase().replace(/\s/g, '');
+};
+
+async function getConfigSource(appTitle: string) {
+ const config = await getEnvConfig();
+ const variableName = getVariableName(appTitle);
+ const windowVariable = `window.${variableName}`;
+ // Ensure that the variable will not be modified
+ let source = `${windowVariable}=${JSON.stringify(config)};`;
+ source += `
+ Object.freeze(${windowVariable});
+ Object.defineProperty(window, "${variableName}", {
+ configurable: false,
+ writable: false,
+ });
+ `.replace(/\s/g, '');
+ return source;
+}
+
+export { createAppConfigPlugin };
diff --git
a/streampark-console/streampark-console-webapp/build/vite/plugin/html.ts
b/streampark-console/streampark-console-webapp/build/vite/plugin/html.ts
index 77515fec6..7226c8f7d 100644
--- a/streampark-console/streampark-console-webapp/build/vite/plugin/html.ts
+++ b/streampark-console/streampark-console-webapp/build/vite/plugin/html.ts
@@ -19,38 +19,11 @@
* https://github.com/anncwb/vite-plugin-html
*/
import type { PluginOption } from 'vite';
-import { createHtmlPlugin } from 'vite-plugin-html';
-import pkg from '../../../package.json';
-import { GLOB_CONFIG_FILE_NAME } from '../../constant';
-
-export function configHtmlPlugin(env: ViteEnv, isBuild: boolean) {
- const { VITE_GLOB_APP_TITLE, VITE_PUBLIC_PATH } = env;
-
- const path = VITE_PUBLIC_PATH.endsWith('/') ? VITE_PUBLIC_PATH :
`${VITE_PUBLIC_PATH}/`;
-
- const getAppConfigSrc = () => {
- return `${path || '/'}${GLOB_CONFIG_FILE_NAME}?v=${pkg.version}-${new
Date().getTime()}`;
- };
+import { createHtmlPlugin } from 'vite-plugin-html-transform';
+export function configHtmlPlugin(isBuild: boolean) {
const htmlPlugin: PluginOption[] = createHtmlPlugin({
minify: isBuild,
- inject: {
- // Inject data into ejs template
- data: {
- title: VITE_GLOB_APP_TITLE,
- },
- // Embed the generated app.config.js file
- tags: isBuild
- ? [
- {
- tag: 'script',
- attrs: {
- src: getAppConfigSrc(),
- },
- },
- ]
- : [],
- },
});
return htmlPlugin;
}
diff --git
a/streampark-console/streampark-console-webapp/build/vite/plugin/index.ts
b/streampark-console/streampark-console-webapp/build/vite/plugin/index.ts
index ed322ac03..b3c83e6c9 100644
--- a/streampark-console/streampark-console-webapp/build/vite/plugin/index.ts
+++ b/streampark-console/streampark-console-webapp/build/vite/plugin/index.ts
@@ -27,8 +27,9 @@ import { configVisualizerConfig } from './visualizer';
import { configThemePlugin } from './theme';
import { configImageminPlugin } from './imagemin';
import { configSvgIconsPlugin } from './svgSprite';
+import { createAppConfigPlugin } from './appConfig';
-export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
+export async function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
const {
VITE_USE_IMAGEMIN,
VITE_LEGACY,
@@ -42,7 +43,8 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild:
boolean) {
// have to
vueJsx(),
];
-
+ const appConfigPlugin = await createAppConfigPlugin(isBuild);
+ vitePlugins.push(appConfigPlugin);
// vite-plugin-windicss
vitePlugins.push(windiCSS());
@@ -50,7 +52,7 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild:
boolean) {
VITE_LEGACY && isBuild && vitePlugins.push(legacy());
// vite-plugin-html
- vitePlugins.push(configHtmlPlugin(viteEnv, isBuild));
+ vitePlugins.push(configHtmlPlugin(isBuild));
// vite-plugin-svg-icons
vitePlugins.push(configSvgIconsPlugin(isBuild));
@@ -76,9 +78,6 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild:
boolean) {
vitePlugins.push(
configCompressPlugin(VITE_BUILD_COMPRESS,
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE),
);
-
- // vite-plugin-pwa
- // vitePlugins.push(configPwaConfig(viteEnv));
}
return vitePlugins;
diff --git
a/streampark-console/streampark-console-webapp/build/vite/utils/env.ts
b/streampark-console/streampark-console-webapp/build/vite/utils/env.ts
new file mode 100644
index 000000000..665b6a7c1
--- /dev/null
+++ b/streampark-console/streampark-console-webapp/build/vite/utils/env.ts
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { join } from 'node:path';
+
+import dotenv from 'dotenv';
+import { readFile } from 'fs-extra';
+
+/**
+ * 获取当前环境下生效的配置文件名
+ */
+function getConfFiles() {
+ const script = process.env.npm_lifecycle_script as string;
+ const reg = new RegExp('--mode ([a-z_\\d]+)');
+ const result = reg.exec(script);
+ if (result) {
+ const mode = result[1];
+ return ['.env', `.env.${mode}`];
+ }
+ return ['.env', '.env.production'];
+}
+
+/**
+ * Get the environment variables starting with the specified prefix
+ * @param match prefix
+ * @param confFiles ext
+ */
+export async function getEnvConfig(match = 'VITE_GLOB_', confFiles =
getConfFiles()) {
+ let envConfig = {};
+
+ for (const confFile of confFiles) {
+ try {
+ const envPath = await readFile(join(process.cwd(), confFile), {
encoding: 'utf8' });
+ const env = dotenv.parse(envPath);
+ envConfig = { ...envConfig, ...env };
+ } catch (e) {
+ console.error(`Error in parsing ${confFile}`, e);
+ }
+ }
+ const reg = new RegExp(`^(${match})`);
+ Object.keys(envConfig).forEach((key) => {
+ if (!reg.test(key)) {
+ Reflect.deleteProperty(envConfig, key);
+ }
+ });
+ return envConfig;
+}
diff --git
a/streampark-console/streampark-console-webapp/build/script/postBuild.ts
b/streampark-console/streampark-console-webapp/build/vite/utils/hash.ts
similarity index 59%
rename from
streampark-console/streampark-console-webapp/build/script/postBuild.ts
rename to streampark-console/streampark-console-webapp/build/vite/utils/hash.ts
index a96aaa9a2..3b21c1f47 100644
--- a/streampark-console/streampark-console-webapp/build/script/postBuild.ts
+++ b/streampark-console/streampark-console-webapp/build/vite/utils/hash.ts
@@ -14,26 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-// #!/usr/bin/env node
+import { createHash } from 'node:crypto';
-import { runBuildConfig } from './buildConf';
-import colors from 'picocolors';
+function createContentHash(content: string, hashLSize = 12) {
+ const hash = createHash('sha256').update(content);
+ return hash.digest('hex').slice(0, hashLSize);
+}
-import pkg from '../../package.json';
-
-export const runBuild = async () => {
- try {
- const argvList = process.argv.splice(2);
-
- // Generate configuration file
- if (!argvList.includes('disabled-config')) {
- runBuildConfig();
- }
-
- console.log(`✨ ${colors.cyan(`[${pkg.name}]`)}` + ' - build
successfully!');
- } catch (error) {
- console.log(colors.red('vite build error:\n' + error));
- process.exit(1);
- }
-};
-runBuild();
+export { createContentHash };
diff --git a/streampark-console/streampark-console-webapp/commitlint.config.js
b/streampark-console/streampark-console-webapp/commitlint.config.js
deleted file mode 100644
index 2491990f9..000000000
--- a/streampark-console/streampark-console-webapp/commitlint.config.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-module.exports = {
- ignores: [(commit) => commit.includes('init')],
- extends: ['@commitlint/config-conventional'],
- rules: {
- 'body-leading-blank': [2, 'always'],
- 'footer-leading-blank': [1, 'always'],
- 'header-max-length': [2, 'always', 108],
- 'subject-empty': [2, 'never'],
- 'type-empty': [2, 'never'],
- 'subject-case': [0],
- 'type-enum': [
- 2,
- 'always',
- [
- 'feat',
- 'fix',
- 'perf',
- 'style',
- 'docs',
- 'test',
- 'refactor',
- 'build',
- 'ci',
- 'chore',
- 'revert',
- 'wip',
- 'workflow',
- 'types',
- 'release',
- ],
- ],
- },
-};
diff --git a/streampark-console/streampark-console-webapp/index.html
b/streampark-console/streampark-console-webapp/index.html
index 801511836..ae4d78dcf 100644
--- a/streampark-console/streampark-console-webapp/index.html
+++ b/streampark-console/streampark-console-webapp/index.html
@@ -25,7 +25,7 @@
<meta name="viewport"
content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
/>
<title>
- <%= title %>
+ <%= VITE_GLOB_APP_TITLE %>
</title>
<link rel="icon" href="/favicon.ico" />
</head>
@@ -166,7 +166,6 @@
opacity: 100%;
}
}
-
</style>
<div class="app-loading">
<div class="app-loading-wrap">
diff --git a/streampark-console/streampark-console-webapp/package.json
b/streampark-console/streampark-console-webapp/package.json
index 4ebf1e163..2f998a087 100644
--- a/streampark-console/streampark-console-webapp/package.json
+++ b/streampark-console/streampark-console-webapp/package.json
@@ -5,7 +5,7 @@
"name": "streampark",
"url": "https://streampark.apache.org"
},
- "packageManager": "[email protected]",
+ "packageManager": "[email protected]",
"repository": {
"type": "git",
"url": "git+https://github.com/apache/incubator-streampark.git"
@@ -16,17 +16,18 @@
},
"homepage": "https://streampark.apache.org",
"scripts": {
+ "preinstall": "npx only-allow pnpm",
"bootstrap": "pnpm install",
"serve": "npm run dev",
"dev": "vite",
- "build": "cross-env NODE_ENV=production vite build && esno
./build/script/postBuild.ts",
- "build:test": "cross-env vite build --mode test && esno
./build/script/postBuild.ts",
+ "build": "cross-env NODE_ENV=production
NODE_OPTIONS=--max-old-space-size=8192 pnpm vite build",
+ "build:analyze": "cross-env NODE_OPTIONS=--max-old-space-size=8192 pnpm
vite build --mode analyze",
+ "build:test": "cross-env vite build --mode test",
"build:no-cache": "npm run clean:cache && npm run build",
"report": "cross-env REPORT=true npm run build",
"type:check": "vue-tsc --noEmit --skipLibCheck",
"preview": "npm run build && vite preview",
"preview:dist": "vite preview",
- "log": "conventional-changelog -p angular -i CHANGELOG.md -s",
"clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite",
"clean:lib": "rimraf node_modules",
"lint:eslint": "eslint --cache --max-warnings 0
\"{src,mock}/**/*.{vue,ts,tsx}\" --fix",
@@ -42,98 +43,89 @@
"dependencies": {
"@ant-design/colors": "^7.0.0",
"@ant-design/icons-vue": "^6.1.0",
- "@iconify/iconify": "^3.1.0",
- "@vue/runtime-core": "^3.3.2",
- "@vue/shared": "^3.3.2",
- "@vueuse/core": "^10.1.2",
- "@vueuse/shared": "^10.1.2",
- "@zxcvbn-ts/core": "^3.0.1",
+ "@iconify/iconify": "^3.1.1",
+ "@vue/runtime-core": "^3.3.4",
+ "@vue/shared": "^3.3.4",
+ "@vueuse/core": "^10.2.1",
+ "@vueuse/shared": "^10.2.1",
+ "@zxcvbn-ts/core": "^3.0.2",
"ant-design-vue": "^3.2.20",
"axios": "^1.4.0",
"crypto-js": "^4.1.1",
- "dayjs": "^1.11.7",
+ "dayjs": "^1.11.9",
"lodash-es": "^4.17.21",
- "monaco-editor": "^0.38.0",
+ "monaco-editor": "^0.40.0",
"nprogress": "^0.2.0",
"path-to-regexp": "^6.2.1",
"penpal": "^6.2.2",
- "pinia": "2.0.36",
- "qs": "^6.11.1",
+ "pinia": "2.1.4",
+ "qs": "^6.11.2",
"resize-observer-polyfill": "^1.5.1",
- "sql-formatter": "^4.0.2",
- "sweetalert2": "^11.7.5",
"sortablejs": "^1.15.0",
- "terser": "^5.17.3",
- "vue": "^3.3.2",
+ "sql-formatter": "^4.0.2",
+ "sweetalert2": "^11.7.16",
+ "terser": "^5.19.0",
+ "vue": "^3.3.4",
"vue-i18n": "^9.2.2",
- "vue-router": "^4.2.0",
- "vue-types": "^5.0.2"
+ "vue-router": "^4.2.4",
+ "vue-types": "^5.1.0"
},
"devDependencies": {
- "@commitlint/cli": "^17.6.3",
- "@commitlint/config-conventional": "^17.6.3",
- "@iconify/json": "^2.2.64",
+ "@iconify/json": "^2.2.89",
"@purge-icons/generated": "^0.9.0",
"@types/fs-extra": "^11.0.1",
"@types/lodash-es": "^4.17.7",
- "@types/node": "^20.1.3",
+ "@types/node": "^20.4.1",
"@types/nprogress": "^0.2.0",
"@types/qs": "^6.9.7",
"@types/showdown": "^2.0.1",
"@types/sortablejs": "^1.15.1",
- "@typescript-eslint/eslint-plugin": "^5.59.5",
- "@typescript-eslint/parser": "^5.59.5",
- "@vitejs/plugin-legacy": "^2.2.0",
- "@vitejs/plugin-vue": "^3.1.2",
- "@vitejs/plugin-vue-jsx": "^2.0.1",
- "@vue/compiler-sfc": "^3.3.2",
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
+ "@typescript-eslint/parser": "^6.0.0",
+ "@vitejs/plugin-legacy": "^4.1.0",
+ "@vitejs/plugin-vue": "^4.2.3",
+ "@vitejs/plugin-vue-jsx": "^3.0.1",
+ "@vue/compiler-sfc": "^3.3.4",
"autoprefixer": "^10.4.14",
- "commitizen": "^4.3.0",
"cross-env": "^7.0.3",
- "dotenv": "^16.0.3",
- "eslint": "^8.40.0",
+ "dotenv": "^16.3.1",
+ "eslint": "^8.44.0",
"eslint-config-prettier": "^8.8.0",
- "eslint-plugin-prettier": "^4.2.1",
- "eslint-plugin-vue": "^9.12.0",
- "esno": "^0.16.3",
+ "eslint-plugin-prettier": "^5.0.0",
+ "eslint-plugin-vue": "^9.15.1",
+ "esno": "^0.17.0",
"fs-extra": "^11.1.1",
"less": "^4.1.3",
- "lint-staged": "13.2.2",
+ "lint-staged": "13.2.3",
"picocolors": "^1.0.0",
- "postcss": "^8.4.23",
+ "postcss": "^8.4.25",
"postcss-html": "^1.5.0",
"postcss-less": "^6.0.0",
- "prettier": "^2.8.8",
- "rimraf": "^5.0.0",
- "rollup": "^3.20.1",
- "rollup-plugin-visualizer": "^5.9.0",
- "stylelint": "^14.16.0",
- "stylelint-config-prettier": "^9.0.4",
- "stylelint-config-recommended": "^9.0.0",
- "stylelint-config-recommended-vue": "^1.4.0",
- "stylelint-config-standard": "^29.0.0",
- "stylelint-order": "^5.0.0",
+ "prettier": "^3.0.0",
+ "rimraf": "^5.0.1",
+ "rollup-plugin-visualizer": "^5.9.2",
+ "stylelint": "^15.10.1",
+ "stylelint-config-recommended": "^13.0.0",
+ "stylelint-config-recommended-vue": "^1.5.0",
+ "stylelint-config-standard": "^34.0.0",
+ "stylelint-order": "^6.0.3",
"ts-node": "^10.9.1",
- "typescript": "^5.0.2",
- "vite": "^3.2.6",
+ "typescript": "^5.1.6",
+ "vite": "^4.4.3",
"vite-plugin-compression": "^0.5.1",
- "vite-plugin-html": "^3.2.0",
+ "vite-plugin-html-transform": "^1.0.0",
"vite-plugin-imagemin": "^0.6.1",
"vite-plugin-purge-icons": "^0.9.2",
"vite-plugin-style-import": "^2.0.0",
"vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-theme": "^0.8.6",
- "vite-plugin-windicss": "^1.8.10",
- "vue-eslint-parser": "^9.1.0",
- "vue-tsc": "^1.2.0"
- },
- "resolutions": {
- "bin-wrapper": "npm:bin-wrapper-china",
- "rollup": "^2.68.0",
- "gifsicle": "5.2.0"
+ "vite-plugin-windicss": "^1.9.0",
+ "vue-eslint-parser": "^9.3.1",
+ "vue-tsc": "^1.8.4"
},
"engines": {
- "node": ">=16"
+ "node": ">=16.15.1",
+ "pnpm": ">=8.1.0"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
diff --git
a/streampark-console/streampark-console-webapp/src/components/Application/src/AppDarkModeToggle.vue
b/streampark-console/streampark-console-webapp/src/components/Application/src/AppDarkModeToggle.vue
index 40b5c4964..abf6c47ea 100644
---
a/streampark-console/streampark-console-webapp/src/components/Application/src/AppDarkModeToggle.vue
+++
b/streampark-console/streampark-console-webapp/src/components/Application/src/AppDarkModeToggle.vue
@@ -79,7 +79,9 @@
height: 18px;
background-color: #fff;
border-radius: 50%;
- transition: transform 0.5s, background-color 0.5s;
+ transition:
+ transform 0.5s,
+ background-color 0.5s;
will-change: transform;
}
diff --git
a/streampark-console/streampark-console-webapp/src/components/Container/src/collapse/CollapseContainer.vue
b/streampark-console/streampark-console-webapp/src/components/Container/src/collapse/CollapseContainer.vue
index 473c8e965..8891737f2 100644
---
a/streampark-console/streampark-console-webapp/src/components/Container/src/collapse/CollapseContainer.vue
+++
b/streampark-console/streampark-console-webapp/src/components/Container/src/collapse/CollapseContainer.vue
@@ -46,7 +46,7 @@
import { Skeleton } from 'ant-design-vue';
import { CollapseTransition } from '/@/components/Transition';
import CollapseHeader from './CollapseHeader.vue';
- import { triggerWindowResize } from '/@/utils/event';
+ import { triggerWindowResize as triggerWindowResizeFn } from
'/@/utils/event';
// hook
import { useTimeoutFn } from '/@/hooks/core/useTimeout';
import { useDesign } from '/@/hooks/web/useDesign';
@@ -87,7 +87,7 @@
show.value = isNil(val) ? !show.value : val;
if (props.triggerWindowResize) {
// 200 milliseconds here is because the expansion has animation,
- useTimeoutFn(triggerWindowResize, 200);
+ useTimeoutFn(triggerWindowResizeFn, 200);
}
}
diff --git
a/streampark-console/streampark-console-webapp/src/components/ContextMenu/src/ContextMenu.vue
b/streampark-console/streampark-console-webapp/src/components/ContextMenu/src/ContextMenu.vue
index 122b6e711..61cc99b7f 100644
---
a/streampark-console/streampark-console-webapp/src/components/ContextMenu/src/ContextMenu.vue
+++
b/streampark-console/streampark-console-webapp/src/components/ContextMenu/src/ContextMenu.vue
@@ -195,7 +195,9 @@
background-color: @component-background;
border: 1px solid rgb(0 0 0 / 8%);
border-radius: 0.25rem;
- box-shadow: 0 2px 2px 0 rgb(0 0 0 / 14%), 0 3px 1px -2px rgb(0 0 0 / 10%),
+ box-shadow:
+ 0 2px 2px 0 rgb(0 0 0 / 14%),
+ 0 3px 1px -2px rgb(0 0 0 / 10%),
0 1px 5px 0 rgb(0 0 0 / 6%);
background-clip: padding-box;
user-select: none;
diff --git
a/streampark-console/streampark-console-webapp/src/components/Form/src/BasicForm.vue
b/streampark-console/streampark-console-webapp/src/components/Form/src/BasicForm.vue
index 0169b4c86..ab4c10638 100644
---
a/streampark-console/streampark-console-webapp/src/components/Form/src/BasicForm.vue
+++
b/streampark-console/streampark-console-webapp/src/components/Form/src/BasicForm.vue
@@ -129,7 +129,7 @@
});
const getBindValue = computed(
- () => ({ ...attrs, ...props, ...unref(getProps) } as Recordable),
+ () => ({ ...attrs, ...props, ...unref(getProps) }) as Recordable,
);
const getSchema = computed((): FormSchema[] => {
diff --git
a/streampark-console/streampark-console-webapp/src/components/Icon/src/SvgIcon.vue
b/streampark-console/streampark-console-webapp/src/components/Icon/src/SvgIcon.vue
index 2c565d68b..d3274cc38 100644
---
a/streampark-console/streampark-console-webapp/src/components/Icon/src/SvgIcon.vue
+++
b/streampark-console/streampark-console-webapp/src/components/Icon/src/SvgIcon.vue
@@ -13,7 +13,8 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---><template>
+-->
+<template>
<svg
:class="[prefixCls, $attrs.class, spin && 'svg-icon-spin']"
:style="getStyle"
diff --git
a/streampark-console/streampark-console-webapp/src/components/Page/src/PageFooter.vue
b/streampark-console/streampark-console-webapp/src/components/Page/src/PageFooter.vue
index 153302646..c499ccf65 100644
---
a/streampark-console/streampark-console-webapp/src/components/Page/src/PageFooter.vue
+++
b/streampark-console/streampark-console-webapp/src/components/Page/src/PageFooter.vue
@@ -55,7 +55,9 @@
line-height: 44px;
background-color: @component-background;
border-top: 1px solid @border-color-base;
- box-shadow: 0 -6px 16px -8px rgb(0 0 0 / 8%), 0 -9px 28px 0 rgb(0 0 0 /
5%),
+ box-shadow:
+ 0 -6px 16px -8px rgb(0 0 0 / 8%),
+ 0 -9px 28px 0 rgb(0 0 0 / 5%),
0 -12px 48px 16px rgb(0 0 0 / 3%);
transition: width 0.2s;
diff --git
a/streampark-console/streampark-console-webapp/src/hooks/web/useLockPage.ts
b/streampark-console/streampark-console-webapp/src/hooks/web/useLockPage.ts
index de0380811..47aa6eb5f 100644
--- a/streampark-console/streampark-console-webapp/src/hooks/web/useLockPage.ts
+++ b/streampark-console/streampark-console-webapp/src/hooks/web/useLockPage.ts
@@ -48,9 +48,12 @@ export function useLockPage() {
}
clear();
- timeId = setTimeout(() => {
- lockPage();
- }, lockTime * 60 * 1000);
+ timeId = setTimeout(
+ () => {
+ lockPage();
+ },
+ lockTime * 60 * 1000,
+ );
}
function lockPage(): void {
diff --git a/streampark-console/streampark-console-webapp/src/utils/env.ts
b/streampark-console/streampark-console-webapp/src/utils/env.ts
index bb37d46b7..5cd66d35c 100644
--- a/streampark-console/streampark-console-webapp/src/utils/env.ts
+++ b/streampark-console/streampark-console-webapp/src/utils/env.ts
@@ -18,8 +18,11 @@ import type { GlobEnvConfig } from '/#/config';
import { warn } from '/@/utils/log';
import pkg from '../../package.json';
-import { getConfigFileName } from '../../build/getConfigFileName';
-
+const getVariableName = (title: string) => {
+ return `__PRODUCTION__${title.replace(/\s/g, '_').replace(/-/g, '_') ||
'__APP'}__CONF__`
+ .toUpperCase()
+ .replace(/\s/g, '');
+};
export function getCommonStoragePrefix() {
const { VITE_GLOB_APP_SHORT_NAME } = getAppEnvConfig();
return `${VITE_GLOB_APP_SHORT_NAME}__${getEnv()}`.toUpperCase();
@@ -31,7 +34,7 @@ export function getStorageShortName() {
}
export function getAppEnvConfig() {
- const ENV_NAME = getConfigFileName(import.meta.env);
+ const ENV_NAME = getVariableName(import.meta.env.VITE_GLOB_APP_TITLE);
const ENV = (import.meta.env.DEV
? // Get the global configuration (the configuration will be extracted
independently when packaging)
diff --git a/streampark-console/streampark-console-webapp/src/utils/props.ts
b/streampark-console/streampark-console-webapp/src/utils/props.ts
index 92fe2810b..5828c8cf7 100644
--- a/streampark-console/streampark-console-webapp/src/utils/props.ts
+++ b/streampark-console/streampark-console-webapp/src/utils/props.ts
@@ -191,7 +191,7 @@ export const buildProps = <
: never;
};
-export const definePropType = <T>(val: any) => ({ [wrapperKey]: val } as
PropWrapper<T>);
+export const definePropType = <T>(val: any) => ({ [wrapperKey]: val }) as
PropWrapper<T>;
export const keyOf = <T extends Object>(arr: T) => Object.keys(arr) as
Array<keyof T>;
export const mutable = <T extends readonly any[] | Record<string,
unknown>>(val: T) =>
diff --git
a/streampark-console/streampark-console-webapp/src/views/base/login/Login.vue
b/streampark-console/streampark-console-webapp/src/views/base/login/Login.vue
index 0bb1a2678..d34791923 100644
---
a/streampark-console/streampark-console-webapp/src/views/base/login/Login.vue
+++
b/streampark-console/streampark-console-webapp/src/views/base/login/Login.vue
@@ -121,9 +121,12 @@
}
}
- [data-theme='dark']{
- .@{prefix-cls}-form{
- .ant-form-item-has-error
:not(.ant-input-affix-wrapper-disabled):not(.ant-input-affix-wrapper-borderless).ant-input-affix-wrapper,
+ [data-theme='dark'] {
+ .@{prefix-cls}-form {
+ .ant-form-item-has-error
+ :not(.ant-input-affix-wrapper-disabled):not(
+ .ant-input-affix-wrapper-borderless
+ ).ant-input-affix-wrapper,
.ant-input-affix-wrapper,
.ant-input {
color: rgba(0, 0, 0, 0.85);
diff --git
a/streampark-console/streampark-console-webapp/src/views/flink/project/Add.vue
b/streampark-console/streampark-console-webapp/src/views/flink/project/Add.vue
index 6c3ff847f..41c6215d9 100644
---
a/streampark-console/streampark-console-webapp/src/views/flink/project/Add.vue
+++
b/streampark-console/streampark-console-webapp/src/views/flink/project/Add.vue
@@ -71,7 +71,7 @@
<PageWrapper contentFullHeight contentBackground contentClass="p-26px">
<BasicForm
@register="registerForm"
- @submit="(values:Recordable)=>handleSubmit(values,handleCreateAction)"
+ @submit="(values: Recordable) => handleSubmit(values,
handleCreateAction)"
>
<template #formFooter>
<div class="flex items-center w-full justify-center">
diff --git
a/streampark-console/streampark-console-webapp/src/views/flink/project/Edit.vue
b/streampark-console/streampark-console-webapp/src/views/flink/project/Edit.vue
index 2650ad78d..99748c59f 100644
---
a/streampark-console/streampark-console-webapp/src/views/flink/project/Edit.vue
+++
b/streampark-console/streampark-console-webapp/src/views/flink/project/Edit.vue
@@ -101,7 +101,7 @@
<PageWrapper contentFullHeight contentBackground contentClass="p-26px">
<BasicForm
@register="registerForm"
- @submit="(values:Recordable)=>handleSubmit(values,handleEditAction)"
+ @submit="(values: Recordable) => handleSubmit(values, handleEditAction)"
>
<template #formFooter>
<div class="flex items-center w-full justify-center">
diff --git
a/streampark-console/streampark-console-webapp/src/views/setting/Alarm/components/AlertModal.vue
b/streampark-console/streampark-console-webapp/src/views/setting/Alarm/components/AlertModal.vue
index 824277770..1a4a56e86 100644
---
a/streampark-console/streampark-console-webapp/src/views/setting/Alarm/components/AlertModal.vue
+++
b/streampark-console/streampark-console-webapp/src/views/setting/Alarm/components/AlertModal.vue
@@ -209,7 +209,7 @@
:placeholder="t('setting.alarm.faultAlertType')"
allowClear
mode="multiple"
- @change="(value: string[]) => alertType = value"
+ @change="(value: string[]) => (alertType = value)"
>
<SelectOption
v-for="(v, k) in alertTypes"
diff --git a/streampark-console/streampark-console-webapp/stylelint.config.js
b/streampark-console/streampark-console-webapp/stylelint.config.js
index a6f8c0ff2..d21474b4c 100644
--- a/streampark-console/streampark-console-webapp/stylelint.config.js
+++ b/streampark-console/streampark-console-webapp/stylelint.config.js
@@ -17,7 +17,7 @@
module.exports = {
root: true,
plugins: ['stylelint-order'],
- extends: ['stylelint-config-standard', 'stylelint-config-prettier'],
+ extends: ['stylelint-config-standard'],
customSyntax: 'postcss-html',
rules: {
'function-no-unknown': null,
diff --git a/streampark-console/streampark-console-webapp/vite.config.ts
b/streampark-console/streampark-console-webapp/vite.config.ts
index edb6b6a4c..e73ebc325 100644
--- a/streampark-console/streampark-console-webapp/vite.config.ts
+++ b/streampark-console/streampark-console-webapp/vite.config.ts
@@ -34,8 +34,8 @@ const __APP_INFO__ = {
pkg: { dependencies, devDependencies, name, version },
lastBuildTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
};
-// const prefix = 'monaco-editor/esm/vs';
-export default ({ command, mode }: ConfigEnv): UserConfig => {
+const prefix = 'monaco-editor/esm/vs';
+export default async ({ command, mode }: ConfigEnv): Promise<UserConfig> => {
const root = process.cwd();
const env = loadEnv(mode, root);
@@ -83,31 +83,18 @@ export default ({ command, mode }: ConfigEnv): UserConfig
=> {
target: 'es2015',
cssTarget: 'chrome80',
outDir: OUTPUT_DIR,
- // minify: 'terser',
- /**
- * When minify="minify:'terser'" unwraps the comment
- * Uncomment when minify="minify:'terser'"
- */
- // terserOptions: {
- // compress: {
- // keep_infinity: true,
- // drop_console: VITE_DROP_CONSOLE,
- // },
- // },
// Turning off brotliSize display can slightly reduce packaging time
reportCompressedSize: false,
chunkSizeWarningLimit: 2000,
// monaco editor
rollupOptions: {
- // output: {
- // manualChunks: {
- // jsonWorker: [`${prefix}/language/json/json.worker`],
- // cssWorker: [`${prefix}/language/css/css.worker`],
- // htmlWorker: [`${prefix}/language/html/html.worker`],
- // tsWorker: [`${prefix}/language/typescript/ts.worker`],
- // editorWorker: [`${prefix}/editor/editor.worker`],
- // },
- // },
+ maxParallelFileOps: 3,
+ output: {
+ manualChunks: {
+ vue: ['vue', 'pinia', 'vue-router'],
+ antd: ['ant-design-vue', '@ant-design/icons-vue'],
+ },
+ },
},
},
define: {
@@ -130,7 +117,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig
=> {
},
// The vite plugin used by the project. The quantity is large, so it is
separately extracted and managed
- plugins: createVitePlugins(viteEnv, isBuild),
+ plugins: await createVitePlugins(viteEnv, isBuild),
optimizeDeps: {
// @iconify/iconify: The dependency is dynamically and virtually loaded
by @purge-icons/generated, so it needs to be specified explicitly
@@ -140,6 +127,11 @@ export default ({ command, mode }: ConfigEnv): UserConfig
=> {
'@iconify/iconify',
'ant-design-vue/es/locale/zh_CN',
'ant-design-vue/es/locale/en_US',
+ `${prefix}/language/json/json.worker`,
+ `${prefix}/language/css/css.worker`,
+ `${prefix}/language/html/html.worker`,
+ `${prefix}/language/typescript/ts.worker`,
+ `${prefix}/editor/editor.worker`,
],
},
};