Skip to content

Simplify package version retrieval#536

Merged
sorenlouv merged 6 commits intomainfrom
simplify-package-version-retrieval
May 23, 2025
Merged

Simplify package version retrieval#536
sorenlouv merged 6 commits intomainfrom
simplify-package-version-retrieval

Conversation

@sorenlouv
Copy link
Copy Markdown
Owner

@sorenlouv sorenlouv commented May 23, 2025

Retrieve package version from package.json at runtime instead of extracting at build time

@sorenlouv sorenlouv requested a review from Copilot May 23, 2025 10:57
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR simplifies how the package version is retrieved by replacing a hard-coded string with a dynamic import from package.json, and updates tests to reflect this change.

  • Dynamically import the version value from package.json instead of hardcoding it.
  • Update tests to set and record the unmapped version before applying a mock value.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

File Description
src/utils/packageVersion.ts Uses the package.json import to dynamically retrieve the version.
src/test/setupFiles/automatic-mocks.ts Adjusts the mocks to accommodate the change in version retrieval.
Files not reviewed (1)
  • package.json: Language not supported
Comments suppressed due to low confidence (1)

src/test/setupFiles/automatic-mocks.ts:25

  • Reassigning an exported constant may produce confusion and unintended side effects. Consider refactoring the test to use dependency injection or another strategy that avoids modifying a constant export.
packageVersionModule.PACKAGE_VERSION = '1.2.3-mocked';

@sorenlouv sorenlouv merged commit 113de50 into main May 23, 2025
3 checks passed
@sorenlouv sorenlouv deleted the simplify-package-version-retrieval branch May 23, 2025 15:12
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