Warning: Until this application supports key based authentication please use caution when deploying to production servers using this tool.
Gispatch makes it easy to deploy Nodejs applications directly from git urls.
The only development dependency of this project is Node.js. So just make sure you have it installed.
- Clone/download this repository (e.g.
git clone https://github.com/szwacz/nw-boilerplate.git
). - Install dependencies with
npm install
(it will also download node-webkit runtime). - Run
npm start
to launch the application.
There are two package.json
files:
Placed in root directory. This file contains:
- Node modules used for development (They are not needed in real application, so why to pollute it with them?).
- Declaration for node-webkit runtime. This is the most interesting part:
"config": {
"nodeWebkit": {
"version": "0.10.5",
"downloadUrls": {
"osx": "http://dl.node-webkit.org/v{{version}}/node-webkit-v{{version}}-osx-ia32.zip",
"linux": "http://dl.node-webkit.org/v{{version}}/node-webkit-v{{version}}-linux-x64.tar.gz",
"windows": "http://dl.node-webkit.org/v{{version}}/node-webkit-v{{version}}-win-ia32.zip"
}
}
}
You declare here which version of node-webkit you want to use and the URLs from where NW binaries should be downloaded.
Placed in app directory. This is real manifest of your application, as specified by NW wiki. Declare your app dependencies there.
app
- code of application goes here.build
- in this folder lands built, runnable application.nw
- downloaded node-webkit binaries.os
- application files specific for particular operating system.releases
- ready to distribute installers will land here.tasks
- build and development environment scripts.
npm install
It will also download NW runtime, and install dependencies for package.json
inside app
folder.
npm start
How about splitting JavaScript code into modules? This project uses es6-module-transpiler for that. It translates new ES6 syntax (which is very cool) into AMD (RequireJS) modules. The main advantage of this setup is that we can use ES6/RequireJS for modules authored by us, and at the same time have normal access to node's require()
to obtain stuff from npm.
// Browser modules are required through new ES6 syntax.
// It will be translated into AMD definition.
import foo1 from './foo';
// Node.js (npm) modules are required the same way as always.
var foo2 = require('foo');
There are helper scripts in app/vendor/nwbp
folder. Those are scripts with convenient hooks wou will need anyway (like window size and position preservation). Just browse this folder to see what you get.
I hate them, If you want to create them jasmine is here.
There are various icon and bitmap files in os
directory. They are used in installers. Replace them with the same size and file type (if bmp is used, it has to be bmp format).
To make a release use command:
npm run release
It will start the packaging process for operating system you are running this command on. Ready for distribution file will be outputted to releases
directory.
You can create Windows installer only when running on Windows, the same is true for Linux and OSX. So to generate all three installers you need all three operating systems.
As installer NSIS is used. You have to install it (version 3.0), and add NSIS folder to PATH in Environment Variables (so it is reachable to scripts in this project). You know, path should look something like C:/Program Files (x86)/NSIS
.
This project requires for node.js to be reachable under node
name in command line. For example by default in Ubuntu it is nodejs
, so you should manully add alias to node
.
For now only deb packaging is supported. It should work on any Linux distribution from debian family (but was tested only on Ubuntu).
This project uses appdmg for creating pretty dmg images. While installing this library it could ask you for some additional development libraries on what you have to agree.
BTW installation of this library fails on other operating systems (Windows and Linux) when you type npm install
. No worries, it's needed only on OSX.
The MIT License (MIT)
Copyright (c) 2014 Matt Wisniewski
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Credits to szwacz nw-boilerplate for the awesome boilerplate.