mirror of
https://gitee.com/dromara/electron-egg.git
synced 2026-05-14 19:52:10 +08:00
3.7.0
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
- 🍩 **为什么使用?** 桌面软件(办公方向、 个人工具),仍然是未来十几年PC端需求之一,提高工作效率
|
- 🍩 **为什么使用?** 桌面软件(办公方向、 个人工具),仍然是未来十几年PC端需求之一,提高工作效率
|
||||||
- 🍉 **简单:** 只需懂 JavaScript
|
- 🍉 **简单:** 只需懂 JavaScript
|
||||||
- 🍑 **愿景:** 所有开发者都能学会桌面软件研发
|
- 🍑 **愿景:** 所有开发者都能学会桌面软件研发
|
||||||
- 🍰 **gitee:** https://gitee.com/dromara/electron-egg **3600+**
|
- 🍰 **gitee:** https://gitee.com/dromara/electron-egg **3700+**
|
||||||
- 🍨 **github:** https://github.com/dromara/electron-egg **1000+**
|
- 🍨 **github:** https://github.com/dromara/electron-egg **1000+**
|
||||||
- 🏆 码云最有价值开源项目
|
- 🏆 码云最有价值开源项目
|
||||||

|

|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
- 🍩 **为什么使用?** 桌面软件(办公方向、 个人工具),仍然是未来十几年PC端需求之一,提高工作效率
|
- 🍩 **为什么使用?** 桌面软件(办公方向、 个人工具),仍然是未来十几年PC端需求之一,提高工作效率
|
||||||
- 🍉 **简单:** 只需懂 JavaScript
|
- 🍉 **简单:** 只需懂 JavaScript
|
||||||
- 🍑 **愿景:** 所有开发者都能学会桌面软件研发
|
- 🍑 **愿景:** 所有开发者都能学会桌面软件研发
|
||||||
- 🍰 **gitee:** https://gitee.com/dromara/electron-egg **3600+**
|
- 🍰 **gitee:** https://gitee.com/dromara/electron-egg **3700+**
|
||||||
- 🍨 **github:** https://github.com/dromara/electron-egg **1000+**
|
- 🍨 **github:** https://github.com/dromara/electron-egg **1000+**
|
||||||
- 🏆 码云最有价值开源项目
|
- 🏆 码云最有价值开源项目
|
||||||

|

