Skip to content

About

Build NW.js applications for Linux, MacOS and Windows

Topics

Resources

Code of conduct

Security policy

Stars

1.7k stars

Watchers

58 watching

Forks

Repository files navigation

nw-builder

Develop, build, package and update NW.js applications for Linux, MacOS and Windows.

Package Description
nw-builder Build NW.js desktop applications for MacOS, Windows and Linux.
@nwutils/builder Build NW.js applications for Linux, MacOS and Windows.
@nwutils/cli Command line interface for building NW.js applications.
@nwutils/doctor Configure NW.js environments for Linux, MacOS and Windows.
@nwutils/getter Get NW.js and related binaries for Linux, MacOS and Windows.
@nwutils/runner Run NW.js and related binaries for Linux, MacOS and Windows.
@nwutils/packager Package NW.js and related binaries for Linux, MacOS and Windows.
@nwutils/build-tools Compile NW.js from source with fixes for NW.js issues, and test them.
@nwutils/upstream-diff Understand how NW.js changes upstream behaviour.

Packages and options marked experimental are new and may change or be removed in a minor release: @nwutils/packager, @nwutils/doctor, @nwutils/cli, nw-builder's package mode, app.protocols and app.requestedExecutionLevel.

Roadmap

The goal is a one-command build, sign, package and publish for NW.js apps. Each package is completed first; nw-builder exposes the features once they are done. @nwutils/updater is used alongside the packager to update installed apps.

Every command targets one platform and architecture per run. Building for several targets is the caller's job: run the command once per target.

Features

Stage 1: Reliable builds

Done.

Stage 2: Trusted releases

  • updater
    • Verify the update manifest and the downloaded update before installing (the packager signs the manifest with manifestKey and the artifact with its own signature; verification is in @nwutils/updater).

Stage 3: Distribution

  • packager
    • A portable Windows executable.
    • Flatpak, Snap and Pacman packages. Pacman packaging needs an Arch Linux environment to validate (pacman, makepkg and repo-add are not in Debian/Ubuntu), so a built .pkg.tar.zst can be test-installed before release.
    • Artifact name templates.
  • updater
    • Differential (delta) updates.
    • Staged rollouts.

Stage 4: NW.js-specific features

  • getter
    • Download NW.js' Mac App Store builds.
  • builder
    • A single-file executable on Windows and Linux (package.nw appended to the binary).
    • File associations: MacOS CFBundleDocumentTypes and Linux MIME types.
  • packager
    • Mac App Store: sign with parent and child entitlements and build the .pkg (as build_mas.py does).
    • File associations in the Windows installer.
    • Content verification: sign app files into verified_contents.json for NW.js builds with your own key (build-tools).

Stage 5: nw-builder

  • Expose every feature above through one configuration and one command.
  • --publish that builds, signs, packages and uploads a release for one platform and architecture.
  • Check signing credentials, native-module toolchains and packaging tools with @nwutils/doctor.

Bugs

  • getter
    • ffmpeg: true always fails: NW.js' and the community ffmpeg checksums are both cached at cacheDir/shasum/<version>.txt, so the ffmpeg check parses NW.js' plain-text file as JSON. Its checksum URL (api.github.com/.../releases/tags/<version>/SHASUMS256.txt) also needs checking.
    • A failed or interrupted download leaves a partial file in the cache. The next run reuses it, so the checksum check fails until the cache is deleted by hand. The same happens to a partial SHASUMS256.txt.
    • An archive that fails its checksum stays in the cache instead of being downloaded again.
    • Downloads have no timeout, so a stalled connection hangs forever.
    • Ctrl+C during a download exits with code 0, and the getter takes over SIGINT for programs that use it.
  • runner
    • mode: "run" fails with default options ("Glob option is not supported"): glob defaults to true. Run mode should default it to false.
  • builder
    • Building deletes outDir without checking it, so an outDir of ., the project root, or a folder containing srcDir deletes the source code.
    • The Linux .desktop file only works on the build machine: Icon is an absolute path into the build output, and Exec is left out unless app.exec is set.
    • app.icon is resolved from the current directory on Windows, but from inside the built app on Linux.
  • nw-builder
    • The CLI's --nodeAddon option does nothing: everything else reads nativeAddon.
    • When versions.json can't be fetched and isn't cached, the real error is hidden and later steps fail on an undefined release.
    • The CLI doesn't wait for nwbuild(), so a failure is printed twice.

Development

npm install
npm run lint
npm run type
npm test

Each command fans out across every package in ./packages. To work against a single package, use npm's --workspace flag, e.g. npm test --workspace=@nwutils/getter.

npm run lint also checks that JSDoc matches the code. With Claude Code, run /sync-docs before opening a pull request to update JSDoc descriptions and READMEs for your changes (skills).

About

Build NW.js applications for Linux, MacOS and Windows

Topics

Resources

Code of conduct

Security policy

Stars

1.7k stars

Watchers

58 watching

Forks

Releases

Packages

Used by

Contributors

Languages