Logo 逆向知识库

Electron 开发

推荐用 yarn

electron forge

yarn add electron-builder --dev

 

"scripts": {
  "app:dir": "electron-builder --dir",
  "app:dist": "electron-builder"
}

然后

yarn app:dist

 

electron-builder 还是太智能了,可以选择不将软件打包成可安装的形式,而是直接打包成 tar.xz 或者 zip

{
  "name": "package",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "build-linux": "electron-builder --linux tar.xz",
    "build-win": "electron-builder --windows zip"
  },
  "license": "MIT",
  "devDependencies": {
    "@electron-forge/cli": "^7.8.0",
    "electron": "^35.1.4",
    "electron-builder": "^26.0.12"
  }
}