News from the world of Node: npm 2.0, nvm for Windows, xtpl

Original author: Alex Young
  • Transfer

npm 2.0

npm 2.0 saw the light, and the announcement of its release contains many details about the fixes and the development of the project release process. One of the main changes concerns run-script, this command is now able to accept arguments:

B npm@2.0.0, Ben has changed npm run-scriptin such a way as to give you the ability to pass arguments to a script. This is a critical change. It is so simple. Think of npm 2 as a step forward directly to npm with semver. (Further more. Npm 3 will be released before the end of the year.)

The npm blog also has an essay on multi-stage installations :
Multi-stage installations will affect and improve all the actions that npm takes in connection with dependencies and changing your node_modulesfolder. It touches install, uninstall, dedupe, shrinkwrap and of course the dependencies (including optionalDependencies, peerDependencies, bundledDependencies , and devDependencies).

This essay mentions that npm should soon have an indicator of progress and changes that will bring it closer to supporting transactional settings.

nvm for windows

Apparently, many Node version managers on Windows tend to use batch files, so Corey Butler decided to try a different approach:
The current version of nvm has no dependencies on node. This product is made on Go, this approach is much more structured than dancing with a tambourine around bat-files. Nvm does not rely on an existing node installation. If necessary, Go has all the potential to create cross-platform solutions for Mac / Linux using the same code base, with a much easier way to convert a bunch of batch scripts to a logical shell.

You can get the source code on GitHub at the link coreybutler / nvm , and there are also binary releases there .

Corey also wrote something called Fenix ​​Web Server (GitHub: coreybutler / fenix , License: GPL ), this product is a static desktop web server on node-webkit:
You can quickly hack / hack the web server through the graphical interface or command line. This product allows you to distribute web services ( localtunnel ) through a simple switch. Also discussed solution has a visual mechanism for displaying incoming requests which also affects localtunnel.


Yiming He wrote xtpl (GitHub: kissyteam / xtpl , License: MIT , npm: xtpl ), Express / Koa wrapper for eXtensible Template Engine . This template language is similar to others like ejs, but to everything else, it allows you to add your own synchronous / asynchronous commands.

You can also add commands to the template language, which can be inline, block, or asynchronous. Here is an example:

XTemplate.addCommand('xInline', function(scope, option, buffer) {
  buffer = buffer.async(function(newBuffer) {
    setTimeout(function() {
      newBuffer.write(option.params[0] + 1).end();
  return buffer;

The API documentation includes more examples, and the xtpl readme file also contains several examples with Koa.

Also popular now: