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

Fix #5 by properly encoding the name of scoped packages before requesting their package from npm #6

Closed
wants to merge 8 commits into from

Conversation

lzilioli
Copy link

This PR contains 1 breaking test case for the scoped package.

@@ -18,8 +18,20 @@ function get(url, cb) {
});
}

function getCleanName(name){
name = name.split('@');
Copy link
Owner

Choose a reason for hiding this comment

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

Why?

@sindresorhus
Copy link
Owner

Thanks for the PR :)

@sindresorhus
Copy link
Owner

Can you use a descriptive pull request title?

@lzilioli lzilioli changed the title Fix #5 Fix #5 by properly encoding the name of scoped packages before requesting their package from npm Jul 27, 2015
@lzilioli
Copy link
Author

@sindresorhus I pushed an additional commit addressing you feedback, and changed the PR title to be more descriptive. Keep in mind that there is still a failing test case on this branch.

}

// test spec
var spec = {
Copy link

Choose a reason for hiding this comment

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

Glad to see all test cases applied to both scoped, and un-scoped, packages.

@ghost
Copy link

ghost commented Jul 29, 2015

I like how every sub-test fails with a different error. I guess at least it's the same test case.

@sindresorhus
Copy link
Owner

@lzilioli Can you fix the tests?

@ghost
Copy link

ghost commented Aug 14, 2015

@sindresorhus and @lzilioli , I filed #7 as a follow-up to the scoped package metadata end-point.

@sindresorhus
Copy link
Owner

@lzilioli friendly ping :)

@lzilioli
Copy link
Author

Apologies! I have been on vacation the past two weeks, and did not have access to my computer most of that time. I am taking a look at the test cases now. I was surprised to learn that these test cases were failing, as I did not believe my changes would be responsible for breaking those cases. I performed a git bisect, and the following commit was identified as faulty:

[package-json ((de39fa8...)|BISECTING) Fri Aug 21 10:27:57]
$ git bisect bad head
de39fa84f971ed3f2dd9bd796657fbd8228c47f0 is the first bad commit
commit de39fa84f971ed3f2dd9bd796657fbd8228c47f0
Author: Sindre Sorhus <sindresorhus@gmail.com>
Date:   Thu Jun 4 15:42:46 2015 +0200

    add support for getting a single field from package.json

This seems to indicate that npm may have changed something on their end with respect to the single-field endpoint. Is there documentation for this on their site? If so, I can update the single-field url we are fetching.

Am I missing something here?

@lzilioli
Copy link
Author

@sindresorhus friendly ping

@ghost
Copy link

ghost commented Sep 11, 2015

@lzilioli please see my comment here. The by-field API end-point has been removed. Therefore these unit tests for that feature, which make actual calls to the registry, will fail.

My vote would be to add an extra commit to your merge request to comment out those tests. That would allow us to move more quickly with getting this fix out. However, given that the by-field end-point is gone, the entire commit adding that functionality should be reverted and a new release cut.


if (typeof version !== 'string') {
cb = version;
version = '';
}

if(version && packageIsScoped(name)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@lzilioli for style consistency, can you add a space after if?


if (typeof version !== 'string') {
cb = version;
version = '';
}

if(version && packageIsScoped(name)) {
throw new Error('Fetching a specific version of a scoped package is not allowed by npm.');
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't even see this earlier. Thank you for adding a check here.

@hutson
Copy link
Contributor

hutson commented Sep 22, 2015

I've filed #8 to revert the by-field feature.

@lzilioli
Copy link
Author

@hbetts @destroyerofbuilds I just pushed two commits. One to address the space for consistency, and the other to remove the tests that it looks like will be reverted in #8

@lzilioli
Copy link
Author

lzilioli commented Oct 6, 2015

@sindresorhus Any plans to release this?

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.

None yet

3 participants