|
||||||
|
|||||||
@@ -102,9 +102,12 @@ class AutoUpdaterAddon {
|
|||||||
info.status = status.downloaded;
|
info.status = status.downloaded;
|
||||||
info.desc = '下载完成';
|
info.desc = '下载完成';
|
||||||
this.sendStatusToWindow(info);
|
this.sendStatusToWindow(info);
|
||||||
// quit and update
|
|
||||||
// app.appQuit();
|
|
||||||
autoUpdater.quitAndInstall();
|
autoUpdater.quitAndInstall();
|
||||||
|
// const mainWindow = CoreWindow.getMainWindow();
|
||||||
|
// if (mainWindow) {
|
||||||
|
// mainWindow.destroy()
|
||||||
|
// }
|
||||||
|
// electronApp.appQuit()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,16 @@ class JavaServerAddon {
|
|||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
async check () {
|
async check () {
|
||||||
|
Log.info("进入-----检查服务是否启动------"+this.javaServer);
|
||||||
|
if(this.javaServer == undefined){
|
||||||
|
Log.info("[addon:javaServer:check] status-----------"+false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const flag = await this.javaServer.isRun(Conf.getValue('addons.javaServer'));
|
||||||
|
Log.info("[addon:javaServer:check] status-----------"+flag);
|
||||||
|
|
||||||
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -95,6 +95,32 @@ class JavaServer {
|
|||||||
// todo linux
|
// todo linux
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务是否运行中
|
||||||
|
*/
|
||||||
|
async isRun(cfg){
|
||||||
|
const jarName = cfg.name;
|
||||||
|
if (is.windows()) {
|
||||||
|
const resultList = ps.lookup({
|
||||||
|
command: "java",
|
||||||
|
where: 'caption="javaw.exe"',
|
||||||
|
arguments: jarName,
|
||||||
|
});
|
||||||
|
|
||||||
|
Log.info("[addon:javaServer] resultList:", resultList);
|
||||||
|
return resultList.length>0;
|
||||||
|
} else if (is.macOS()) {
|
||||||
|
const cmd = `ps -ef | grep java | grep ${jarName} | grep -v grep | awk '{print $2}' `;
|
||||||
|
Log.info("[addon:javaServer:isRun] cmdStr:", cmd);
|
||||||
|
const result = execSync(cmd);
|
||||||
|
Log.info('[addon:javaServer:isRun] result:', result.toString());
|
||||||
|
//不等于空说明正在运行
|
||||||
|
return result.toString()!==""
|
||||||
|
} else {
|
||||||
|
// todo linux
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = JavaServer;
|
module.exports = JavaServer;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
const { Tray, Menu, shell } = require('electron');
|
const { Tray, Menu } = require('electron');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const Ps = require('ee-core/ps');
|
const Ps = require('ee-core/ps');
|
||||||
const Log = require('ee-core/log');
|
const Log = require('ee-core/log');
|
||||||
@@ -62,12 +62,6 @@ class TrayAddon {
|
|||||||
this.tray.setToolTip(cfg.title);
|
this.tray.setToolTip(cfg.title);
|
||||||
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate);
|
const contextMenu = Menu.buildFromTemplate(trayMenuTemplate);
|
||||||
this.tray.setContextMenu(contextMenu);
|
this.tray.setContextMenu(contextMenu);
|
||||||
|
|
||||||
// 使用默认浏览器打开链接
|
|
||||||
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
|
|
||||||
shell.openExternal(url);
|
|
||||||
return { action: 'deny' }
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
76
electron/config/bin.js
Normal file
76
electron/config/bin.js
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
/**
|
||||||
|
* ee-bin 配置
|
||||||
|
* 仅适用于开发环境
|
||||||
|
*/
|
||||||
|
module.exports = {
|
||||||
|
/**
|
||||||
|
* development serve ("frontend" "electron" )
|
||||||
|
* ee-bin dev
|
||||||
|
*/
|
||||||
|
dev: {
|
||||||
|
frontend: {
|
||||||
|
directory: './frontend',
|
||||||
|
cmd: 'npm',
|
||||||
|
args: ['run', 'dev'],
|
||||||
|
protocol: 'http://',
|
||||||
|
hostname: 'localhost',
|
||||||
|
port: 8080,
|
||||||
|
indexPath: 'index.html'
|
||||||
|
},
|
||||||
|
electron: {
|
||||||
|
directory: './',
|
||||||
|
cmd: 'electron',
|
||||||
|
args: ['.', '--env=local'],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前端构建
|
||||||
|
* ee-bin build
|
||||||
|
*/
|
||||||
|
build: {
|
||||||
|
directory: './frontend',
|
||||||
|
cmd: 'npm',
|
||||||
|
args: ['run', 'build'],
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移动资源
|
||||||
|
* ee-bin rd
|
||||||
|
*/
|
||||||
|
rd: {
|
||||||
|
dist: './frontend/dist',
|
||||||
|
target: './public/dist'
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预发布模式(prod)
|
||||||
|
* ee-bin start
|
||||||
|
*/
|
||||||
|
start: {
|
||||||
|
directory: './',
|
||||||
|
cmd: 'electron',
|
||||||
|
args: ['.', '--env=prod']
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加密
|
||||||
|
*/
|
||||||
|
encrypt: {
|
||||||
|
type: 'confusion',
|
||||||
|
files: [
|
||||||
|
'electron/**/*.(js|json)',
|
||||||
|
'!electron/config/encrypt.js',
|
||||||
|
'!electron/config/nodemon.json',
|
||||||
|
'!electron/config/builder.json',
|
||||||
|
'!electron/config/bin.json',
|
||||||
|
],
|
||||||
|
fileExt: ['.js'],
|
||||||
|
confusionOptions: {
|
||||||
|
compact: true,
|
||||||
|
stringArray: true,
|
||||||
|
stringArrayEncoding: ['none'],
|
||||||
|
deadCodeInjection: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -9,27 +9,6 @@ module.exports = (appInfo) => {
|
|||||||
|
|
||||||
const config = {};
|
const config = {};
|
||||||
|
|
||||||
/**
|
|
||||||
* 应用模式配置
|
|
||||||
*/
|
|
||||||
config.developmentMode = {
|
|
||||||
default: 'vue',
|
|
||||||
mode: {
|
|
||||||
vue: {
|
|
||||||
hostname: 'localhost',
|
|
||||||
port: 8080
|
|
||||||
},
|
|
||||||
react: {
|
|
||||||
hostname: 'localhost',
|
|
||||||
port: 3000
|
|
||||||
},
|
|
||||||
html: {
|
|
||||||
hostname: 'localhost',
|
|
||||||
indexPage: 'index.html'
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开发者工具
|
* 开发者工具
|
||||||
*/
|
*/
|
||||||
@@ -38,7 +17,7 @@ module.exports = (appInfo) => {
|
|||||||
/**
|
/**
|
||||||
* 应用程序顶部菜单
|
* 应用程序顶部菜单
|
||||||
*/
|
*/
|
||||||
config.openAppMenu = 'dev-show';
|
config.openAppMenu = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主窗口
|
* 主窗口
|
||||||
@@ -50,7 +29,7 @@ module.exports = (appInfo) => {
|
|||||||
minWidth: 800,
|
minWidth: 800,
|
||||||
minHeight: 650,
|
minHeight: 650,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
//webSecurity: false, // 跨域问题 -> 打开注释
|
webSecurity: false,
|
||||||
contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要bridge.js(contextBridge)
|
contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要bridge.js(contextBridge)
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
//preload: path.join(appInfo.baseDir, 'preload', 'bridge.js'),
|
//preload: path.join(appInfo.baseDir, 'preload', 'bridge.js'),
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ module.exports = (appInfo) => {
|
|||||||
/**
|
/**
|
||||||
* 开发者工具
|
* 开发者工具
|
||||||
*/
|
*/
|
||||||
config.openDevTools = true;
|
config.openDevTools = {
|
||||||
|
mode: 'undocked'
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 应用程序顶部菜单
|
* 应用程序顶部菜单
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
/**
|
|
||||||
* 加密配置
|
|
||||||
* @param type - confusion | bytecode | strict
|
|
||||||
*/
|
|
||||||
module.exports = {
|
|
||||||
type: 'confusion',
|
|
||||||
files: [
|
|
||||||
'electron/**/*.(js|json)',
|
|
||||||
'!electron/config/encrypt.js',
|
|
||||||
'!electron/config/nodemon.json',
|
|
||||||
'!electron/config/builder.json',
|
|
||||||
],
|
|
||||||
fileExt: ['.js'],
|
|
||||||
confusionOptions: {
|
|
||||||
compact: true,
|
|
||||||
stringArray: true,
|
|
||||||
stringArrayEncoding: ['none'],
|
|
||||||
deadCodeInjection: false,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -32,6 +32,7 @@ class Index extends Application {
|
|||||||
const win = this.electron.mainWindow;
|
const win = this.electron.mainWindow;
|
||||||
win.once('ready-to-show', () => {
|
win.once('ready-to-show', () => {
|
||||||
win.show();
|
win.show();
|
||||||
|
win.focus();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
27
package.json
27
package.json
@@ -1,13 +1,21 @@
|
|||||||
{
|
{
|
||||||
"name": "ee",
|
"name": "ee",
|
||||||
"version": "3.6.0",
|
"version": "3.7.0",
|
||||||
"description": "A fast, desktop software development framework",
|
"description": "A fast, desktop software development framework",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron . ",
|
"dev": "ee-bin dev",
|
||||||
"dev": "electron . --env=local",
|
"dev-frontend": "ee-bin dev --serve=frontend",
|
||||||
|
"dev-electron": "ee-bin dev --serve=electron",
|
||||||
|
"build-frontend": "ee-bin build",
|
||||||
|
"start": "ee-bin start",
|
||||||
|
"rd": "ee-bin rd",
|
||||||
|
"encrypt": "ee-bin encrypt",
|
||||||
|
"clean": "ee-bin clean",
|
||||||
|
"icon": "ee-bin icon",
|
||||||
"reload": "nodemon --config ./electron/config/nodemon.json",
|
"reload": "nodemon --config ./electron/config/nodemon.json",
|
||||||
"test": "set DEBUG=* && electron . --env=local",
|
"rebuild": "electron-rebuild",
|
||||||
|
"re-sqlite": "electron-rebuild -f -w better-sqlite3",
|
||||||
"build-w": "electron-builder --config=./electron/config/builder.json -w=nsis --x64",
|
"build-w": "electron-builder --config=./electron/config/builder.json -w=nsis --x64",
|
||||||
"build-w-32": "electron-builder --config=./electron/config/builder.json -w=nsis --ia32",
|
"build-w-32": "electron-builder --config=./electron/config/builder.json -w=nsis --ia32",
|
||||||
"build-w-64": "electron-builder --config=./electron/config/builder.json -w=nsis --x64",
|
"build-w-64": "electron-builder --config=./electron/config/builder.json -w=nsis --x64",
|
||||||
@@ -25,12 +33,7 @@
|
|||||||
"build-l-armv7l": "electron-builder --config=./electron/config/builder.json -l=deb --armv7l",
|
"build-l-armv7l": "electron-builder --config=./electron/config/builder.json -l=deb --armv7l",
|
||||||
"build-lr-64": "electron-builder --config=./electron/config/builder.json -l=rpm --x64",
|
"build-lr-64": "electron-builder --config=./electron/config/builder.json -l=rpm --x64",
|
||||||
"build-lp-64": "electron-builder --config=./electron/config/builder.json -l=pacman --x64",
|
"build-lp-64": "electron-builder --config=./electron/config/builder.json -l=pacman --x64",
|
||||||
"rd": "ee-bin rd",
|
"test": "set DEBUG=* && electron . --env=local"
|
||||||
"encrypt": "ee-bin encrypt",
|
|
||||||
"clean": "ee-bin clean",
|
|
||||||
"icon": "ee-bin icon",
|
|
||||||
"rebuild": "electron-rebuild",
|
|
||||||
"re-sqlite": "electron-rebuild -f -w better-sqlite3"
|
|
||||||
},
|
},
|
||||||
"repository": "https://github.com/dromara/electron-egg.git",
|
"repository": "https://github.com/dromara/electron-egg.git",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@@ -43,7 +46,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@electron/rebuild": "^3.2.13",
|
"@electron/rebuild": "^3.2.13",
|
||||||
"debug": "^4.3.3",
|
"debug": "^4.3.3",
|
||||||
"ee-bin": "^1.1.0",
|
"ee-bin": "^1.2.0",
|
||||||
"electron": "^21.4.4",
|
"electron": "^21.4.4",
|
||||||
"electron-builder": "^23.6.0",
|
"electron-builder": "^23.6.0",
|
||||||
"eslint": "^5.13.0",
|
"eslint": "^5.13.0",
|
||||||
@@ -52,7 +55,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dayjs": "^1.10.7",
|
"dayjs": "^1.10.7",
|
||||||
"ee-core": "^2.4.0",
|
"ee-core": "^2.5.0",
|
||||||
"electron-updater": "^5.3.0",
|
"electron-updater": "^5.3.0",
|
||||||
"lodash": "^4.17.21"
|
"lodash": "^4.17.21"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user