Skip to content

Commit

Permalink
fixing execution when you don't have ember-cli installed globally
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Apr 9, 2019
1 parent 2bd5636 commit 5d3872e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
const execa = require('execa');
const whoRanMe = require('who-ran-me');
const minimist = require('minimist');
const { join, dirname } = require('path');

const indexFile = require.resolve('ember-cli');

const emberPath = join(dirname(indexFile), '../../bin/ember');

const parsedArgs = minimist(process.argv.slice(2));

Expand All @@ -26,8 +31,8 @@ for (let i = 2; i < process.argv.length; i += 1) {

(async () => {
try {
await execa('ember', args, { stdio: 'inherit' });
await execa('ember', ['install', 'empress-blog', 'empress-blog-starter-template'], { cwd: pluginName, stdio: 'inherit' });
await execa(emberPath, args, { stdio: 'inherit' });
await execa(emberPath, ['install', 'empress-blog', 'empress-blog-starter-template'], { cwd: pluginName, stdio: 'inherit' });
} catch (err) {
// eslint-disable-next-line no-console
console.error(`Error running 'create-empress-blog-template': ${err.message}`, err);
Expand Down

0 comments on commit 5d3872e

Please sign in to comment.