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-builder

v1.14.0

Published

A command line utility for building nw.js applications, compatible with `nwjs/nw-builder`, and maybe better.

Downloads

1,292

Readme

nwjs-builder Travis CI AppVeyor NPM Version NPM Downloads

A command line utility for building nw.js applications, compatible with nwjs/nw-builder, and maybe better.

Tested to work for node.js ~~0.10/0.11/4.0/~~4.1/5.0/6.0 on Windows, Linux and Mac OS X.

NPM

Features

  • Use http://nwjs.io/versions.json (powered by evshiron/nwjs-download)
  • Use ECMAScript 6
  • Support
    • All major versions (listed in versions.json)
    • All platforms (win32, linux, darwin)
    • All flavors (normal, sdk, nacl, macappstore)
  • Advanced options
    • Build with ffmpeg prebuilt
    • Build without packaging
    • Reinstall node modules for production
    • Replace icon, name, description and etc.
    • ...
  • Actively maintained

Install

$ npm install nwjs-builder -g

The npm install evshiron/nwjs-builder method is deprecated, which will no longer work because there is no prebuilt stuff in the repo, and .npmignore will simply ignore ./src/, resulting in an empty installation.

Usage

# Commands adapted from nwjs-download.

# List versions.
$ nwb list

# Show latest version.
$ nwb latest

# Show stable version.
$ nwb stable

# Show caches.
$ nwb caches

# Commands compatible with nw-builder.

$ nwb nwbuild -h

  Usage: nwbuild [options] [PATH_OR_ARGS...]

  Options:

    -h, --help                                output usage information
    -v,--version <VERSION>                    The nw.js version, eg. 0.8.4, defaults to the stable version.
    -p,--platforms <PLATFORMS>                Platforms to build, comma-sperated, eg. win32,win64,osx32,osx64,linux32,linux64, defaults to the current platform.
    -r,--run                                  Runs nw.js at PATH for the current platform.
    -o,--output-dir <DIR_OUTPUT>              The output directory, defaults to PATH's parent.
    -i,--include <DIR_SRC>:<GLOB>[:DIR_DEST]  Include extra files matching GLOB from DIR_SRC to DIR_BUILD/DIR_DEST.
    -m,--mirror <URL_MIRROR>                  Where the binaries are downloaded from, defaults to http://dl.nwjs.io.
    --output-name <NAME_OUTPUT>               Specify a template for output naming, defaults to {name}-{target}.
    --executable-name <NAME_EXECUTABLE>       Specify the name for the final executable, defaults to manifest.name.
    --output-format <DIR|ZIP>                 Specify the output format, defaults to DIR.
    --with-ffmpeg                             Fetch nwjs-ffmpeg-prebuilt to support .mp3 etc.
    --side-by-side                            Build application with side by side packaging.
    --production                              Reinstall dependencies for production purpose.
    --win-ico <WIN_ICO>                       Specify .ico for Windows build.
    --mac-icns <MAC_ICNS>                     Specify .icns for Mac OS X build.
    --detached                                For "--run", NWB exits after launching nw.js.

# Launch application.
$ nwb nwbuild -v 0.14.4-sdk -r ./build/

# Launch application with arguments.
$ nwb nwbuild -v 0.14.4-sdk -r ./build/ -a bbb

# Launch application with arguments and remote debugging enabled.
$ nwb nwbuild -v 0.14.4-sdk -r -- --remote-debugging-port=9222 ./build/ -a bbb

# Build application for win32,osx64.
$ nwb nwbuild -v 0.14.4-sdk -p win32,osx64 ./build/

# Build application for win32,osx64, with custom icons and without packaging.
$ nwb nwbuild -v 0.14.4-sdk -p win32 --win-ico app.ico --mac-icns app.icns --side-by-side ./build/

Use As Module

nwjs-builder is able to work as a node.js module as well. The solution is somewhat tricky, but it works definitely.

const NWB = require('nwjs-builder');
NWB.commands.nwbuild(path, options, callback);

The above code snippet directly calls the underneath command handler, and the options is a fake commander.js command object (as all we need are the options). A test named test-module.js is provided as a reference.

Manifest Options

The following manifest options are used to modify executable information, powered by atom/node-rcedit.

{
    // Normal package.json properties.
    "name": "nwb-test",
    "version": "0.0.1",
    "description": "nwb-test",
    // Additional options.
    "nwjsBuilder": {
        // Optionally overwrite `name`, `version` and `description`.
        "productName": "",
        "productVersion": "",
        "fileDescription": "",
        // Other options.
        // For Windows.
        "copyright": "",
        "internalName": "",
        "fileVersion": "",
        "comments": "",
        "companyName": "",
        "legalTrademarks": "",
        "originalFilename": "",
        "privateBuild": "",
        "specialBuild": "",
        // For Mac OS X.
        "bundleIdentifier": ""
    }
}

Development

I am still learning about how to form a modern node.js module well. As a result, the project structure might change from time to time.

While new features are added, some existing features might break too.

If anything doesn't work properly, feel free to open issues and provide enough information so that things can be quickly fixed.

PRs and issues are always appreciated.

For feature requests:

nwjs-builder is aimed at running/packaging nw.js applications, and is designed to work with a directory that is well-prepared to be packaged.

I will usually refuse requests for a feature which is achievable by other popular node.js modules, and you can use build.sh, Makefile, gulp or grunt to organize your building pipeline. I don't want to add an option just to proxy it to another module.

Platform-specified and configuration-rich features like making .dmg (Mac OS X only), .exe or .deb will usually be refused too. I don't want to learn how to integrate something I will rarely use and decide to leave it to you :)

See also:

Mirrors

There are some mirrors available on the Internet, which are supported with --mirror option:

  • https://npm.taobao.org/mirrors/nwjs/

License

MIT.