From c02ec1b228d36a201fedc980df08abd61de66c78 Mon Sep 17 00:00:00 2001 From: Caleb Eby Date: Fri, 12 May 2017 19:37:32 -0700 Subject: [PATCH 1/2] Add yarn option --- lib/index.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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.} 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}) + } } /** From 5a3d71cddfbd0eb1de075c3e8c2855fbf0b23818 Mon Sep 17 00:00:00 2001 From: Caleb Eby Date: Fri, 12 May 2017 19:58:56 -0700 Subject: [PATCH 2/2] Empty commit to trigger Travis