From 8907b76a1735fe8caa8d834367c4ab47548aeb73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=86=E5=95=A6=E5=A5=BD=E6=A2=A6?= <530353222@qq.com> Date: Fri, 14 Apr 2023 16:40:06 +0800 Subject: [PATCH] 3.1.0 --- electron/config/encrypt.js | 12 ++++++--- electron/index.js | 48 ++++++++++++++++++++++++++++++++++++ main.js | 50 ++------------------------------------ package.json | 3 ++- 4 files changed, 61 insertions(+), 52 deletions(-) create mode 100644 electron/index.js diff --git a/electron/config/encrypt.js b/electron/config/encrypt.js index 1eb1a73..78ac182 100644 --- a/electron/config/encrypt.js +++ b/electron/config/encrypt.js @@ -1,10 +1,16 @@ /** * 加密配置 + * @param type - confusion | bytecode | strict */ module.exports = { - type: 'bytecode', - directory: [ - 'electron' + type: 'confusion', + files: [ + 'electron/**/*.(js|json)', + '!electron/config/encrypt.js', + '!electron/config/nodemon.json' + ], + cleanFiles: [ + 'electron', ], fileExt: ['.js'], confusionOptions: { diff --git a/electron/index.js b/electron/index.js new file mode 100644 index 0000000..ce8a962 --- /dev/null +++ b/electron/index.js @@ -0,0 +1,48 @@ +const { Application } = require('ee-core'); + +class App extends Application { + + constructor() { + super(); + } + + /** + * core app have been loaded + */ + async ready () { + // do some things + } + + /** + * electron app ready + */ + async electronAppReady () { + // do some things + } + + /** + * main window have been loaded + */ + async windowReady () { + // do some things + // 延迟加载,无白屏 + const winOpt = this.config.windowsOption; + if (winOpt.show == false) { + const win = this.electron.mainWindow; + win.once('ready-to-show', () => { + win.show(); + }) + } + } + + /** + * before app close + */ + async beforeClose () { + // do some things + + } +} + +App.toString = () => '[class App]'; +module.exports = App; \ No newline at end of file diff --git a/main.js b/main.js index 54ed562..597dc8f 100644 --- a/main.js +++ b/main.js @@ -1,51 +1,5 @@ -const { Application } = require('ee-core'); const EE = require('ee-core/ee'); - -class Main extends Application { - - constructor() { - super(); - // this === eeApp; - } - - /** - * core app have been loaded - */ - async ready () { - // do some things - } - - /** - * electron app ready - */ - async electronAppReady () { - // do some things - } - - /** - * main window have been loaded - */ - async windowReady () { - // do some things - // 延迟加载,无白屏 - const winOpt = this.config.windowsOption; - if (winOpt.show == false) { - const win = this.electron.mainWindow; - win.once('ready-to-show', () => { - win.show(); - }) - } - } - - /** - * before app close - */ - async beforeClose () { - // do some things - - } -} +const App = require('./electron'); // Instantiate an app object -EE.app = new Main(); - +EE.app = new App(); \ No newline at end of file diff --git a/package.json b/package.json index 6bfe926..16f8c1c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ee", - "version": "3.0.1", + "version": "3.1.0", "description": "A fast, desktop software development framework", "main": "main.js", "scripts": { @@ -27,6 +27,7 @@ "build-lp-64": "electron-builder -l=pacman --x64", "rd": "ee-core rd --dist_dir=./frontend/dist", "encrypt": "ee-core encrypt", + "clean": "ee-core clean", "rebuild": "electron-rebuild", "re-sqlite": "electron-rebuild -f -w better-sqlite3" },