Electron Forge是一个用于快速构建、打包和发布Electron应用程序的工具。它提供了一种简单的方式来设置Electron项目,并使用现代工具和最佳实践来管理应用程序的开发和部署过程。使用Electron Forge,开发人员可以轻松地创建跨平台的桌面应用程序,无需深入了解Electron的底层技术细节。Electron Forge提供了一系列的命令行工具和配置选项,使得构建和发布Electron应用变得更加简单和高效。
要下载和安装ElectroForge,您可以按照以下步骤操作:
官网
1、首先你得安装npm,自行搜索
npm install -g electron-forge
等待安装完成
2、创建你的第一个代码程序
npx create-electron-app@latest my-app
Using templates
Forge’s initialization scripts can add additional template code with the --template=[template-name] flag.
npx create-electron-app@latest my-app --template=webpack
There are currently four first-party templates:
webpack
webpack-typescript
vite
vite-typescript
All of these templates are built around plugins that bundle your JavaScript code for production and includes a dev server to provide a better developer experience.
3、启动代码
cd my-app
npm start
4、编译代码
npm run make
生成可执行 程序,交货,下班。
5、Publishing your app
Now you have distributables that you can share with your users. If you run the publish script, Electron Forge will then publish the platform-specific distributables for you, using the publishing method of your choice. For example, if you want to publish your assets to GitHub, you can install the GitHub publisher dependency using:
npm install --save-dev @electron-forge/publisher-github
Once you have configured the publisher according to the documentation, run the following command to upload your distributables:
npm run publish
For more information on what publishers we currently support, check out the Publishers documentation.
6、下一步开始添加自己的功能吧。