样板和 CLI
🌐 Boilerplates and CLIs
Electron 开发没有固定的标准——开发、构建、打包或发布 Electron 应用没有“唯一正确的方式”。Electron 的额外功能,无论是构建时还是运行时,通常都可以在 npm 中的单独包中找到,从而允许开发者构建所需的应用和构建进程。
🌐 Electron development is unopinionated - there is no "one true way" to develop, build, package, or release an Electron application. Additional features for Electron, both for build- and run-time, can usually be found on npm in individual packages, allowing developers to build both the app and build pipeline they need.
这种模块化和可扩展性的程度确保了所有使用 Electron 的开发者,无论团队规模大小,在整个开发生命周期中都不会受到任何限制。然而,对于许多开发者来说,使用社区驱动的模板或命令行工具可能会大大简化应用的编译、打包和发布进程。
🌐 That level of modularity and extendability ensures that all developers working with Electron, both big and small in team-size, are never restricted in what they can or cannot do at any time during their development lifecycle. However, for many developers, one of the community-driven boilerplates or command line tools might make it dramatically easier to compile, package, and release an app.
样板与 CLI
🌐 Boilerplate vs CLI
样板代码只是一个起点——可以说是一个画布——你可以在此基础上构建你的应用。它们通常以代码仓库的形式出现,你可以克隆并随心所欲地进行自定义。
🌐 A boilerplate is only a starting point - a canvas, so to speak - from which you build your application. They usually come in the form of a repository you can clone and customize to your heart's content.
另一方面,命令行工具在整个开发和发布进程中都会支持你。它们更有帮助和支持性,但会对你的代码结构和构建方式提出指导建议。尤其对于初学者来说,使用命令行工具可能会很有帮助。
🌐 A command line tool on the other hand continues to support you throughout the development and release. They are more helpful and supportive but enforce guidelines on how your code should be structured and built. Especially for beginners, using a command line tool is likely to be helpful.
Electron Forge
Electron Forge 是一个用于打包和发布 Electron 应用的工具。它将 Electron 的工具生态系统统一到一个可扩展的界面中,使任何人都可以直接开始制作 Electron 应用。
🌐 Electron Forge is a tool for packaging and publishing Electron applications. It unifies Electron's tooling ecosystem into a single extensible interface so that anyone can jump right into making Electron apps.
Forge 附带了一个可直接使用的模板,使用 Webpack 作为打包工具。它包含一个示例 TypeScript 配置,并提供两个配置文件以便轻松定制。它使用了整个 Electron 社区常用的核心模块(如 @electron/packager)——由 Electron 维护者(如 Slack)所做的更改同样惠及 Forge 的用户。
🌐 Forge comes with a ready-to-use template using Webpack as a bundler. It includes an example typescript configuration and provides two configuration files to enable easy customization. It uses the same core modules used by the
greater Electron community (like @electron/packager) –
changes made by Electron maintainers (like Slack) benefit Forge's users, too.
你可以在 electronforge.io 找到更多信息和文档。
🌐 You can find more information and documentation on electronforge.io.
electron-builder
一个“完整的解决方案,用于打包和构建可分发的 Electron 应用”,专注于一体化体验。electron-builder 添加了一个专注于简便性的依赖,并在内部管理所有后续需求。
🌐 A "complete solution to package and build a ready-for-distribution Electron app"
that focuses on an integrated experience. electron-builder adds one
single dependency focused on simplicity and manages all further requirements
internally.
electron-builder 用自定义的功能和模块替换了 Electron 维护者使用的功能和模块(例如自动更新器)。这些功能通常集成得更紧密,但与 Atom、Visual Studio Code 或 Slack 等流行 Electron 应用的相似性会更少。
你可以在仓库中找到更多信息和文档。
🌐 You can find more information and documentation in the repository.
electron-react-boilerplate
如果你不需要任何工具,只想要一个可以直接构建的坚实模板,CT Lin 的 electron-react-boilerplate 可能值得一看。它在社区中相当受欢迎,并在内部使用了 electron-builder。
🌐 If you don't want any tools but only a solid boilerplate to build from,
CT Lin's electron-react-boilerplate might be worth
a look. It's quite popular in the community and uses electron-builder
internally.
其他工具和样板
🌐 Other Tools and Boilerplates
"Awesome Electron" 列表 包含了更多可供选择的工具和模板。如果你觉得列表的长度令人望而生畏,别忘了,随着项目的进行逐步添加工具也是一种有效的方法。
🌐 The "Awesome Electron" list contains more tools and boilerplates to choose from. If you find the length of the list intimidating, don't forget that adding tools as you go along is a valid approach, too.