Skip to content

Instantly share code, notes, and snippets.

@maximilianschmitt
Last active August 29, 2015 14:19
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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
@Rolograaf
Copy link

I had to change filenames with .js extension to make it work in Windows

@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