Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Node.js, Electron and node-pty #39296

Merged
merged 11 commits into from
Mar 19, 2024

Conversation

gzdunek
Copy link
Contributor

@gzdunek gzdunek commented Mar 13, 2024

This time we have a bigger update :)

  • Electron 28.2.3 -> 29.1.1. No breaking changes that would affect us https://www.electronjs.org/blog/electron-29-0.
    However, they upgraded Node.js to v20, so I did the same for us.
  • Node.js 18.19.1 -> 20.11.1. No breaking changes as well https://nodejs.org/en/blog/announcements/v20-release-announce.
    I checked if the supported systems requirements haven't changed, the only difference I see is for macOS; now 10.15 is required for x64. This aligns with Electron compatibility, starting from v28 they require v10.15 too.
  • node-pty 1.1.0-beta5 -> 1.1.0-beta12 - this one is the most interesting.
    Recently, the library has been ported to use Node-API. If I'm correct, this means that we no longer need to rebuild it manually, but instead the native code is compiled in [4/4] 🔨 Building fresh packages... phase. I verified that on macOS and Windows, the app starts without a manual deps rebuild.
    I looked at the yarn install time on CI, it doesn't seem that there is any significant difference.
    Additionally, the package no longer depends on nan (it is predecessor of NAPI), which in the past we had to update along with Electron.
    I removed all commands that we used to build deps natively and the code related to node-pty that we had in electron-builder-config.js - it seems that these files doesn't exist anyway.

Note: electron-builder stills rebuilds node-pty when packaging the app, I don't know if this is necessary now, but AFAIK we can't turn it off. I hope I'm not wrong about that Node-API stuff :) I learned more about it from here.

Tag build: 15.0.0-dev.gzdunek.12, tested on macOS, Windows, Ubuntu.

Changelog: Updated Electron to v29 in Teleport Connect

"start-electron": "electron build/app/dist/main/main.js",
"build": "electron-vite build",
"build-native-deps": "electron-builder install-app-deps",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not depending on nan and not having to rebuild binaries each time that the Electron version changes is huge.

I don't have the time to thoroughly review this today, but what I think the switch to Node-API means is that node-pty is not bound to a particular Node version but instead works with any Node that supports Node-API, see:

I suppose that's why it works without manually rebuilding the native deps.

It's fine that electron-builder rebuilds it during packaging. This way we're always sure that the node-pty version shipped with the app was built with the same Node version that's going to be used by the app.

@ravicious ravicious self-requested a review March 13, 2024 17:07
@gzdunek
Copy link
Contributor Author

gzdunek commented Mar 18, 2024

I had to bump devbox version from 0.9.0 to 0.9.1, otherwise it was failing with Error: error running script "echo" in Devbox: json: cannot unmarshal object into Go struct field ProfileListOutput.elements of type []nixprofile.ProfileListElement.

The commit 3054c8a didn't actually generate the lockfile for 0.9.0, it only switched to a newer Node.js package.

web/packages/teleterm/README.md Outdated Show resolved Hide resolved
web/packages/teleterm/package.json Outdated Show resolved Hide resolved
yarn.lock Outdated Show resolved Hide resolved
@gzdunek gzdunek force-pushed the gzdunek/update-node-electron-node-pty branch from cdf1453 to 7aa7b15 Compare March 19, 2024 09:46
Copy link
Contributor

@camscale camscale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for the workflow file (as codeowner).

@gzdunek gzdunek added this pull request to the merge queue Mar 19, 2024
Merged via the queue into master with commit 3140ad8 Mar 19, 2024
39 checks passed
@gzdunek gzdunek deleted the gzdunek/update-node-electron-node-pty branch March 19, 2024 15:23
@public-teleport-github-review-bot

@gzdunek See the table below for backport results.

Branch Result
branch/v13 Failed
branch/v14 Failed
branch/v15 Failed

gzdunek added a commit that referenced this pull request Mar 19, 2024
* Update Node.js to 20.11.1

* Update Electron to 29.1.1

