From a31ab6c52c2a771ff9d31b45eb2bd57e13f4a896 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 24 Dec 2025 04:44:22 -0800 Subject: [PATCH] Update electron example - Get working on Windows by moving node-pty into main proc - Fix eslint warnings Fixes #821 --- .eslintrc.js | 3 +- examples/electron/README.md | 12 +- examples/electron/index.html | 5 +- examples/electron/main.js | 113 ++-- examples/electron/package-lock.json | 826 ++++++++++++++++++++++++++++ examples/electron/package.json | 10 +- examples/electron/preload.js | 8 + examples/electron/renderer.js | 27 +- 8 files changed, 919 insertions(+), 85 deletions(-) create mode 100644 examples/electron/package-lock.json create mode 100644 examples/electron/preload.js diff --git a/.eslintrc.js b/.eslintrc.js index cc1855154..ddbd18e27 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -11,7 +11,8 @@ module.exports = { }, "ignorePatterns": [ "**/typings/*.d.ts", - "scripts/**/*" + "scripts/**/*", + "examples/**/*", ], "plugins": [ "@typescript-eslint" diff --git a/examples/electron/README.md b/examples/electron/README.md index 51299d9ef..7f05f18b9 100644 --- a/examples/electron/README.md +++ b/examples/electron/README.md @@ -1,12 +1,18 @@ -This is a minimal example of getting a terminal running in Electron using [node-pty](https://github.com/Tyriar/node-pty) and [xterm.js](https://github.com/sourcelair/xterm.js). +This is a minimal example of getting a terminal running in Electron using [node-pty](https://github.com/microsoft/node-pty) and [xterm.js](https://github.com/xtermjs/xterm.js).  +It works by using xterm.js on the renderer process and node-pty on the main process with IPC to communicate back and forth. + ## Usage ```bash -# Install npm dependencies using Electron's version of V8 -./npm_install.sh +# Install dependencies (Windows) +./npm-install.bat + +# Install dependencies (non-Windows) +./npm-install.sh + # Launch the app npm start ``` diff --git a/examples/electron/index.html b/examples/electron/index.html index 4aa1368fe..07af52a1e 100644 --- a/examples/electron/index.html +++ b/examples/electron/index.html @@ -7,8 +7,7 @@
+ + -