哆啦好梦 2 yıl önce
ebeveyn
işleme
8907b76a17
4 değiştirilmiş dosya ile 61 ekleme ve 52 silme
  1. 9 3
      electron/config/encrypt.js
  2. 48 0
      electron/index.js
  3. 2 48
      main.js
  4. 2 1
      package.json

+ 9 - 3
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: {

+ 48 - 0
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;

+ 2 - 48
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();

+ 2 - 1
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"
   },