Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

nwjs-builder-phoenix

evshiron738MIT1.15.0TypeScript support: included

A possible solution to build and package a ready for distribution NW.js app for Windows, macOS and Linux.

readme

nwjs-builder-phoenix npm version Standard Version

A possible solution to build and package a ready for distribution NW.js app for Windows, macOS and Linux.

Why Bother?

We already had nw-builder, but it has made little progress on the way, and nwjs-builder has been hard to continue due to personal and historic reasons.

electron-builder inspired me when I became an Electron user later, loose files excluding, various target formats, auto updater, artifacts publishing and code signing, amazing!

Although NW.js has much lesser popularity than Electron, and is really troubled by historic headaches, let's have something modern.

Features

  • Building for Windows, macOS and Linux
    • Common: zip, 7z
    • Windows: nsis, nsis7z
    • macOS: TODO
    • Linux: TODO
  • Building for different platforms concurrently
  • Configurable executable fields and icons for Windows and macOS
  • Exclusion of loose files from node_modules
  • Chrome App support
  • nwjs-ffmpeg-prebuilt integration
  • Auto Updater
  • TODO Rebuilding native modules
  • TODO Code signing
  • Ideas appreciated :)

Getting Started

  • Make sure your NW.js project has a valid package.json (e.g. generated by npm init), and have basic fields like name, description and version filled.

  • For apps destined for Mac, providing a product_string in the package.json will allow the Helper app to be renamed for you.

  • Install nwjs-builder-phoenix as a devDependencies of your NW.js project as follows:

# Optional wine for building for Windows on other platforms.
# The command may differ in different Linux distributions.
#sudo apt-get install wine
npm install nwjs-builder-phoenix --save-dev

By installing it locally, build and run commands will be available in npm scripts. You can access option lists via ./node_modules/.bin/{ build, run } --help.

DO NOT install it globally, as the command names are just too common.

  • Add build properties at the root of the package.json, for example:
// package.json
{
    "build": {
        "nwVersion": "0.14.7"
    }
}

This will specify the NW.js version we are using. See more in the following Options section.

  • Add some helper npm scripts, for example:
// package.json
{
    "scripts": {
        // Deprecated. "dist": "build --win --mac --linux --x86 --x64 --mirror https://dl.nwjs.io/ .",
        "dist": "build --tasks win-x86,win-x64,linux-x86,linux-x64,mac-x64 --mirror https://dl.nwjs.io/ .",
        "start": "run --x86 --mirror https://dl.nwjs.io/ ."
    }
}

The above code snippet enables npm run dist and npm run start/npm start. The former builds for all major platforms and both x86 and x64 arch, and the latter runs the project with x86 binaries, both with the specified version of NW.js and use specified mirror to accelerate the download.

  • Well done.

This should be the common use case, read the following Options section and FAQs if something is missing.

See also sample project and test cases for reference.

Options

Passing and managing commandline arguments can be painful. In nwjs-builder-phoenix, we configure via the build property of the package.json of your NW.js project.

Also see all available options here.

Differences to nwjs-builder

  • nwjs-builder-phoenix queries versions.json only when a symbol like lts, stable or latest is used to specify a version.
  • nwjs-builder-phoenix uses rcedit instead of node-resourcehacker, thus it's up to you to create proper .ico files with different sizes.
  • nwjs-builder-phoenix supports node.js 4.x and later versions only.
  • nwjs-builder-phoenix writes with TypeScript and benefits from strong typing and async/await functions.

Development

git clone https://github.com/evshiron/nwjs-builder-phoenix
cd nwjs-builder-phoenix
npm install

npm test

By the way, I use some custom strings in NSIS scripts which might not be fully translated, if anyone is interested in translating them into languages that aren't available, feel free to fork and send PRs.

Available Mirrors

If you have difficulties connecting to the official download source, you can specify a mirror via --mirror argument of both build and run, or by setting NWJS_MIRROR environment variable. Environment variables like HTTP_PROXY, HTTPS_PROXY and ALL_PROXY should be useful too.

License

MIT.

changelog

Change Log

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

1.15.0 (2018-12-19)

Bug Fixes

  • DownloaderBase: head request follows redirects (7f9dcfd)

