首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

源代码目录结构 | Source Code Directory Structure

Electron的源代码被分成几个部分,大部分遵循Chromium的分离惯例。

您可能需要熟悉Chromium的多进程架构以更好地理解源代码。

源代码结构

代码语言:javascript
复制
Electron
├── atom/ - C++ source code.
|   ├── app/ - System entry code.
|   ├── browser/ - The frontend including the main window, UI, and all of the
|   |   main process things. This talks to the renderer to manage web pages.
|   |   ├── ui/ - Implementation of UI stuff for different platforms.
|   |   |   ├── cocoa/ - Cocoa specific source code.
|   |   |   ├── win/ - Windows GUI specific source code.
|   |   |   └── x/ - X11 specific source code.
|   |   ├── api/ - The implementation of the main process APIs.
|   |   ├── net/ - Network related code.
|   |   ├── mac/ - Mac specific Objective-C source code.
|   |   └── resources/ - Icons, platform-dependent files, etc.
|   ├── renderer/ - Code that runs in renderer process.
|   |   └── api/ - The implementation of renderer process APIs.
|   └── common/ - Code that used by both the main and renderer processes,
|       including some utility functions and code to integrate node's message
|       loop into Chromium's message loop.
|       └── api/ - The implementation of common APIs, and foundations of
|           Electron's built-in modules.
├── chromium_src/ - Source code that copied from Chromium.
├── default_app/ - The default page to show when Electron is started without
|   providing an app.
├── docs/ - Documentations.
├── lib/ - JavaScript source code.
|   ├── browser/ - Javascript main process initialization code.
|   |   └── api/ - Javascript API implementation.
|   ├── common/ - JavaScript used by both the main and renderer processes
|   |   └── api/ - Javascript API implementation.
|   └── renderer/ - Javascript renderer process initialization code.
|       └── api/ - Javascript API implementation.
├── spec/ - Automatic tests.
├── electron.gyp - Building rules of Electron.
└── common.gypi - Compiler specific settings and building rules for other
    components like `node` and `breakpad`.

其他目录的结构

  • 脚本 - 用于建筑,包装,测试等开发目的的脚本
  • 工具 - gyp文件使用的帮助程序脚本,与script放置在此处的脚本不应该直接由用户调用。
  • 供应商 - 第三方依赖关系的源代码,我们没有使用third_party它作为名称,因为它会将它与Chromium的源代码树中的相同目录混淆。
  • node_modules - 用于构建的第三方节点模块。
  • out - 临时输出目录ninja
  • dist - script/create-dist.py创建分发时由脚本创建的临时目录。
  • external_binaries - 下载不支持构建的第三方框架的二进制文件gyp

保持Git子模块最新

Electron存储库有一些自销的依赖关系,可在/ vendor目录中找到。偶尔你会在运行时看到类似这样的消息git status

代码语言:javascript
复制
$ git status

	modified:   vendor/libchromiumcontent (new commits)
	modified:   vendor/node (new commits)

要更新这些依赖项,运行以下命令:

代码语言:javascript
复制
git submodule update --init --recursive

如果你发现自己经常运行这个命令,你可以在你的~/.gitconfig文件中为它创建一个别名:

代码语言:javascript
复制
[alias]
	su = submodule update --init --recursive

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com