Skip to content

Instantly share code, notes, and snippets.

@maximilianschmitt
Last active August 29, 2015 14:19
Show Gist options
  • Save maximilianschmitt/8ef57cb679fbf764b108 to your computer and use it in GitHub Desktop.
Save maximilianschmitt/8ef57cb679fbf764b108 to your computer and use it in GitHub Desktop.
Making your io.js command line apps compatible with node.js
@sebastienbarre
Copy link

This is extremely useful, thank you.

I'm a bit OCD and I didn't want to hard-code the name of my binary (here say-hello) in the harmony launcher, so here is slightly modified version that pull the module name from package.json:

#!/usr/bin/env node
'use strict';

var iojs  = require('is-iojs');

if (!iojs) {
  var pjson = require('./package.json');
  require('babel/register')({
    ignore: new RegExp(pjson.name + '/node_modules')
  });
}

require('./index.js');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment