-
-
Notifications
You must be signed in to change notification settings - Fork 298
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
Don't attempt to npm publish if package flagged as private in package.json #64
Don't attempt to npm publish if package flagged as private in package.json #64
Conversation
|
@@ -116,7 +121,12 @@ module.exports = (input, opts) => { | |||
}, | |||
{ | |||
title: 'Publishing package', | |||
task: () => exec('npm', ['publish'].concat(opts.tag ? ['--tag', opts.tag] : [])) | |||
task: () => getPackageJson() |
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.
Use the load-json-file
package here
We still "publish" these modules (we install them from the tag produced by npm version) so need all the other aspects of |
I think this makes sense. However, you should use Also, it should very clearly state that the publish step was skipped, and why.
Is it possible to publish private packages on npm if they are namespaced and you have a paid account? If so we may need to add extra logic for that. |
Reading the docs (https://docs.npmjs.com/files/package.json#private) it doesn't look like it. The purpose of |
Yeah, this makes sense then. If As stated - use |
Not really sure how to accomplish this with Listr - are you able to point me in the right direction? I tried resolving the 'publish' task's promise to the message, I tried exec'ing an |
@jamestalmage yes that's exactly what I need, thanks for raising those issues! In the meantime I've addressed all your other feedback - hopefully this can go ahead without the official skip warning? |
@@ -116,7 +114,14 @@ module.exports = (input, opts) => { | |||
}, | |||
{ | |||
title: 'Publishing package', | |||
task: () => exec('npm', ['publish'].concat(opts.tag ? ['--tag', opts.tag] : [])) | |||
task: () => readPkgUp() |
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.
I would use readPkgUp.sync()
here. No real benefit of using async fs
here as these tasks are done serially.
Sure, just open an issue with the remaining work so we don't forget. |
Looks great. Could you add a note to the readme about the behavior? This might be useful for other people to, but I don't think they would realize it's possible without some kind of indication. |
Skipping tasks is hopefully not too far away (SamVerschueren/listr#17), happy to hold out for that - this isn't super urgent for us. |
We can follow up once that lands. Great work. Thanks! |
Excellent work on this @unkillbob :) Cheers. |
Fixes #65
We have a bunch of packages that are installed out of private git repos and attempting to use
np
fails at the second last step asnpm publish
exits with an error when thepackage.json
specifiesprivate: true
.This pull request makes the change to simply skip the publish step if the package is flagged as private. I wasn't sure whether you'd want this mentioned in the readme or not - let me know if I should update it.
np
is really awesome and exactly what we needed, I hope we can get this small change in to adapt it for our use case!