📜 ⬆️ ⬇️

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

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 the run-script , this command is now capable of taking arguments:

At npm@2.0.0 , Ben changed the npm run-script so that you could pass arguments to the script. This is a critical change. It is so simple. Think of npm 2 as a step on the way straight to npm with semver. (Further more. Npm 3 will be released before the end of the year.)


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

This essay mentions that npm should soon acquire an indicator of progress and changes that will bring it closer to support for transactional installations.
')

nvm for windows


Apparently, many Node version managers for 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 the full potential for creating cross-platform Mac / Linux solutions using the same code base, with a much easier way of converting heaps of batch scripts to a logical shell.

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

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

xtpl


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 in addition 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(); },10); }); return buffer; }); 

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

Source: https://habr.com/ru/post/238689/


All Articles