0.1.14 • Published 2 years ago

electron-lab v0.1.14

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Electron Lab

Electron 的研发脚手架,包含开发、构建脚本和对应的运行时 API。

$ npm install electron-lab --save

使用命令行脚本

使用 NPX

$ npx el start
$ npx el build

使用 packages.json

{
  "scripts": {
    "start": "el start",
    "build": "el build"
  }
}

参数

start

参数含义默认值示例
--inspect主进程 debug 的 inspect 端口$ el start --inspect=3999
--port渲染进程 dev server 端口$ el start --port=4001

build

参数含义默认值示例
--output打包输出路径./dist$ el build --output=./some-dir

额外的脚手架配置

主进程和渲染进程都使用 webpack 打包,app 使用 electron-builder 打包,可以根据自己的需要增加额外一些配置。存放路径都在项目的根目录。

默认配置可以查看 node_modules/electron-lab/config

说明路径
主进程额外配置main.webpack.config.js
渲染进程额外配置renderer.webpack.config.js
builder 配置electron-builder.config.js

使用运行时 API

import el from 'electron-lab';

el.getEntry(entry?:string): string

参数说明默认值
entry入口名称"index"

el.openSubWindow(options:BrowserWindowConstructorOptions & { entry: string }): BrowserWindow

参数说明默认值
options启动子窗口的参数-