Features

  • destination: add a destination option to configure cache directory (#112) (87bc791)

1.14.8 (2018-07-23)

Bug Fixes

  • DownloaderBase: head request follows redirects (7f9dcfd)

1.14.7 (2018-02-04)

Bug Fixes

  • nsis-compat-tester: fix progress (9e09d85)
  • nsis-compat-updater: fix misuse of dirname path (0719638)

1.14.6 (2017-09-19)

Bug Fixes

  • assets: improve Belarusian translation (c23be97), closes #84

1.14.5 (2017-09-06)

1.14.4 (2017-08-21)

Bug Fixes

  • Downloaders: tolerate DNS lookup timeout and use caches (434aea4)

1.14.3 (2017-06-16)

Bug Fixes

  • nsis-gen: fix language strings (9d55b86)

1.14.2 (2017-06-13)

Bug Fixes

  • DownloaderBase: fix header types for upstream changes (e67353a)

1.14.1 (2017-05-19)

Bug Fixes

  • util: fix symlink support in copyFileAsync (508c304)

1.14.0 (2017-05-10)

Features

  • Builder: add tasks option and deprecate flag options (974d9e0)

1.13.1 (2017-05-10)

Bug Fixes

  • Builder: fix exclusion of packed app building (dba6440)

1.13.0 (2017-05-10)

Bug Fixes

  • Builder: fix executing permission for Linux (1841dba)
  • Downloaders: fix useCaches option (f831d93)
  • util: fix extracting for Linux when interrupted before (98cb1e4)

Features

  • Builder: allow changing output naming pattern (905a448)

1.12.1 (2017-05-09)

Bug Fixes

  • Builder: fix missing package.json for packed mac app (a76e6e2)
  • Builder: skip mac x86 builds for modern NW.js versions (058e4c9)
  • util: fix wrong error hints in extracting (80e7e3b)

1.12.0 (2017-05-06)

Bug Fixes

  • Builder: fix stripping for packed apps (bc5f68e)

Features

  • Builder: allow custom plist strings (66f1464)

1.11.1 (2017-05-05)

Bug Fixes

  • Builder: fix packed app building (c8fc86f)

1.11.0 (2017-04-29)

Features

  • nsis-gen: custom default installation directory (5fa8042)
  • nsis-gen: i18n support for custom strings (c70d6e3)

1.10.3 (2017-04-28)

Bug Fixes

  • BuildConfig: fix overwritten appId (cac669e)
  • nsis-compat-tester: fix progress (8104a95)

1.10.2 (2017-04-25)

Bug Fixes

  • Builder: keep symlinks for latest NW.js versions (7f3a01b)

1.10.1 (2017-04-21)

Bug Fixes

  • Builder: fix fixMacMeta for later NW.js versions (a4d0563)
  • nsis-compat-tester: beautify using vue and element-ui (c193e94)
  • nsis-compat-updater: reduce retries for quicker responding (395a8c1)

Features

  • nsis-compat-updater: employ webpack to reduce file sizes (c3945bb)
  • nsis-compat-updater: expose download progress event (db359ab)

1.10.0 (2017-04-19)

Bug Fixes

  • Builder: fix crashes on symlinks (f615850)

Features

  • nsis-compat-updater: initialize (8451f55)

1.9.4 (2017-04-19)

Bug Fixes

  • Builder: fix crashes on symlinks (144901a)
  • nsis-gen: fix warnings for solid compression when using nsis7z target (5d1a3b0)

1.9.3 (2017-04-19)

Bug Fixes

  • Builder: replace join with resolve (4ec3028)

1.9.2 (2017-04-17)

Bug Fixes

  • nsis-gen: fix missing option to create desktop shortcut (82c6a86)

1.9.1 (2017-04-14)

Bug Fixes

  • nsis-gen: fix Unicode scripts reading (e9e4083)

1.9.0 (2017-04-14)

Features

  • nsis-gen: custom icons for installer and uninstaller (958e88d)

1.8.0 (2017-04-12)

Features

  • Builder: strip some properties from package.json (c666496)

1.7.1 (2017-04-12)

Bug Fixes

  • assets: add missing nsis assets (e2f572b)

1.7.0 (2017-04-12)

Features

  • nsis-gen: support nsis7z compression (13b0529)

1.6.0 (2017-04-05)

Features

  • project: support building and running from chrome apps (a62bc5b)

1.5.0 (2017-04-05)

Features

  • Builder: support concurrent building (4553108)

1.4.3 (2017-04-04)

Bug Fixes

  • Builder: convert semver to windows version when needed (bd99c60)
  • nsis-gen: remove modern option and always create modern installers (aea9140)

1.4.2 (2017-04-04)

1.4.1 (2017-04-04)

Bug Fixes

  • BuildConfig: fix nsis config initialization (4268957)

1.4.0 (2017-04-04)

Bug Fixes

  • nsis-gen: use paths relative to cwd to specify files in nsis scripts (15afb8f)

Features

  • nsis-gen: integrate nsis contribs and make default nsis builds modern (34c93e6)

1.3.4 (2017-04-02)

Bug Fixes

  • nsis-gen: compare contents instead of dates and sizes (fb52f61)

1.3.3 (2017-04-02)

Bug Fixes

  • nsis-gen: fix missing distinct files in diff updaters (c4c7f9d)

1.3.2 (2017-04-02)

Bug Fixes

1.3.1 (2017-04-02)

Bug Fixes

  • nsis-gen: set warning values instead of throwing exceptions (f79ed55)

1.3.0 (2017-04-01)

Features

  • Builder: support nsis diff updater building (#12) (8f2f914)

1.2.1 (2017-03-30)

Bug Fixes

  • options: remove external config support (248615c)

1.2.0 (2017-03-30)

Features

  • Builder: integrate nsis target building (#11) (28a247d)

1.1.1 (2017-03-24)

Bug Fixes

  • archive: extract without overwriting existing files (34579b7)

1.1.0 (2017-03-20)

Bug Fixes

  • archive: fix compress failure on Windows (5ef54b1)

Features

  • Downloaders: download when local and remote file sizes mismatch (e43a57d)

1.0.0 (2017-03-20)