模板和命令行界面
Electron 的开发并不那么死板. 也就是说, 开发, 编译, 打包, 与发布 Electron 应用程序的方法中, 没有一个是可以称为 "唯一标准" 的方法. Electron 的编译和运行时相关额外功能通常可以在 npm 的独立安装包中找到, 这样开发者就可以根据自己的需求同时编译应用和 build pipeline.
得益于高度的模块化和扩展性,所有的开发团队,无论大小都可以在整个开发周期中无往不利、所向披靡。 与此同时,对于大多数开发者来说如果能有一款社区驱动的boilerplates或者命令行 工具,无疑会使应用的编译、打包、分发更加简单。
Boilerplates and CLIs
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.
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.
模板与命令行界面
一个模板就像是一张空白的画布,你可以以它为基础来搭建你的应用。 通常来说,你可以从一个代码仓库克隆一个模板,然后修改成你心仪的样子。
命令行工具则是在整个开发和分发过程中从另一方面给你提供帮助。 他们更有用,但同时也对代码结构和构建项目有着硬性的要求。 特别是对于初学者来说,命令行工具十分有用。
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 Forge将多个现有的( 且有稳定维护的 )Electron构建工具整合为一个简单易用的工具包,所有人都可以用它来快速地搭建Electron开发环境。
Forge 将一些流行框架整合为“开箱即用”的模板,比如:React、Vue、Angular等。 Forge 的一些核心模块来自于上层的Electron社区(比如electron-packager
),因而Electron主要维护人员(比如说Slack)提交的Electron更新也会使Forge的用户受益。
关于Forge的更多信息,请查阅electronforge.io。
electron-forge
A "complete tool for building modern Electron applications". Electron Forge unifies the existing (and well maintained) build tools for Electron development into a cohesive package so that anyone can jump right in to Electron development.
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.
You can find more information and documentation on electronforge.io.
electron-builder
Electron Builder 是一个完备的Electron应用打包和分发解决方案,它致力于软件开发的集成体验。 electron-builder
出于简化的目的添加了一个依赖项,可以在内部管理所有更多的要求。
electron-builder
会将Electron维护者使用的模块和功能(例如: auto-updater) 替换为自定义的. Electron Builder打包的应用内组件的集成度会更高,同时与主流的Electron应用共同点也就更少了。
关于Electron Builder的更多信息,请查阅代码仓库。
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
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
。
electron-react-boilerplate
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.
其它工具和模板
"Awesome Electron" 列表涵盖了众多可供选择的工具和模板。 如果您发现列表的长度令人畏惧,请不要忘记,您也可以在开发过程中逐渐添加工具。
Other Tools and Boilerplates
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.