* Update node-pty to 1.1.0-beta12

* Remove commands for building native deps manually

* Remove file skipping in electron-builder that seems to do nothing

* Regenerate `devbox.lock` using the same Devbox version as the CI (0.9.0)

* Update `devbox` to `0.9.1`

* Update `README.md`

* Update electron to 29.1.4

* Update devbox checksum

* Remove mention of Node.js version in teleterm/README.md

(cherry picked from commit 3140ad8)
gzdunek added a commit that referenced this pull request Mar 21, 2024
* Update Node.js to 20.11.1

* Update Electron to 29.1.1

* Update node-pty to 1.1.0-beta12

* Remove commands for building native deps manually

* Remove file skipping in electron-builder that seems to do nothing

* Regenerate `devbox.lock` using the same Devbox version as the CI (0.9.0)

* Update `devbox` to `0.9.1`

* Update `README.md`

* Update electron to 29.1.4

* Update devbox checksum

* Remove mention of Node.js version in teleterm/README.md

(cherry picked from commit 3140ad8)
gzdunek added a commit that referenced this pull request Mar 21, 2024
* Update Node.js to 20.11.1

* Update Electron to 29.1.1

* Update node-pty to 1.1.0-beta12

* Remove commands for building native deps manually

* Remove file skipping in electron-builder that seems to do nothing

* Regenerate `devbox.lock` using the same Devbox version as the CI (0.9.0)

* Update `devbox` to `0.9.1`

* Update `README.md`

* Update electron to 29.1.4

* Update devbox checksum

* Remove mention of Node.js version in teleterm/README.md

(cherry picked from commit 3140ad8)
gzdunek added a commit that referenced this pull request Mar 21, 2024
* Update Node.js to 20.11.1

* Update Electron to 29.1.1

* Update node-pty to 1.1.0-beta12

* Remove commands for building native deps manually

* Remove file skipping in electron-builder that seems to do nothing

* Regenerate `devbox.lock` using the same Devbox version as the CI (0.9.0)

* Update `devbox` to `0.9.1`

* Update `README.md`

* Update electron to 29.1.4

* Update devbox checksum

* Remove mention of Node.js version in teleterm/README.md

(cherry picked from commit 3140ad8)
github-merge-queue bot pushed a commit that referenced this pull request Mar 21, 2024
* Update Node.js to 20.11.1

* Update Electron to 29.1.1

* Update node-pty to 1.1.0-beta12

* Remove commands for building native deps manually

* Remove file skipping in electron-builder that seems to do nothing

* Regenerate `devbox.lock` using the same Devbox version as the CI (0.9.0)

* Update `devbox` to `0.9.1`

* Update `README.md`

* Update electron to 29.1.4

* Update devbox checksum

* Remove mention of Node.js version in teleterm/README.md

(cherry picked from commit 3140ad8)
github-merge-queue bot pushed a commit that referenced this pull request Mar 21, 2024
* Update Node.js to 20.11.1

* Update Electron to 29.1.1

* Update node-pty to 1.1.0-beta12

* Remove commands for building native deps manually

* Remove file skipping in electron-builder that seems to do nothing

* Regenerate `devbox.lock` using the same Devbox version as the CI (0.9.0)

* Update `devbox` to `0.9.1`

* Update `README.md`

* Update electron to 29.1.4

* Update devbox checksum

* Remove mention of Node.js version in teleterm/README.md

(cherry picked from commit 3140ad8)
github-merge-queue bot pushed a commit that referenced this pull request Mar 21, 2024
* Update Node.js to 20.11.1

* Update Electron to 29.1.1

* Update node-pty to 1.1.0-beta12

* Remove commands for building native deps manually

* Remove file skipping in electron-builder that seems to do nothing

* Regenerate `devbox.lock` using the same Devbox version as the CI (0.9.0)

* Update `devbox` to `0.9.1`

* Update `README.md`

* Update electron to 29.1.4

* Update devbox checksum

* Remove mention of Node.js version in teleterm/README.md

(cherry picked from commit 3140ad8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants