26 lines
760 B
Plaintext
26 lines
760 B
Plaintext
|
#!/usr/bin/env node
|
||
|
|
||
|
try {
|
||
|
new Function('var {a} = {a: 1}')();
|
||
|
} catch (error) {
|
||
|
console.error('Your JavaScript runtime does not support some features used by the coffee command. Please use Node 6 or later.');
|
||
|
process.exit(1);
|
||
|
}
|
||
|
|
||
|
var path = require('path');
|
||
|
var fs = require('fs');
|
||
|
|
||
|
var potentialPaths = [
|
||
|
path.join(process.cwd(), 'node_modules/coffeescript/lib/coffeescript'),
|
||
|
path.join(process.cwd(), 'node_modules/coffeescript/lib/coffee-script'),
|
||
|
path.join(process.cwd(), 'node_modules/coffee-script/lib/coffee-script'),
|
||
|
path.join(__dirname, '../lib/coffeescript')
|
||
|
];
|
||
|
|
||
|
for (var i = 0, len = potentialPaths.length; i < len; i++) {
|
||
|
if (fs.existsSync(potentialPaths[i])) {
|
||
|
require(potentialPaths[i] + '/command').run();
|
||
|
break;
|
||
|
}
|
||
|
}
|