样板和 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 应用的共同点较少。
¥electron-builder
replaces features and modules used by the Electron
maintainers (such as the auto-updater) with custom ones. They are generally
tighter integrated but will have less in common with popular Electron apps
like Atom, Visual Studio Code, or Slack.
你可以在 存储库 中找到更多信息和文档。
¥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
"令人敬畏的 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.