Packaging your own build¶
Audience: people building the desktop app from source · ~6 min read · Prerequisites: Install and first launch, Node.js and Yarn
What it is¶
Packaging turns the desktop app into an installer you can give to someone else. It uses electron-builder and
produces files for the operating system you run it on. The results are unsigned and not notarized, and
there is no auto-update.
When you'd use it¶
When there is no prebuilt installer for your platform (for example an Intel Mac), when you want to test a change as a real installed app, or when you distribute struktJS inside your organization.
Steps¶
- Install dependencies once, as for building the desktop app:
npm install,(cd theia-extension && npm install),(cd theia-electron-app && yarn install). -
Run one of the packaging commands from the repository root. Each one first runs the full
npm run build:electron, thenelectron-builder:Command Output npm run package:electronInstallers for the OS you are on npm run package:electron:macmacOS: .dmgand.zipnpm run package:electron:winWindows: an NSIS installer and a portable .exenpm run package:electron:linuxLinux: .deband.AppImage -
Find the results in
theia-electron-app/dist/. File names look likestruktJS-<version>-arm64.dmg,struktJS Setup <version>.exeandstruktJS <version>.exe. The folder also holdslatest*.ymland.blockmapfiles, which are electron-builder byproducts; you do not need to hand them out. - Install the result as described in Install and first launch, including the unsigned-build warnings.
Packaging for a different OS than the one you are on generally has to run on that OS (or a matching CI
runner); producing all three installers from one machine is not guaranteed to work. Windows and Linux installers
were not run from the dev machine used for this page; macOS output was seen in dist/.
Details worth knowing¶
- The build runs
theia rebuild:electron, which recompiles native modules (terminal, file watching) for Electron. A build that skipped it starts but crashes in the terminal. - The Windows installer is not one-click: it lets you choose the install folder and installs per user.
- The app version comes from
theia-electron-app/package.json; installer names use it. - The bundled VS Code plugins (
theia-electron-app/vscode-plugins) are copied into the app. They must be downloaded first withyarn theia download:pluginsinsidetheia-electron-app(the release workflow does this). - The released builds come from the project's release workflow on version tags: macOS Apple Silicon (
arm64), Windows and Linux, attached to a draft GitHub Release. It does not sign anything.
Do not run the Electron tests for this
npm run test:electron launches the real app and is only for people changing the Electron setup itself.
Every control¶
| # | Button/Option | What it does | Shortcut | Gotcha |
|---|---|---|---|---|
| 1 | npm run build:electron |
Builds the webview, the extension and the Electron bundle. | none | Run implicitly by every package:electron* command. |
| 2 | npm run start:electron |
Starts the unpackaged desktop app. | none | For a quick check before packaging. |
| 3 | npm run package:electron |
Packages for the current OS. | none | Slow; includes a full build. |
| 4 | npm run package:electron:mac |
.dmg + .zip. |
none | Build on a Mac. |
| 5 | npm run package:electron:win |
NSIS installer + portable .exe. |
none | Build on Windows. |
| 6 | npm run package:electron:linux |
.deb + .AppImage. |
none | Build on Linux; needs X11 and libsecret headers if native modules compile from source. |
Related¶
- Install and first launch, Updating and uninstalling
- White-labeled customer builds for a branded build
- Developer detail: Electron desktop-app tests