Skip to content
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

Merged
merged 3 commits into from
Jun 20, 2018

Conversation

skoging
Copy link
Contributor

@skoging skoging commented Jun 20, 2018

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.

return new Promise((resolve, reject) => {
const view = spawn("npm", ["view", packageName, "versions", "--json"]);
const view = spawn("npm", ["view", packageName, "versions", "--json", registry && `--registry=${registry}`]);
Copy link
Owner

@azu azu Jun 20, 2018

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"]

Copy link
Contributor Author

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
Copy link
Owner

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.

Copy link
Owner

@azu azu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@azu azu merged commit 87dc02b into azu:master Jun 20, 2018
@azu
Copy link
Owner

azu commented Jun 20, 2018

1.2.0 is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants