Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
)
}
}
Expand All @@ -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})
}
}

/**
Expand Down