The JavaScript blog.


libraries node modules markdown epub npm cms

Node Roundup: npm Scopes, AkashaEPUB, mdjson

Posted on .

npm Scopes

Since npm got private modules, it has supported scopes, because private modules are resolved based on your username. However, one thing that I didn't realise was scopes are available to everyone -- you don't have to use them for private modules. That means you can reuse an existing package name, which makes sense if the package name is generic enough.

This was mentioned in this week's npm weekly post, under "solving npm’s hard problem: naming packages":

As part of the private modules rollout last week, we introduced a new free feature: scopes for packages. If you’re a registered npm user then you already have a scope, so check out the post if you want to learn how to use it.

This will be handy if you want to distribute your own fork for existing modules through npm.


David Herron sent in AkashaEPUB (GitHub: akashacms/akashacms-epub, License: Apache 2.0, npm: akashacms-epub), a toolchain for constructing EPUB version 3 books. It allows you to write books using Markdown, and helps manage the asset files (CSS, images, fonts), and builds a correct EPUB3 file.

AkashaEPUB is built using AkashaCMS, which is a static site generator:

The goal for AkashaCMS is to provide most of the flexibility of a full scale CMS, incorporate modern JavaScript/CSS UI frameworks, while producing static HTML files, and skipping the administrative overhead of running a full CMS.

To use AkashaEPUB, you'll need Grunt and an EPUB to generate. There's a sample project and a skeleton. The following example will build the EPUB Guidebook that David Herron created:

npm install -g akashacms  
npm install -g grunt-cli  
git clone https://github.com/akashacms/epub-guide.git  
cd epub-guide  
npm install  
grunt doepub  


mdjson (GitHub: yoshuawuyts/mdjson, License: MIT, npm: mdjson) by Yoshua Wuyts is a module for generating JSON from Markdown. The properties in the JSON are based on the headings, which means you can use it to write JavaScript objects in a more friendly manner. This works particularly well with template strings:

  This part (before any headers) is ignored. Feel free
  to use this section for commentary on the file's purpose,
  if you wish.

  ## my heading
  oh wow, amazing

  ## another heading
  gorgeous copy, stunning

The output contains the original input and HTML:

  'my heading': {
    raw: 'oh wow, amazing',
    html: '<p>oh wow, amazing</p>'

  'another heading': {
    raw: 'gorgeous copy, stunning',
    html: '<p>gorgeous copy, stunning</p>'

I think this might be a cool way of converting Markdown to something more structured to store in a database for a CMS or static site generator.


events node modules cms

Node Roundup: 0.5.10 and 0.6, MCMS, EventStream, RSS Tutorial

Posted on .

You can send your node modules and articles in for review through our [contact form](/contact.html) or [@dailyjs](http://twitter.com/dailyjs).

0.5.10 and 0.6

Node 0.5.10 has been released. This version changes the build system, adds performance
improvements, and it looks like there's been a lot of documentation

Node 0.6 was also formally announced on the official Node blog:

The API changes between v0.4.12 and v0.5.10 are 99% cosmetic, minor, and easy to fix. Most people are able to migrate their code in 10 minutes. Don't fear.

Sounds good to me!


MCMS (npm: mcms, License: MIT) by Oleg Podsechin is a content management system built with Common
. Actually, Common Node is
just part of the story:

By being built on top of the CommonJS Filesystem/A and JSGI 0.3 specs, it runs on multiple server side JavaScript platforms, such as Node.js (via Common Node) and RingoJS.

Oleg has provided installation instructions for both Node and RingoJS.

MCMS is more like a static site generator than a traditional CMS, and
serves as an interesting example of how to build something using Common
Node while still being able to deploy to other CommonJS-compatible


Streams are like Arrays, but laid out in time, rather than in memory.

EventStream (npm: event-stream) by Dominic Tarr is a library for manipulating "through streams", which is the author's terms for streams that are both readable
and writable:

// pretty.js

if (!module.parent) {
  var es = require('event-stream');

  es.connect(                          // connect streams together with `pipe`
    process.openStdin(),               // open stdin
    es.split(),                        // split stream to break on newlines
    es.map(function(data, callback) { // turn this async function into a stream
        , inspect(JSON.parse(data)))   // render it nicely
    process.stdout                     // pipe it to stdout!

// On the terminal:
// curl -sS registry.npmjs.org/event-stream | node pretty.js

The library provides many interesting ways to enhance native objects and
functions with streams. The author has even created a list of compatible
Node modules, which includes popular modules like
sax-js and request.

RSS with NodeJS and Socket.IO

French-speaking readers may appreciate RSS with NodeJS Socket.IO and

which is a full tutorial on how to build an RSS reader with Express and
Socket.IO. I had a go at reading it with Google Translate, and I was
able to follow it (for the most part).