欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 健康 > 养生 > 如何使用electron-forge开发上位机ui

如何使用electron-forge开发上位机ui

2025/5/2 11:00:55 来源:https://blog.csdn.net/weixin_56694865/article/details/147588079  浏览:    关键词:如何使用electron-forge开发上位机ui

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、下一步开始添加自己的功能吧。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词