Why fork Node.js?
Here we get a hint at why the community felt compelled to fork nodejs at this point:
Some problems require broader ownership and contributorship than have traditionally been applied, while others are so dispersed between tiny projects that they require new collaborative space to grow. Node Forward is a place where the collaboration necessary to solve these issues can take place.
Ultimately, the work of the community could not be released under the trademark restrictions of Node, so a fork was made and io.js was born.
Isaac Schlueter a core contributor, provides a lot of the backstory behind the decision to fork on his personal blog. One key takeaway, it is the intention of io.js that the two projects will hopefully merge together sometime in the future.
What’s new in io.js?
First, io.js introduces proper semantic versioning (semver) by tagging the release 1.0.0 because it’s such a divergence from Node.js. jQuery blogged about the importance of using semver in a recent blog post:
One of those best practices is semantic versioning, or semver for short. In a practical sense, semver gives developers (and build tools) an idea of the risk involved in moving to a new version of software. Version numbers are in the form of MAJOR.MINOR.PATCH with each of the three components being an integer. In semver, if the MAJOR number changes it indicates there are breaking changes in the API and thus developers need to beware.
Latest V8 engine
--harmony flag to enable them.
Available ES6 features
The features listed below are available with io.js without specifying any flag:
- Block scoping (
- Collections (
- Binary and Octal literals
- New String methods
- Template strings
io.js comes with new experimental core modules:
- v8: exposes events and interfaces specific to the version of V8 build with node
You can review the full list of changes in the io.js changelog.
$ node app.js
$ iojs app.js
Node version manager
Node version manager (nvm), which is a bash script that allows you to manage multiple versions of Node.js and now supports installing various versions of io.js. If you have nvm installed you can run the following command in your terminal to list the versions of io.js available:
$ nvm ls-remote v1
Then in your project folder you can install io.js by specifying the latest version listed.
$ nvm install iojs-v1.0.3
Note: At the time of this writing, I’d recommend only installing io.js via nvm. Many early adopters who’ve installed io.js through the installer on io.js homepage are saying that io.js inserts itself over node by replacing a symlink that links to node to now link to io.js. nvm allows you set a specific version for specific project folders.
Trying it out
Want to test io.js out in an Atlassian Connect add-on? You can quickly get a HipChat add-on to run on io.js and utilize an ES6 feature like Generators by following these simple steps:
- Go to the HipChat Add-ons Quick Start guide and follow the instructions to get a add-on up and running with the atlassianlabs/ac-koa-hipchat framework
vagrant sshinto the vagrant server you set up in step 1. At the command prompt you’ll need to install nvm by running this command:
curl https://raw.githubusercontent.com/creationix/nvm/v0.23.0/install.sh | bash
This will install nvm and update your shell. You’ll next need to type
exit at the command prompt to close your ssh session and restart the shell.
package.jsonand edit the web script line so it uses io.js instead of Node.js:
"web": "iojs web.js",
"web-dev": "nodemon --harmony -e js,json,css,hbs web.js"
- Again run
vagrant sshto restart the servers shell and run the following command to start the application:
$ cd project && npm start web
This will start the Koa HipChat add-on server and you can register your add-on with a HipChat room using the following URL:
where `xxxxxxxx.ngrok.com` is the url specified in the shell after the server starts up.
If you are able to type
/hello in the chat field and have the HipChat add-on reply back with “Hi” then congratulations! You are now running an io.js application that utilizes ES6 features such as Generators.
Should you use io.js?