npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nwjs-packager

v1.5.1

Published

Module to build, add packages and release to GitHub NW.js apps

Downloads

29

Readme

nwjs-packager

Build your NW.js app and generate archives, packages, setup files and more! nwjs-packager focuses on making building NW.js "just work".

Key Features

  • Moves your app's files to a temporary directory and runs npm install --production
  • Option to quickly run your app without building for testing
  • Downloads NW.js binaries and combines them with your app's files
  • Generates zip or tar.gz archives and Windows installer executable files

macOS Features

  • Customises app icons
  • Properly customises Info.plist / InfoPlist.strings with your app's name
  • Adds correct product_string to package.json to allow binaries to be renamed

Windows Features

  • Customises executable icons and file properties
  • Generates an installer (using Inno Setup)

Linux Features

  • Generates a .desktop file for your app

Installation

npm install nwjs-packager --save-dev

Usage

Add an nwjs-packager block to your app's package.json file.

Example package.json extract

  ...
  "nwjs-packager": {
    "nwVersion": "0.45.4",
    "appFriendlyName": "Demo App",
    "appMacIcon": "bin/icon.icns",
    "appWinIcon": "bin/icon.ico",
    "files": ["bin/**"],
    "builds": {
      "linux": {"tar.gz": true},
      "osx": {"zip": true},
      "win": {"zip": true}
    }
  }
  ...

Build mode

To build your app for the current platform and architecture simply run from a terminal window:

nwp

Run mode

To quickly run your app in NW.js without building it (ie during development) run:

nwp -r

Options

All options should added in your app's package.json file. Possible options with their default values are:

  ...
  "nwjs-packager": {
    // An array of files to include in the output packages. Globs are accepted.
    "files": [],
    // Location to store downloaded NW.js binaries
    "cacheDir": "(os.homedir)/.nwjs-packager/cache",
    // Location to store app files ready for packaging
    "tempDir": "(os.homedir)/.nwjs-packager/temp",
    // Location to output packages to
    "outputDir": "(your app's directory)/build",

    // The version of NW.js to use (note versions should be in format without the letter "v", eg: "0.44.5")
    // The strings "stable", "latest" or "lts" are also permitted
    "nwVersion": "stable",
    // The "flavor" of NW.js to use (possible values "normal" or "sdk")
    "nwFlavor": "normal",

    // Whether to run `npm install production` after copying app files
    "runNpmInstallProduction": true,

    // The nerd name for the app to use in file names (ie there should be no spaces)
    "appPackageName": "(the 'name' value in your package.json)",
    // The version of the app
    "appVersion": "(the 'version' value in your package.json)",
    // The file name format of output packages. Can use the special symbols %a%, %v% %p%
    // which are replaced with the appPackageName appName, appVersion and NW.js platform (eg osx-x64) respectively
    "appOutputName": "%a%-%v%-%p%",
    // The nice name of the app to display to the user (ie there can be spaces)
    "appFriendlyName": "(the 'name' value in your package.json, made titlecase and with '_' and '-' characters replaced with spaces)",
    // A path to a .icns file to use for generating the macOS icon
    "appMacIcon": null,
    // Unique, case sensitive bundle identifier in reverse-DNS format. Should be changed to prevent ID collisions
    "appMacBundleIdentifier": "io.nwjs.nwjs",
    // A path to an .ico file to use for generating the Windows icon
    "appWinIcon": null,
    // A short description of the app. Used in the macOS Info.plist and Windows fileVersion.
    "appDescription": "(the 'description' value in your package.json)",
    // The copyright detail of the app. Used in the macOS Info.plist and Windows fileVersion.
    "appCopyright": "(a string in the format '© {current_year} {package json 'author' value}')",

    // The platforms and outputs to build for
    // Possibles values are "deb", "rpm", "tar.gz", "zip", "pkg", "innoSetup" depending on the platform
    "builds": {
      "linux": {
        "tar.gz": true,
        "rpm": true, // TODO coming soon!
        "deb": true // TODO coming soon!
      },
      "osx": {
        "zip": true,
        "pkg": true // TODO coming soon!
      },
      "win": {
        "zip": true,
        "innoSetup": false // A path to a .iss file should be specified here
      },
    },

    // macOS InfoPlist.strings files can be specified to use for different languages here
    // Object keys should be in format "locale_id": "/path/to/InfoPlist.strings/file"
    // Possible locale ids are listed here: https://gist.github.com/jacobbubu/1836273
    "infoPlistStrings": {
      // If locale file isn't specified, the strings in the file for the object key "default" will be used
      // If a "default" file isn't specified, then nwjs-packager will automatically generate one
      "default": null
    }
  }
  ...

Limitations

  • Installable packages have not been implemented for macOS or Linux yet
  • Currently you can only package a build for your current OS and architecture. (See #8)
  • Auto generation of Inno Setup .iss files has not been implemented yet
  • DO NOT add a product_string key to your package.json file. This will break nwjs-packager's "run mode" on macOS. nwjs-packager handles adding the a product_string during "build mode" only.

Example usage

nwjs-packager-demo - a demo NW.js application used for testing.

License

MIT License. © 2020 Charlie Lee.