nwjs-packager
Module to build, add packages and release to GitHub NW.js apps
Last updated 2 months ago by charlielee .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install nwjs-packager 
SYNC missed versions from official npm registry.

nwjs-packager

Build your NW.js app and generate archives, packages, setup files and more! Apps are built using nw-builder before generating the packages of your choice. The app can be used programmatically or via CLI.

Pre-packaging features

  • Auto generate .desktop files for Linux
  • TODO: Auto generate .iss file for Inno Setup
  • TODO: Copy source files and run npm install --production

Available outputs

  • All platforms: .zip or .tar.gz
  • TODO: Linux: .deb or .rpm
  • TODO: macOS: .pkg
  • Windows: .exe (using Inno Setup)

Installation

npm install nwjs-packager --save-dev

CLI usage

This is identical to that of nw-builder, except nwp should be used instead of nwbuild.

Module usage

const NwPackager = require("nwjs-packager");

let nwp = new NwPackager(buildOptions, packageOptions);

nwp.build().then(() => {
  return nwp.package();
}).catch((error) => {
  console.error(error);
});

buildOptions

This object takes all of the options accepted by nw-builder with a few differences:

  • buildType - the value of this is ignored and always set to "default"
  • platforms - this must use "os-architecture" values rather than their shorthands (ie use win32 instead of just win)

All default values are also the same except for:

  • platforms - this is set to the current OS's x32 and x64 variants (eg on Windows this would be ["win32", "win64"])
const buildOptions = {
  "files": "path/to/nwfiles/**/**",
  "platforms": ["osx64", "win32", "win64"],
  "version": "0.14.6",
  ...
}

packageOptions

This object contains nwjs-packager specific settings. Outputs can be specified for an OS (eg win) which will affect both the x32 and x64 outputs, or for a specific platform (eg win64).

The possible values with their default values are listed:

const packageOptions = {
  // The file name format of output packages. Can use the special symbols %a%, %v% %p%
  // which are replaced with the nw-builder appName, appVersion and platform (eg osx64) respectively
  "package_name": "%a%-%v%-%p%",
  // Only build for the current OS (regardless of the value of buildOptions.platforms)
  // Reccommended for best results
  "build_current_os_only": false,
  "linux": {
    "pre": {
      "desktop_file": true, // Toggles generating a Linux .desktop file
    },
    "packages": {
      "deb": true, // Toggles generating a .deb package
      "rpm": false, // Toggles generating an .rpm package
      "tar": false, // Toggles generating a .tar archive
      "tar.gz": true, // Toggles generating a .tar.gz archive
      "zip": false, // Toggles generating a .zip archive
    },
  },
  "osx": {
    "packages": {
      "pkg": true, // Toggles generating a .pkg package
      "tar": false,
      "tar.gz": false,
      "zip": true,
    },
  },
  "win": {
    "packages": {
      "inno_setup": false, // Set to the location of a .iss file to use with Inno Setup 5
      "tar": false,
      "tar.gz": false,
      "zip": true,
    },
  },
};

License

MIT License

Current Tags

  • 0.2.2                                ...           latest (2 months ago)

5 Versions

  • 0.2.2                                ...           2 months ago
  • 0.2.1                                ...           2 months ago
  • 0.2.0                                ...           2 months ago
  • 0.1.1                                ...           2 months ago
  • 0.1.0                                ...           2 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 67
Dependencies (3)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |