Electron Documentation1.7.9

Electron 1.7.9 / Docs / Development / Upgrading Node

Upgrading Node

Discussion

One upgrade issue is building all of Electron with a single copy of V8 to ensure compatability. This is important because upstream Node and libchromiumcontent both use their own versions of V8.

Upgrading Node is much easier than upgrading libchromiumcontent, so fewer conflicts arise if one upgrades libchromiumcontent first, then chooses the upstream Node release whose V8 is closest to it.

Electron has its own Node fork with modifications for the V8 build details mentioned above and for exposing API needed by Electron. Once an upstream Node release is chosen, it's placed in a branch in Electron's Node fork and any Electron Node patches are applied there.

Another factor is that the Node project patches its version of V8. As mentioned above, Electron builds everything with a single copy of V8, so Node's V8 patches must be ported to that copy.

Once all of Electron's dependencies are building and using the same copy of V8, the next step is to fix any Electron code issues caused by the Node upgrade.

[FIXME] something about a Node debugger in Atom that we (e.g. deepak) use and need to confirm doesn't break with the Node upgrade?

So in short, the primary steps are:

  1. Update Electron's Node fork to the desired version
  2. Backport Node's V8 patches to our copy of V8
  3. Update Electron to use new version of Node

Updating Electron's Node fork

  1. Create a branch in https://github.com/electron/node: electron-node-vX.X.X
  1. Re-apply our commits from the previous version of node we were using (vY.Y.Y) to v.X.X.X

Updating V8 Patches

We need to generate a patch file from each patch applied to V8.

  1. Get a copy of Electron's libcc fork
  1. Run script/update to get the latest libcc
  1. Remove our copies of the old Node v8 patches
  1. Inspect Node repo to see what patches upstream Node used with their v8 after bumping its version
  1. Create a checklist of the patches. This is useful for tracking your work and for having a quick reference of commit hashes to use in the git diff-tree step below.
  2. Read patches/v8/README.md to see which patchfiles came from the previous version of V8 and therefore need to be removed.
  1. For each patch, do:
  1. Update patches/v8/README.md with references to all new patches that have been added so that the next person will know which need to be removed.
  2. Update Electron's submodule references:

    • cd electron/vendor/node
      electron/vendor/node$ git fetch
      electron/vendor/node$ git checkout electron-node-vA.B.C
      electron/vendor/node$ cd ../libchromiumcontent
      electron/vendor/libchromiumcontent$ git fetch
      electron/vendor/libchromiumcontent$ git checkout upgrade-to-chromium-X
      electron/vendor/libchromiumcontent$ cd ../..
      electron$ git add vendor
      electron$ git commit -m "update submodule referefences for node and libc"
      electron$ git pso upgrade-to-chromium-62
      electron$ script/bootstrap.py -d
      electron$ script/build.py -c -D

Notes


See something that needs fixing? Propose a change to the source file.
Need a different version of the docs? See available versions.
Want something searchable? View all docs on one page