diff --git a/lib/index.js b/lib/index.js index cc6877a..073c7c4 100644 --- a/lib/index.js +++ b/lib/index.js @@ -128,11 +128,15 @@ class Spike extends EventEmitter { .tap(() => emit('info', 'initializing template')) .then(sprout.init.bind(sprout, opts.template, opts.root, sproutOptions)) .tap(() => emit('info', 'installing production dependencies')) - .then(npmInstall.bind(null, opts)) + .then(installDeps.bind(null, opts)) .then(() => new Spike({ root: opts.root })) .done( - (instance) => { emit('done', instance) }, - (err) => { emit('error', err) } + instance => { + emit('done', instance) + }, + err => { + emit('error', err) + } ) } } @@ -150,8 +154,12 @@ function uuid () { * @private * @return {Promise.<String>} promise for the command output */ -function npmInstall (opts) { - return node.call(exec, 'npm install --production', { cwd: opts.root }) +function installDeps (opts) { + if (opts.tool === 'yarn') { + return node.call(exec, 'yarn', {cwd: opts.root}) + } else { + return node.call(exec, 'npm install --production', {cwd: opts.root}) + } } /**