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

Store raw installed versions for npm, pnpm, and yarn package managers instead of detected version #10938

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

kbukum1
Copy link
Contributor

@kbukum1 kbukum1 commented Nov 14, 2024

What are you trying to accomplish?

This PR updates the package manager version retrieval to store the raw installed version (including pre-release and build metadata, if any) for npm, pnpm, and yarn, instead of defaulting to a selected or guessed version. This change ensures that the exact installed version is captured, reflecting the actual environment more accurately.

Anything you want to highlight for special attention from reviewers?

  • The installed_version method has been modified to retrieve and validate the raw version format directly from the package manager, falling back to the lockfile version if the format is unexpected.
  • The memoization now caches the raw version, reducing calls to retrieve the version for the same package manager name.
  • This approach improves accuracy by capturing the true installed version, which is essential for debugging and tracking specific package versions in complex environments.

How will you know you've accomplished your goal?

  • Tests are included to verify that the raw version, including tags or metadata (e.g., 6.4.5-alpha), is stored and returned when available.
  • Performance is maintained through memoization, ensuring minimal repeated calls for version retrieval.
  • The functionality is confirmed to work as expected across npm, pnpm, and yarn, with correct fallbacks to lockfile versions if the installed version does not match expected patterns.

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@kbukum1 kbukum1 marked this pull request as ready for review November 15, 2024 00:08
@kbukum1 kbukum1 requested a review from a team as a code owner November 15, 2024 00:08
@kbukum1 kbukum1 changed the title Store raw installed version for npm, pnpm, and yarn package managers instead of selected version Store raw installed versions for npm, pnpm, and yarn package managers instead of selected version Nov 15, 2024
@kbukum1 kbukum1 changed the title Store raw installed versions for npm, pnpm, and yarn package managers instead of selected version Store raw installed versions for npm, pnpm, and yarn package managers instead of detected version Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants