/
ember
executable file
·36 lines (32 loc) · 1.06 KB
/
ember
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env node
'use strict';
// Provide a title to the process in `ps`
process.title = 'ember';
// require('time-require');
var resolve = require('resolve');
var exit = require('exit');
resolve('ember-cli', {
basedir: process.cwd()
}, function(error, projectLocalCli) {
var cli;
if (error) {
// If there is an error, resolve could not find the ember-cli
// library from a package.json. Instead, include it from a relative
// path to this script file (which is likely a globally installed
// npm package). Most common cause for hitting this is `ember new`
cli = require('../lib/cli');
} else {
// No error implies a projectLocalCli, which will load whatever
// version of ember-cli you have installed in a local package.json
cli = require(projectLocalCli);
}
cli({
cliArgs: process.argv.slice(2),
inputStream: process.stdin,
outputStream: process.stdout,
errorStream: process.stderr
}).then(function(result) {
var exitCode = typeof result === 'object' ? result.exitCode : result;
exit(exitCode);
});
});