-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add package-manager option #618
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to your notes about what's missing:
- it should have cnpm support (which, as I understand it, is the exact same interface as npm)
- there is one more reference to NPM in the tests that needs to be addressed.
common.js
Outdated
@@ -88,6 +88,18 @@ function asarApp (appPath, asarOptions, cb) { | |||
}) | |||
} | |||
|
|||
function pruneModules (opts, appPath, cb) { | |||
var pmName = opts['package-manager'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
per the spec:
It should be called packageManager in the API
common.js
Outdated
} else { | ||
// defaults to npm | ||
child.exec('npm prune --production', { cwd: appPath }, cb) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a better way to structure this:
opts.packageManager ||= 'npm'
switch (packageManager) {
case 'npm':
// do stuff
case 'yarn':
// do stuff
default:
throw error;
}
@@ -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') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should come back in some form or another. We need to be able to see when the prune operation occurs and with what package manager. It's pretty helpful for debugging user problems.
Thank you, @malept for the review. I'll fix it in this week. |
For tests, I think what I'd like to do is have Travis/AppVeyor download Yarn/cnpm and make sure they work correctly with pruning. The test reference to NPM should probably be configurable via an environment variable. |
f31a75e
to
cb36641
Compare
I've refactored this PR so that it also works with
I decided against this. I'm OK with having people working on tests needing to have NPM installed. |
cb36641
to
5245040
Compare
Need to fix calling cnpm on Windows (per CI failure) and also add a NEWS entry. |
978ec79
to
00689c2
Compare
I'm no longer calling cnpm on Windows (see: #515 (comment)). I just need to squash my commits, and I think I'll merge. |
00689c2
to
4fd4be3
Compare
Summarize your changes:
This PR introduces "package-manager" option.
It is a replacement of #614, and it tries to implement the spec defined in #515.
It can parse 'nom', 'yarn' as package-manager option.
When other package manager is specified, a warning message is shown.
This PR does not include the code below.
Thanks in advance for reading this message.
Fixes #518.
Addresses #515.