Browse Source

docs: update source code dir structure (#21659)

Shelley Vohr 5 years ago
parent
commit
2e7f9bffeb
2 changed files with 63 additions and 68 deletions
  1. 0 33
      docs-translations/README.md
  2. 63 35
      docs/development/source-code-directory-structure.md

+ 0 - 33
docs-translations/README.md

@@ -1,33 +0,0 @@
-## Docs Translations
-
-This directory once contained unstructured translations of Electron's 
-documentation, but has been deprecated in favor of a new translation process 
-using [Crowdin], a GitHub-friendly platform for collaborative translation.
-
-For more details, visit the [electron/i18n] repo.
-
-## Contributing
-
-If you're interested in helping translate Electron's docs, visit 
-[Crowdin] and log in with your GitHub account. And thanks!
-
-## Offline Docs
-
-If you miss having access to Electron's raw markdown files in your preferred
-language, don't fret! You can still get raw docs, they're just in a 
-different place now. See [electron/i18n/tree/master/content]
-
-To more easily view and browse offline docs in your language, clone the repo and use [vmd], 
-an Electron-based GitHub-styled markdown viewer:
-
-```sh
-npm i -g vmd
-git clone https://github.com/electron/i18n
-vmd electron-i18n/content/zh-CN
-```
-
-[crowdin.com/project/electron]: https://crowdin.com/project/electron
-[Crowdin]: https://crowdin.com/project/electron
-[electron/i18n]: https://github.com/electron/i18n#readme
-[electron/i18n/tree/master/content]: https://github.com/electron/i18n/tree/master/content
-[vmd]: http://ghub.io/vmd

+ 63 - 35
docs/development/source-code-directory-structure.md

@@ -11,7 +11,48 @@ to understand the source code better.
 
 ```diff
 Electron
-├── atom/ - C++ source code.
+├── build/ - Build configuration files needed to build with GN.
+├── buildflags/ - Determines the set of features that can be conditionally built.
+├── chromium_src/ - Source code copied from Chromium that isn't part of the content layer.
+├── default_app/ - A default app run when Electron is started without
+|                  providing a consumer app.
+├── docs/ - Electron's documentation.
+|   ├── api/ - Documentation for Electron's externally-facing modules and APIs.
+|   ├── development/ - Documentation to aid in developing for and with Electron.
+|   ├── fiddles/ - A set of code snippets one can run in Electron Fiddle.
+|   ├── images/ - Images used in documentation.
+|   └── tutorial/ - Tutorial documents for various aspects of Electron.
+├── lib/ - JavaScript/TypeScript source code.
+|   ├── browser/ - Main process initialization code.
+|   |   ├── api/ - API implementation for main process modules.
+|   |   └── remote/ - Code related to the remote module as it is
+|   |                 used in the main process.
+|   ├── common/ - Relating to logic needed by both main and renderer processes.
+|   |   └── api/ - API implementation for modules that can be used in
+|   |              both the main and renderer processes
+|   ├── isolated_renderer/ - Handles creation of isolated renderer processes when
+|   |                        contextIsolation is enabled.
+|   ├── renderer/ - Renderer process initialization code.
+|   |   ├── api/ - API implementation for renderer process modules.
+|   |   ├── extension/ - Code related to use of Chrome Extensions
+|   |   |                in Electron's renderer process.
+|   |   ├── remote/ - Logic that handes use of the remote module in
+|   |   |             the main process.
+|   |   └── web-view/ - Logic that handles the use of webviews in the
+|   |                   renderer process.
+|   ├── sandboxed_renderer/ - Logic that handles creation of sandboxed renderer
+|   |   |                     processes.
+|   |   └── api/ - API implementation for sandboxed renderer processes.
+|   └── worker/ - Logic that handles proper functionality of Node.js
+|                 environments in Web Workers.
+├── patches/ - Patches applied on top of Electron's core dependencies
+|   |          in order to handle differences between our use cases and
+|   |          default functionality.
+|   ├── boringssl/ - Patches applied to Google's fork of OpenSSL, BoringSSL.
+|   ├── chromium/ - Patches applied to Chromium.
+|   ├── node/ - Patches applied on top of Node.js.
+|   └── v8/ - Patches applied on top of Google's V8 engine.
+├── shell/ - 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
@@ -31,49 +72,36 @@ Electron
 |       |         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 copied from Chromium. See below.
-├── 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.
+├── spec/ - Components of Electron's test suite run in the renderer process.
+├── spec-main/ - Components of Electron's test suite run in the main process.
 └── BUILD.gn - Building rules of Electron.
 ```
 
-## `/chromium_src`
-
-The files in `/chromium_src` tend to be pieces of Chromium that aren't part of
-the content layer. For example to implement Pepper API, we need some wiring
-similar to what official Chrome does. We could have built the relevant
-sources as a part of [libcc](../glossary.md#libchromiumcontent) but most
-often we don't require all the features (some tend to be proprietary,
-analytics stuff) so we took parts of the code. These could have easily
-been patches in libcc, but at the time when these were written the goal of
-libcc was to maintain very minimal patches and chromium_src changes tend to be
-big ones. Also, note that these patches can never be upstreamed unlike other
-libcc patches we maintain now.
-
 ## Structure of Other Directories
 
-* **script** - Scripts used for development purpose like building, packaging,
-  testing, etc.
-* **tools** - Helper scripts used by GN files, unlike `script`, scripts put
-  here should never be invoked by users directly.
-* **vendor** - Source code of third party dependencies, we didn't use
-  `third_party` as name because it would confuse it with the same directory in
-  Chromium's source code tree.
-* **node_modules** - Third party node modules used for building.
-* **out** - Temporary output directory of `ninja`.
+* **.circleci** - Config file for CI with CircleCI.
+* **.github** - GitHub-specific config files including issues templates and CODEOWNERS.
 * **dist** - Temporary directory created by `script/create-dist.py` script
   when creating a distribution.
 * **external_binaries** - Downloaded binaries of third-party frameworks which
   do not support building with `gn`.
+* **node_modules** - Third party node modules used for building.
+* **npm** - Logic for installation of Electron via npm.
+* **out** - Temporary output directory of `ninja`.
+* **script** - Scripts used for development purpose like building, packaging,
+  testing, etc.
+```diff
+script/ - The set of all scripts Electron runs for a variety of purposes.
+├── codesign/ - Fakes codesigning for Electron apps; used for testing.
+├── lib/ - Miscellaneous python utility scripts.
+└── release/ - Scripts run during Electron's release process.
+    ├── notes/ - Generates release notes for new Electron versions.
+    └── uploaders/ - Uploads various release-related files during release.
+```
+* **tools** - Helper scripts used by GN files.
+  * Scripts put here should never be invoked by users directly, unlike those in `script`.
+* **typings** - TypeScript typings for Electron's internal code.
+* **vendor** - Source code for some third party dependencies, including `boto` and `requests`.
 
 ## Keeping Git Submodules Up to Date