Node Roundup: TermKit, service.js, Writing Node Extensions

2011-05-18 00:00:00 +0100 by Alex R. Young


TermKit (License) by Steven Wittens is a "next gen" command-line interface. It currently
runs on Mac OS X, and is written using Node and Objective-C. I feel like
it's closer to something like Quicksilver
than a typical terminal client -- but it may shape up to be something
pretty compelling for general use.

When I first saw TermKit I thought Steven had used some kind of
incredible Node/Cocoa library, but it's actually a clever mix of Node
and WebKit. This seems like a good way to build native-feeling Mac apps
with Node, in a similar way to how WebKit Inspector is built.

The most interesting thing about this project is it attempts to build on
some of the conventions of terminal emulators, but explores embedding
GUI concepts into the terminal -- code is displayed with syntax
highlighting, and images are previewed automatically. Although it's
early stages for this project there are some extremely encouraging ideas
on display.


service.js by Cal Henderson builds on daemon.node (npm:
daemon) to provide an easy way of turning Node scripts into init.d daemons:


    lockFile: '/var/run/my_app.pid',
    logFile : '/var/log/my_app.log',

This preamble sets up the necessary requirements for the script to
function as an init script.

Writing Node Extensions

In How to write your own native Node.js
Olivier Lalonde explains the steps necessary to use
libnotifymm.h from Node.

Writing a native Node extension can be cumbersome and verbose at times but it is well worth the hard earned bragging rights!

It'll take a bit of C++ and waf
knowledge to really appreciate what's going on, but it does demonstrate
that writing extensions for native libraries is within the reaches of
mere mortals (rather than wizards).