-
-
Notifications
You must be signed in to change notification settings - Fork 8
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 support for registry definition in package.json publishConfig #6
Conversation
lib/can-npm-publish.js
Outdated
return new Promise((resolve, reject) => { | ||
const view = spawn("npm", ["view", packageName, "versions", "--json"]); | ||
const view = spawn("npm", ["view", packageName, "versions", "--json", registry && `--registry=${registry}`]); |
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.
Can you change this as follows?
const registryArgs = registry ? [`--registry=${registry}`] : [];
const view = spawn("npm", ["view", packageName, "versions", "--json"].concat(registryArgs));
Because, I not want to put undefined
value into spawn
's arguments.
var registry = undefined;
["a", registry && `--registry=${registry}`];
// ["a", undefined]
var registryArgs = registry ? [`--registry=${registry}`] : [];
["a"].concat(registryArgs);
// ["a"]
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.
Yes, thats definatly better.
@@ -37,9 +37,9 @@ const checkPrivateField = packagePath => { | |||
* @param packageName |
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.
We can add @param {string} [registry]
to JSDoc.
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.
LGTM
1.2.0 is released. |
Currently if an alternative/private registry is defined in package.json publishConfig, npmjs.org registry will still be used.
This adds support by reading the registry field in package.json and passing it to
npm view
with the--registry
argument.Added tests using the Yarn registry as an alternative registry.