UNPKG

678 BJavaScriptView Raw
1'use strict';
2
3const findEmberPath = require('./find-ember-path');
4const run = require('./run');
5
6module.exports = async function (root, commandArgs, opts) {
7 let options = Object.assign({ cwd: root }, opts);
8 let [command, ...actualArgs] = commandArgs;
9
10 try {
11 if (command === 'ember') {
12 let emberPath = await findEmberPath(root);
13 await run('node', [`"${emberPath}"`, ...actualArgs], options);
14 } else {
15 await run(command, actualArgs, options);
16 }
17
18 return true;
19 } catch (errorCode) {
20 if (errorCode !== 1) {
21 throw new Error(`The command ${commandArgs.join(' ')} exited ${errorCode}`);
22 } else {
23 return false;
24 }
25 }
26};