From 89cda57d1da9c0930c8a6571ed75a93cf0d08ee2 Mon Sep 17 00:00:00 2001 From: gaoshuaixing <530353222@qq.com> Date: Sun, 12 Jan 2025 22:33:59 +0800 Subject: [PATCH] feat: some config --- cmd/bin.js | 24 ++---------- electron/service/os/window.js | 5 ++- frontend/package.json | 4 +- frontend/src/components/global/index.js | 2 +- frontend/src/utils/iconList.js | 50 ++++++++++++------------- package.json | 1 + 6 files changed, 36 insertions(+), 50 deletions(-) diff --git a/cmd/bin.js b/cmd/bin.js index b382afa..cf1599d 100644 --- a/cmd/bin.js +++ b/cmd/bin.js @@ -130,7 +130,7 @@ module.exports = { */ encrypt: { frontend: { - type: 'none', + type: 'confusion', files: [ './public/dist/**/*.(js|json)', ], @@ -139,14 +139,13 @@ module.exports = { compact: true, stringArray: true, stringArrayEncoding: ['none'], - deadCodeInjection: false, - stringArrayCallsTransform: false, - numbersToExpressions: false, + stringArrayCallsTransform: true, + numbersToExpressions: true, target: 'browser', } }, electron: { - type: 'none', + type: 'confusion', files: [ './public/electron/**/*.(js|json)', ], @@ -161,21 +160,6 @@ module.exports = { target: 'node', } } - // type: 'confusion', // none | confusion | bytecode | strict - // files: [ - // './public/electron/**/*.(js|json)', - // ], - // fileExt: ['.js'], - // cleanFiles: ['./public/electron'], - // specificFiles: ['./public/electron/preload/bridge.js'], - // confusionOptions: { - // compact: true, - // stringArray: true, - // stringArrayEncoding: ['rc4'], - // deadCodeInjection: false, - // stringArrayCallsTransform: true, - // numbersToExpressions: true, - // } }, /** diff --git a/electron/service/os/window.js b/electron/service/os/window.js index 4cb440c..c00c710 100644 --- a/electron/service/os/window.js +++ b/electron/service/os/window.js @@ -6,6 +6,7 @@ const { getMainWindow } = require('ee-core/electron'); const { isProd, getBaseDir } = require('ee-core/ps'); const { getConfig } = require('ee-core/config'); const { isFileProtocol } = require('ee-core/utils'); +const { logger } = require('ee-core/log'); /** * Window @@ -32,7 +33,7 @@ class WindowService { let addr = 'http://localhost:8080' if (isProd()) { const { mainServer } = getConfig(); - if (isFileProtocol(mainServer)) { + if (isFileProtocol(mainServer.protocol)) { addr = mainServer.protocol + path.join(getBaseDir(), mainServer.indexPath); } else { addr = mainServer.protocol + mainServer.host + ':' + mainServer.port; @@ -44,7 +45,7 @@ class WindowService { // some } - console.log('contentUrl: ', contentUrl); + logger.info('[createWindow] url: ', contentUrl); const opt = { title: windowTitle, x: 10, diff --git a/frontend/package.json b/frontend/package.json index cf2681d..764f728 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "ee", - "version": "1.0.0", + "version": "4.0.0", "scripts": { "dev": "vite --host --port 8080", "serve": "vite --host --port 8080", @@ -27,7 +27,7 @@ "postcss": "^8.4.13", "postcss-pxtorem": "^6.0.0", "terser": "^5.19.1", - "vite": "^4.4.4", + "vite": "^5.4.11", "vite-plugin-compression": "^0.5.1" } } diff --git a/frontend/src/components/global/index.js b/frontend/src/components/global/index.js index 9227d20..35e4bf5 100644 --- a/frontend/src/components/global/index.js +++ b/frontend/src/components/global/index.js @@ -1,5 +1,5 @@ import iconFont from './iconFont' -const modules = import.meta.globEager('./*.vue') +const modules = import.meta.glob('./*.vue', { eager: true }) const map = {} Object.keys(modules).forEach(file => { const modulesName = file.replace('./', '').replace('.vue', '') diff --git a/frontend/src/utils/iconList.js b/frontend/src/utils/iconList.js index 9b1335e..e8597aa 100644 --- a/frontend/src/utils/iconList.js +++ b/frontend/src/utils/iconList.js @@ -1,27 +1,27 @@ export default [ - { name: '对话框', type: 'icon-duihuakuang' }, - { name: '闹钟', type: 'icon-naozhong' }, - { name: '笑脸', type: 'icon-xiaolian' }, - { name: 'ok', type: 'icon-ok' }, - { name: '风车', type: 'icon-fengche' }, - { name: '汗颜', type: 'icon-hanyan' }, - { name: '相机', type: 'icon-xiangji' }, - { name: '礼物', type: 'icon-liwu' }, - { name: '礼花', type: 'icon-lihua' }, - { name: '扭蛋', type: 'icon-niudan' }, - { name: '流星', type: 'icon-liuxing' }, - { name: '风筝', type: 'icon-fengzheng' }, - { name: '蛋糕', type: 'icon-dangao' }, - { name: '泡泡', type: 'icon-paopao' }, - { name: '购物', type: 'icon-gouwu' }, - { name: '饮料', type: 'icon-yinliao' }, - { name: '云彩', type: 'icon-yuncai' }, - { name: '彩铅', type: 'icon-caiqian' }, - { name: '纸飞机', type: 'icon-zhifeiji' }, - { name: '点赞', type: 'icon-dianzan' }, - { name: '煎蛋', type: 'icon-jiandan' }, - { name: '小熊', type: 'icon-xiaoxiong' }, - { name: '花', type: 'icon-hua' }, - { name: '眼睛', type: 'icon-yanjing' }, - ] + { name: '对话框', type: 'icon-duihuakuang' }, + { name: '闹钟', type: 'icon-naozhong' }, + { name: '笑脸', type: 'icon-xiaolian' }, + { name: 'ok', type: 'icon-ok' }, + { name: '风车', type: 'icon-fengche' }, + { name: '汗颜', type: 'icon-hanyan' }, + { name: '相机', type: 'icon-xiangji' }, + { name: '礼物', type: 'icon-liwu' }, + { name: '礼花', type: 'icon-lihua' }, + { name: '扭蛋', type: 'icon-niudan' }, + { name: '流星', type: 'icon-liuxing' }, + { name: '风筝', type: 'icon-fengzheng' }, + { name: '蛋糕', type: 'icon-dangao' }, + { name: '泡泡', type: 'icon-paopao' }, + { name: '购物', type: 'icon-gouwu' }, + { name: '饮料', type: 'icon-yinliao' }, + { name: '云彩', type: 'icon-yuncai' }, + { name: '彩铅', type: 'icon-caiqian' }, + { name: '纸飞机', type: 'icon-zhifeiji' }, + { name: '点赞', type: 'icon-dianzan' }, + { name: '煎蛋', type: 'icon-jiandan' }, + { name: '小熊', type: 'icon-xiaoxiong' }, + { name: '花', type: 'icon-hua' }, + { name: '眼睛', type: 'icon-yanjing' }, +] \ No newline at end of file diff --git a/package.json b/package.json index e36f05e..0c911ce 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "build-go-m": "ee-bin move --flag=go_static,go_config,go_package,go_images && ee-bin build --cmds=go_m", "build-go-l": "ee-bin move --flag=go_static,go_config,go_package,go_images && ee-bin build --cmds=go_l", "build-python": "ee-bin build --cmds=python && ee-bin move --flag=python_dist", + "encrypt": "ee-bin encrypt", "clean": "ee-bin clean", "icon": "ee-bin icon", "re-sqlite": "electron-rebuild -f -w better-sqlite3",