Skip to content

Commit

Permalink
Add package-manager option
Browse files Browse the repository at this point in the history
  • Loading branch information
hrkt authored and malept committed Apr 25, 2017
1 parent 2af9efc commit 330196c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions common.js
Expand Up @@ -88,6 +88,18 @@ function asarApp (appPath, asarOptions, cb) {
})
}

function pruneModules (opts, appPath, cb) {
var pmName = opts['package-manager']
if (pmName !== undefined && pmName === 'yarn') {
child.exec('yarn install --production ', { cwd: appPath }, cb)
} else if (pmName !== undefined && pmName !== 'npm') {
warning(`specified package-manager "${pmName}" is not available, use {"npm", "yarn"} instead`)
} else {
// defaults to npm
child.exec('npm prune --production', { cwd: appPath }, cb)
}
}

function isPlatformMac (platform) {
return platform === 'darwin' || platform === 'mas'
}
Expand Down Expand Up @@ -293,8 +305,7 @@ module.exports = {
// appPath is predictable (e.g. before .app is renamed for mac)
if (opts.prune || opts.prune === undefined) {
operations.push(function (cb) {
debug('Running npm prune --production')
child.exec('npm prune --production', {cwd: appPath}, cb)
pruneModules(opts, appPath, cb)
})
}

Expand Down

0 comments on commit 330196c

Please sign in to comment.