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: npm get peer deps returns list and not object when using range #1443

Closed
wants to merge 1 commit into from

Conversation

rbnayax
Copy link
Contributor

@rbnayax rbnayax commented Aug 7, 2024

Running the test without the fix results in:

AssertionError: expected { 'eslint-plugin-unused-imports': [ { eslint: '9', '@typescript-eslint/eslint-plugin': '8' }, { '@typescript-eslint/eslint-plugin': '^8.0.0-0', eslint: '^9.0.0' } ] } to deeply equal { 'eslint-plugin-unused-imports': { '@typescript-eslint/eslint-plugin': '^8.0.0-0', eslint: '^9.0.0' } }

@@ -15,6 +15,17 @@ describe('getPeerDependenciesFromRegistry', function () {
})
})

it('single package with range', async () => {
await chalkInit()
const data = await getPeerDependenciesFromRegistry({ 'eslint-plugin-unused-imports': '^4' }, {})
Copy link
Owner

Choose a reason for hiding this comment

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

getPeerDependenciesFromRegistry is currently typed to take an exact version (Version), not a version range (VersionSpec). They both resolve to string, so the type checker does not catch this yet.

Is there somewhere in the code that is calling getPeerDependenciesFromRegistry with a version range instead of an exact version? I think we need to fix it there. Getting the peer dependencies of an entire version range doesn't really make sense to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are correct, but for the life of me, I can't remember how I came to find that "issue". I can't reproduce it locally and I can't see how version spec was passed here. So I will close this PR for now

@rbnayax rbnayax closed this Aug 8, 2024
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