Home

Awesome

ember-cli-nwjs

npm version Dependency Status Build Status

An ember-cli addon for developing Ember.js applications with NW.js (formerly node-webkit).

Wicked Good Ember 2015: Build Better Desktop Apps With Ember

Sample apps built with this addon:

Table of Contents:

Installation

From the root of your Ember CLI project:

ember install ember-cli-nwjs

This will do the following:

Build, Watch, and Run NW.js

Command

You can execute ember build --watch then start up NW.js with a single command:

ember nw

As the app gets rebuilt during development, the NW.js window will automatically reload the current page, so you can see the changes that you made without having to stop and restart the entire process.

Options

The following command line options let you specify a target environment or change the directory where the built assets are stored.

--environment (String) (Default: 'development')

--output-path (String) (Default: 'dist/')

NW.js Binary

This addon is configured to install NW.js from NPM and add it to your project as a local dependency.

To use a different NW.js:

Testing

Command

ember nw:test

Use this command to run tests in NW.js. ember nw:test will put Testem in CI mode, so the tests will execute once, then exit.

ember nw:test --server

Adding the --server flag will put Testem in Dev mode, so NW.js will stay running, and test results can be viewed both in the NW.js window and in Testem's terminal-based UI.

Options

You can pass the following command line options:

--environment (String) (Default: 'test')

--server (String) (Default: false)

--protocol (String) (Default: 'http')

--host (String) (Default: 'localhost')

--port (Number) (Default: 7357)

--module (String)

--filter (String)

Packaging

Command

ember nw:package

This command builds your Ember app, assembles all the assets necessary for NW.js, then generates the final executable using nw-builder.

Options

You can pass the following command line options:

--environment (String) (Default: 'production')

--output-path (String) (Default: 'dist/')

--config-file (String) (Default: 'config/nw-package.js')

Configuring nw-builder

nw-builder itself comes with a lot of build options. You can customize any of those settings by supplying a configuration file named config/nw-package.js in your project, or call ember nw:package with the --config-file option set to the desired file.

Configuration File

The configuration file must be a node module that exports a plain object with the names of the options you wish to override as keys:

// config/nw-package.js

module.exports = {
  appName: 'my-nw-app',
  platforms: ['osx64', 'win64'],
  buildType: function() {
    return this.appVersion;
  }
};

Default Settings

ember-cli-nwjs sets the following options by default:

Contributing

Working with master

To install the addon from master, run the following:

git clone git@github.com:brzpegasus/ember-cli-nwjs.git
cd ember-cli-nwjs
npm link

Then, in your Ember CLI project:

{
  "devDependencies": {
    "ember-cli-nwjs": "*"
  }
}
npm link ember-cli-nwjs
ember g ember-cli-nwjs

Development

To pass the addon code through the linters during development, run ember build --watch.

Running Tests

To run the addon's test suite:

cd ember-cli-nwjs
npm install
npm test

Want to Help?

This addon was created to help Ember.js developers build applications in NW.js. If you find patterns that work well for you, or would like to suggest ideas to make this addon even better, feel free to open new issues or submit pull requests. I'd love to hear your feedback!

License

Licensed under the MIT license