升级electron egg脚手架版本
This commit is contained in:
@@ -1,108 +0,0 @@
|
||||
/**
|
||||
* 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: 18091,
|
||||
indexPath: 'index.html'
|
||||
},
|
||||
electron: {
|
||||
directory: './',
|
||||
cmd: 'electron',
|
||||
args: ['.', '--env=local', '--color=always'], // --env: local|prod; '--color=always' 控制台颜色
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 构建
|
||||
* ee-bin build
|
||||
*/
|
||||
build: {
|
||||
frontend: {
|
||||
directory: './frontend',
|
||||
cmd: 'npm',
|
||||
args: ['run', 'build'],
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 移动资源
|
||||
* ee-bin move
|
||||
*/
|
||||
move: {
|
||||
frontend_dist: {
|
||||
dist: './frontend/dist',
|
||||
target: './public/dist'
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 预发布模式(prod)
|
||||
* ee-bin start
|
||||
*/
|
||||
start: {
|
||||
directory: './',
|
||||
cmd: 'electron',
|
||||
args: ['.', '--env=prod']
|
||||
},
|
||||
|
||||
/**
|
||||
* 加密
|
||||
*/
|
||||
encrypt: {
|
||||
// confusion - 压缩混淆加密
|
||||
// bytecode - 字节码加密
|
||||
// strict - 先混淆加密,然后字节码加密
|
||||
type: 'confusion',
|
||||
// 文件匹配
|
||||
// ! 符号开头的意思是过滤
|
||||
files: [
|
||||
'electron/**/*.(js|json)',
|
||||
'!electron/config/encrypt.js',
|
||||
'!electron/config/nodemon.json',
|
||||
'!electron/config/builder.json',
|
||||
'!electron/config/bin.json',
|
||||
],
|
||||
// 需要加密的文件后缀,暂时只支持js
|
||||
fileExt: ['.js'],
|
||||
// 混淆加密配置
|
||||
confusionOptions: {
|
||||
// 压缩成一行
|
||||
compact: true,
|
||||
// 删除字符串文字并将其放置在一个特殊数组中
|
||||
stringArray: true,
|
||||
// 对stringArray的所有字符串文字进行编码,值:'none' | 'base64' | 'rc4'
|
||||
stringArrayEncoding: ['none'],
|
||||
// 注入死代码,注:影响性能
|
||||
deadCodeInjection: false,
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 执行自定义命令
|
||||
* ee-bin exec
|
||||
*/
|
||||
exec: {
|
||||
node_v: {
|
||||
directory: './',
|
||||
cmd: 'node',
|
||||
args: ['-v'],
|
||||
},
|
||||
npm_v: {
|
||||
directory: './',
|
||||
cmd: 'npm',
|
||||
args: ['-v'],
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,60 +0,0 @@
|
||||
{
|
||||
"productName": "pqs9100",
|
||||
"appId": "com.njcn.pqs9100",
|
||||
"copyright": "hongawen.com",
|
||||
"directories": {
|
||||
"output": "out"
|
||||
},
|
||||
"asar": true,
|
||||
"files": [
|
||||
"**/*",
|
||||
"!frontend/",
|
||||
"!run/",
|
||||
"!logs/",
|
||||
"!data/"
|
||||
],
|
||||
"extraResources": {
|
||||
"from": "build/extraResources/",
|
||||
"to": "extraResources"
|
||||
},
|
||||
"nsis": {
|
||||
"oneClick": false,
|
||||
"allowElevation": true,
|
||||
"allowToChangeInstallationDirectory": true,
|
||||
"installerIcon": "build/icons/icon.ico",
|
||||
"uninstallerIcon": "build/icons/icon.ico",
|
||||
"installerHeaderIcon": "build/icons/icon.ico",
|
||||
"createDesktopShortcut": true,
|
||||
"createStartMenuShortcut": true,
|
||||
"shortcutName": "自动检测平台"
|
||||
},
|
||||
"publish": [
|
||||
{
|
||||
"provider": "generic",
|
||||
"url": "http://www.shining-electric.com/"
|
||||
}
|
||||
],
|
||||
"mac": {
|
||||
"icon": "build/icons/icon.icns",
|
||||
"artifactName": "${productName}-${os}-${version}-${arch}.${ext}",
|
||||
"darkModeSupport": true,
|
||||
"hardenedRuntime": false
|
||||
},
|
||||
"win": {
|
||||
"icon": "build/icons/icon.ico",
|
||||
"artifactName": "${productName}-${os}-${version}-${arch}.${ext}",
|
||||
"target": [
|
||||
{
|
||||
"target": "nsis"
|
||||
}
|
||||
]
|
||||
},
|
||||
"linux": {
|
||||
"icon": "build/icons/icon.icns",
|
||||
"artifactName": "${productName}-${os}-${version}-${arch}.${ext}",
|
||||
"target": [
|
||||
"deb"
|
||||
],
|
||||
"category": "Utility"
|
||||
}
|
||||
}
|
||||
@@ -1,185 +1,71 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const {getBaseDir} = require('ee-core/ps');
|
||||
|
||||
/**
|
||||
* 默认配置
|
||||
*/
|
||||
module.exports = (appInfo) => {
|
||||
|
||||
const config = {};
|
||||
|
||||
/**
|
||||
* 开发者工具
|
||||
*/
|
||||
config.openDevTools = false;
|
||||
|
||||
/**
|
||||
* 应用程序顶部菜单
|
||||
*/
|
||||
config.openAppMenu = true;
|
||||
|
||||
/**
|
||||
* 1.507
|
||||
* 主窗口
|
||||
*/
|
||||
config.windowsOption = {
|
||||
title: '自动检测平台',
|
||||
width: 1920 /1.5,
|
||||
height: 1080 /1.2,
|
||||
minWidth: 1920 /1.5,
|
||||
minHeight: 1080 /1.2,
|
||||
webPreferences: {
|
||||
//webSecurity: false,
|
||||
contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要bridge.js(contextBridge)
|
||||
nodeIntegration: true,
|
||||
//preload: path.join(appInfo.baseDir, 'preload', 'bridge.js'),
|
||||
},
|
||||
frame: true,
|
||||
show: false,
|
||||
icon: path.join(appInfo.home, 'public', 'images', 'logo-32.png'),
|
||||
};
|
||||
|
||||
/**
|
||||
* ee框架日志
|
||||
*/
|
||||
config.logger = {
|
||||
encoding: 'utf8',
|
||||
level: 'INFO',
|
||||
outputJSON: false,
|
||||
buffer: true,
|
||||
enablePerformanceTimer: false,
|
||||
rotator: 'day',
|
||||
appLogName: 'pqs9100.log',
|
||||
coreLogName: 'pqs9100-core.log',
|
||||
errorLogName: 'pqs9100-error.log'
|
||||
}
|
||||
|
||||
/**
|
||||
* 远程模式-web地址
|
||||
*/
|
||||
config.remoteUrl = {
|
||||
enable: false,
|
||||
url: 'http://electron-egg.kaka996.com/'
|
||||
};
|
||||
|
||||
/**
|
||||
* 内置socket服务
|
||||
*/
|
||||
config.socketServer = {
|
||||
enable: false, // 是否开启
|
||||
port: 7070,// 默认端口
|
||||
path: "/socket.io/", // 默认路径名称
|
||||
connectTimeout: 45000, // 客户端连接超时时间
|
||||
pingTimeout: 30000, // 心跳检测超时时间
|
||||
pingInterval: 25000, // 心跳检测间隔时间
|
||||
maxHttpBufferSize: 1e8, // 每条消息的数据最大值
|
||||
transports: ["polling", "websocket"], // http轮询和websocket
|
||||
cors: {
|
||||
origin: true, // http协议时,需要设置允许跨域
|
||||
},
|
||||
channel: 'c1' // 默认频道c1,可以自定义
|
||||
};
|
||||
|
||||
/**
|
||||
* 内置http服务
|
||||
*/
|
||||
config.httpServer = {
|
||||
enable: false,
|
||||
https: {
|
||||
enable: false,
|
||||
key: '/public/ssl/localhost+1.key',
|
||||
cert: '/public/ssl/localhost+1.pem'
|
||||
},
|
||||
host: '127.0.0.1',
|
||||
port: 7071,
|
||||
cors: {
|
||||
origin: "*" // 默认允许跨域
|
||||
},
|
||||
body: {
|
||||
multipart: true,
|
||||
formidable: {
|
||||
keepExtensions: true
|
||||
}
|
||||
},
|
||||
filterRequest: {
|
||||
uris: [
|
||||
'favicon.ico' // 默认过滤的uri favicon.ico
|
||||
],
|
||||
returnData: ''
|
||||
module.exports = () => {
|
||||
return {
|
||||
openDevTools: false,
|
||||
singleLock: true,
|
||||
windowsOption: {
|
||||
title: 'NPQS9100-自动检测平台',
|
||||
menuBarVisible: false,
|
||||
width: 1920,
|
||||
height: 1000,
|
||||
minWidth: 1024,
|
||||
minHeight: 640,
|
||||
webPreferences: {
|
||||
//webSecurity: false,
|
||||
contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要bridge.js(contextBridge)
|
||||
nodeIntegration: true,
|
||||
//preload: path.join(getElectronDir(), 'preload', 'bridge.js'),
|
||||
},
|
||||
frame: true,
|
||||
show: true,
|
||||
icon: path.join(getBaseDir(), 'public', 'images', 'logo-32.png'),
|
||||
},
|
||||
logger: {
|
||||
level: 'INFO',
|
||||
outputJSON: false,
|
||||
appLogName: '9100.log',
|
||||
coreLogName: '9100-core.log',
|
||||
errorLogName: '9100-error.log'
|
||||
},
|
||||
// 远程web地址
|
||||
remote: {
|
||||
enable: false,
|
||||
url: ''
|
||||
},
|
||||
socketServer: {
|
||||
enable: false,
|
||||
port: 7070,
|
||||
path: "/socket.io/",
|
||||
connectTimeout: 45000,
|
||||
pingTimeout: 30000,
|
||||
pingInterval: 25000,
|
||||
maxHttpBufferSize: 1e8,
|
||||
transports: ["polling", "websocket"],
|
||||
cors: {
|
||||
origin: true,
|
||||
},
|
||||
channel: 'socket-channel'
|
||||
},
|
||||
httpServer: {
|
||||
enable: false,
|
||||
https: {
|
||||
enable: false,
|
||||
key: '/public/ssl/localhost+1.key',
|
||||
cert: '/public/ssl/localhost+1.pem'
|
||||
},
|
||||
host: '127.0.0.1',
|
||||
port: 7071,
|
||||
},
|
||||
mainServer: {
|
||||
indexPath: '/public/dist/index.html',
|
||||
channelSeparator: '/',
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 主进程
|
||||
*/
|
||||
config.mainServer = {
|
||||
protocol: 'file://',
|
||||
indexPath: '/public/dist/index.html',
|
||||
};
|
||||
|
||||
/**
|
||||
* 硬件加速
|
||||
*/
|
||||
config.hardGpu = {
|
||||
enable: true
|
||||
};
|
||||
|
||||
/**
|
||||
* 异常捕获
|
||||
*/
|
||||
config.exception = {
|
||||
mainExit: false, // 主进程退出时是否捕获异常
|
||||
childExit: true,
|
||||
rendererExit: true,
|
||||
};
|
||||
|
||||
/**
|
||||
* jobs
|
||||
*/
|
||||
config.jobs = {
|
||||
messageLog: true // 是否打印进程间通信的消息log
|
||||
};
|
||||
|
||||
/**
|
||||
* 插件功能
|
||||
* @param window 官方内置插件
|
||||
* @param tray 托盘插件
|
||||
* @param security 安全插件
|
||||
* @param awaken 唤醒插件
|
||||
* @param autoUpdater 自动升级插件
|
||||
*/
|
||||
config.addons = {
|
||||
window: {
|
||||
enable: true,
|
||||
},
|
||||
tray: {
|
||||
enable: true,
|
||||
title: '自动检测平台',
|
||||
icon: '/public/images/tray.png'
|
||||
},
|
||||
security: {
|
||||
enable: true,
|
||||
},
|
||||
awaken: {
|
||||
enable: true,
|
||||
protocol: 'ee',
|
||||
args: []
|
||||
},
|
||||
autoUpdater: {
|
||||
enable: true,
|
||||
windows: false,
|
||||
macOS: false,
|
||||
linux: false,
|
||||
options: {
|
||||
provider: 'generic',
|
||||
url: 'http://kodo.qiniu.com/'
|
||||
},
|
||||
force: false,
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
...config
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,31 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* 开发环境配置,覆盖 config.default.js
|
||||
* Development environment configuration, coverage config.default.js
|
||||
*/
|
||||
module.exports = (appInfo) => {
|
||||
const config = {};
|
||||
|
||||
/**
|
||||
* 开发者工具
|
||||
*/
|
||||
config.openDevTools = {
|
||||
mode: 'undocked'
|
||||
};
|
||||
|
||||
/**
|
||||
* 应用程序顶部菜单
|
||||
*/
|
||||
config.openAppMenu = false;
|
||||
|
||||
/**
|
||||
* jobs
|
||||
*/
|
||||
config.jobs = {
|
||||
messageLog: true
|
||||
};
|
||||
|
||||
module.exports = () => {
|
||||
return {
|
||||
...config
|
||||
openDevTools: false,
|
||||
jobs: {
|
||||
messageLog: false
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,29 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* 生产环境配置,覆盖 config.default.js
|
||||
* coverage config.default.js
|
||||
*/
|
||||
module.exports = (appInfo) => {
|
||||
const config = {};
|
||||
|
||||
/**
|
||||
* 开发者工具
|
||||
*/
|
||||
config.openDevTools = false;
|
||||
|
||||
/**
|
||||
* 应用程序顶部菜单
|
||||
*/
|
||||
config.openAppMenu = false;
|
||||
|
||||
/**
|
||||
* jobs
|
||||
*/
|
||||
config.jobs = {
|
||||
messageLog: false
|
||||
};
|
||||
|
||||
module.exports = () => {
|
||||
return {
|
||||
...config
|
||||
openDevTools: false,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"watch": [
|
||||
"electron/",
|
||||
"main.js"
|
||||
],
|
||||
"ignore": [],
|
||||
"ext": "js,json",
|
||||
"verbose": true,
|
||||
"exec": "electron . --env=local --hot-reload=1",
|
||||
"restartable": "hr",
|
||||
"colours": true,
|
||||
"events": {}
|
||||
}
|
||||
Reference in New Issue
Block a user