This post has moved to my personal blog: http://maximilianschmitt.me/posts/iojs-command-line-apps-nodejs/
Last active
August 29, 2015 14:19
-
-
Save maximilianschmitt/8ef57cb679fbf764b108 to your computer and use it in GitHub Desktop.
Making your io.js command line apps compatible with node.js
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
I had to change filenames with .js extension to make it work in Windows