DailyJS

DailyJS

The JavaScript blog.


Tagcluster
Featured

databases node modules npm cluster

Node Roundup: 0.10.19, klei-migrate, division

Posted on .

Node 0.10.19 Released

Node 0.10.19 was released yesterday. This version updates uv, npm, and also some core modules: readline, stream, and tls.

When you read uv: Upgrade to v0.10.17 in the release notes, don't you wonder what that means? If you're interested in the changes in libuv, all you need to do is checkout the relevant tag from GitHub. In this case it's libuv/tree/v0.10.17:

2013.09.25, Version 0.10.17 (Stable)  
Changes since version 0.10.16:

* build: remove GCC_WARN_ABOUT_MISSING_NEWLINE (Ben Noordhuis)
* darwin: fix 10.6 build error in fsevents.c (Ben Noordhuis)

If you switch to 0.11.13, the latest unstable release, you'll see a whole load of interesting changes -- uv_fs_stat has been rewritten, FSEventStream is now shared between multiple filesystem watchers, so it removes the limit on the maximum number of file watchers that can be created on OS X. These are just some random changes that caught my eye, there are plenty more.

These libuv changes have a direct impact on Node's filesystem and networking modules, so it's worth paying attention if you can.

klei-migrate

klei-migrate (GitHub: klei-dev / migrate, License: MIT, npm: klei-migrate) by Joakim Bengtson is a database independent migration command-line tool. It also works as a module, and has a Grunt plugin.

Migrations can be created with klei-migrate new, and then run with klei-migrate run. There are also other commands designed to help deal with switching between git branches, which can be tied into a post-checkout hook.

division

division (GitHub: codename- / division, License: MIT, npm: division) is another cluster module wrapper:

division provides an easy to use, chainable API, with some built-in extensions (like signals handlers) and is built with performance, zero-downtime restart (of workers), stability and simplicity in mind. The main advantage of division is that it does not depend of other modules - less dependencies equal less places where something could went wrong.

var division = require('division');  
var cluster = new division();

// Configuration for development environment
cluster.configure('development', function() {  
  // Put your development configuration here
  cluster.set('args', ['--some-process-args', 'send-to-workers']);
});

cluster.configure('production', function() {  
  // Put your production configuration here
  cluster.enable('silent');
});

cluster.configure(function() {  
  this.set('path', 'app.js');
});

cluster.set('size', 2);  
cluster.use('debug').use('signals');

// Start your application as a cluster!
cluster.run(function() {  
  // `this` is pointing to the Master instance
});

Featured

testing node modules data structures cluster

Node Roundup: Forky, dsjslib, Node-huxley

Posted on .

Forky

Forky (GitHub: brianc / node-forky, License: MIT, npm: forky) by Brian M. Carlson is a wrapper around the cluster module to make it easier to use and test.

The forky function loads workers based on the number of cores on your system. If any of the workers dies, Forky will spawn another one:

The best way to handle unexpected errors in node is to shut down your process and spawn a new one. Forky makes clean process shutdown and respawn easy as pie.

dsjslib

dsjslib (GitHub: monmohan / dsjslib, License: MIT, npm: dsjslib) by Monmohan Singh is a collection of common data structures and utility functions.

It includes:

  • Cache: An in-memory cache implementation, inspired by Google's Guava project
  • AVL Tree: Map-like functionality backed by a balanced tree
  • BTree
  • RWayTrie: A data structure for fast retrieval of values associated with string keys
  • TernarySearchTrie: Similar to RWayTrie, based on Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne

It includes unit tests, so you can get a feel for each API and see how the classes are meant to be used.

Node-huxley

Node-huxley (GitHub: chenglou / node-huxley, License: MIT, npm: huxley) by Cheng Lou is a port of Instagram's Huxley project. It allows sequences of events in a web application to be recorded and compared against screenshots.

Huxley was originally designed for tracking "visual regressions in web applications":

Huxley is a test-like system for catching visual regressions in Web applications. It was built by Pete Hunt with input from Maykel Loomans at Instagram.

Featured

node modules express connect grunt cluster

Node Roundup: Node 0.10.12, grunt-micro, connect-prerenderer

Posted on .

You can send in your Node projects for review through our contact form.

Node 0.10.12

Node 0.10.12 was released yesterday. This version updates v8 and npm, and has a fix for the net module.

One minor change that I liked was readline now supports CTRL-L for clearing the screen -- that means Node's command-line interface will do this as well. Before hitting CTRL-L did nothing, which wasn't very intuitive if you're used to using readline tools.

grunt-micro

If size is important to you, then you'll like grunt-micro (GitHub: markdalgleish / grunt-micro, License: MIT, npm: grunt-micro) by Mark Dalgleish. This Grunt plugin ensures a script is smaller than a given size. Mark suggests this is useful for client-side authors that have size claims in their project documentation, but it could be useful for other things, like warning about asset sizes in mobile projects.

connect-prerenderer

connect-prerenderer (GitHub: dai-shi / connect-prerenderer, License: BSD, npm: connect-prerenderer) by Daishi Kato is middleware for pre-rendering content to support systems that don't interact well with Ajax-heavy interfaces. This is ideal for improving the SEO of a site.

The author has paid special attention to AngularJS -- the documentation includes some Angular client-side code that adds support for the module.

Featured

node modules express network security connect cluster

Node Roundup: evilscan, pm2, connectr

Posted on .

You can send in your Node projects for review through our contact form.

evilscan

It's finally here, TCP port scanning in Node! evilscan (GitHub: eviltik / evilscan, License: GPLv3, npm: evilscan) by Michel Soisson is a command-line tool, and has several interesting features, like control over the amount of concurrency, geolocation information, banner grabbing, and JSON output.

The author is focusing on connect scans, but is interested in adding SYN scans and UDP support. He's looking for contributors, and the project includes tests written with Mocha and Chai, so you really have no excuse not to help out! I think it's great to see well-tested security-related modules.

pm2

pm2

pm2 (GitHub: Unitech / pm2, License: MIT, npm: pm2) by Alexandre Strzelewicz is a command-line process manager for Node. It can be used to start a program as a cluster of processes, and then monitor the cluster's health, monitor the server itself (CPU/RAM/etc.), keep processes alive, log exceptions, and throttle programs that stop too quickly.

It also has tests written with Mocha, documentation, and examples.

connectr

connectr (GitHub: olalonde / connectr, License: MIT, npm: connectr) by Olivier Lalonde is a wrapper for Connect that allows middleware to be inserted at arbitrary points in the stack. That means you can add middleware before existing middleware.

It has a simple API: the before and after methods insert new middleware relative to other middleware, and it's also possible to add middleware to the top of the stack with first, or even based on an index.