Skip to content

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

  1. Install dependencies once, as for building the desktop app: npm install, (cd theia-extension && npm install), (cd theia-electron-app && yarn install).
  2. Run one of the packaging commands from the repository root. Each one first runs the full npm run build:electron, then electron-builder:

    Command Output
    npm run package:electron Installers for the OS you are on
    npm run package:electron:mac macOS: .dmg and .zip
    npm run package:electron:win Windows: an NSIS installer and a portable .exe
    npm run package:electron:linux Linux: .deb and .AppImage
  3. Find the results in theia-electron-app/dist/. File names look like struktJS-<version>-arm64.dmg, struktJS Setup <version>.exe and struktJS <version>.exe. The folder also holds latest*.yml and .blockmap files, which are electron-builder byproducts; you do not need to hand them out.

  4. 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 with yarn theia download:plugins inside theia-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.