From c68be47ca6db8f54136dfa0e3a53a46eb03cea4a Mon Sep 17 00:00:00 2001 From: Gaurav Munjal Date: Mon, 4 Nov 2024 09:44:09 -0500 Subject: [PATCH] bugfix with dirPath --- lib/models/addon-test-app.js | 3 +++ lib/utilities/pristine.js | 4 +--- lib/utilities/run-command.js | 2 +- lib/utilities/run-ember.js | 10 ++++++---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/models/addon-test-app.js b/lib/models/addon-test-app.js index e86cae4..9a5c9a5 100644 --- a/lib/models/addon-test-app.js +++ b/lib/models/addon-test-app.js @@ -24,6 +24,9 @@ AddonTestApp.prototype.create = function(appName, options) { return pristine.createApp(appName, options) .then(appPath => { + if (!appPath) { + return Promise.reject('createApp failed'); + } this.path = appPath; return options.noFixtures ? Promise.resolve() : diff --git a/lib/utilities/pristine.js b/lib/utilities/pristine.js index 1e39e20..8641e16 100644 --- a/lib/utilities/pristine.js +++ b/lib/utilities/pristine.js @@ -12,10 +12,8 @@ const symlinkDirectory = require('./symlink-directory'); const runCommand = require('./run-command'); const runEmber = require('./run-ember'); const runNew = require('./run-new'); -const semver = require('semver'); -// As of Ember-CLI@2.13.0, it no longer uses Bower by default -const usesBower = semver.lt(require('ember-cli/package').version, '2.13.0'); +const usesBower = false; const runCommandOptions = { // Note: We must override the default logOnFailure logging, because we are // not inside a test. diff --git a/lib/utilities/run-command.js b/lib/utilities/run-command.js index be1bcac..af9926f 100644 --- a/lib/utilities/run-command.js +++ b/lib/utilities/run-command.js @@ -13,7 +13,7 @@ const exec = denodeify(childProcess.exec); const isWindows = process.platform === 'win32'; module.exports = function run(/* command, args, options */) { - let command = arguments[0]; + let command = arguments[0] || 'node'; let args = Array.prototype.slice.call(arguments, 1); let options = {}; diff --git a/lib/utilities/run-ember.js b/lib/utilities/run-ember.js index 2fb775d..09e27af 100644 --- a/lib/utilities/run-ember.js +++ b/lib/utilities/run-ember.js @@ -5,11 +5,13 @@ const findup = require('findup-sync'); const runCommand = require('./run-command'); module.exports = function(command, options, dirPath) { - let emberCLIPath = findup('node_modules/ember-cli', { - cwd: dirPath || __dirname - }); + let cwd = __dirname; + if (dirPath && dirPath.startsWith(__dirname)) { + cwd = dirPath; + } + let emberCLIPath = findup('node_modules/ember-cli', { cwd }); - let args = [path.join(emberCLIPath, 'bin', 'ember'), command].concat(options); + let args = ['node', path.join(emberCLIPath, 'bin', 'ember'), command].concat(options); return runCommand.apply(undefined, args); };