Skip to content

TA-3920: Fix package.json path#232

Merged
Zgjim Haziri (ZgjimHaziri) merged 5 commits intomasterfrom
TA-3920-fix-version-command
Jul 9, 2025
Merged

TA-3920: Fix package.json path#232
Zgjim Haziri (ZgjimHaziri) merged 5 commits intomasterfrom
TA-3920-fix-version-command

Conversation

@ZgjimHaziri
Copy link
Contributor

@ZgjimHaziri Zgjim Haziri (ZgjimHaziri) commented Jul 7, 2025

Description

The VersionUtils which logs the version of the CLI in the console, has the path of the required package.json wrong when trying to install it globally. The reason this is working locally is because of the fact that the directory locally is structured that way that when you go up in the tree from dist, you will also find the original package.json there.

Special notes

Unpublished the 1.0.1 version that was published with a faulty path. Merging this will re-publish it.

Checklist

  • I have self-reviewed this PR
  • I have tested the change and proved that it works in different scenarios
  • I have updated docs if needed

@ZgjimHaziri Zgjim Haziri (ZgjimHaziri) requested a review from a team as a code owner July 7, 2025 13:37
Buqeta
Buqeta (Buqeta) previously approved these changes Jul 7, 2025
@ZgjimHaziri
Copy link
Contributor Author

The initial solution of this PR was working for both global and local installations, but was failing the tests in which the location of package.json is pretty different. As a solution added the package-up package, which is a simple tool for finding the closest package.json.

Note: since the tool does async file reading, had to do some minor refactorings in the content-cli.ts file to fit the async changes.

Buqeta
Buqeta (Buqeta) previously approved these changes Jul 9, 2025
@ksalihu
Copy link
Contributor

The initial solution of this PR was working for both global and local installations, but was failing the tests in which the location of package.json is pretty different. As a solution added the package-up package, which is a simple tool for finding the closest package.json.

Note: since the tool does async file reading, had to do some minor refactorings in the content-cli.ts file to fit the async changes.

Checked the library a bit, the implementation is kinda simple, I don't think we should use a library for these checks.
In the tests maybe we should see if we can mock the version util or something like that

@ZgjimHaziri
Copy link
Contributor Author

The initial solution of this PR was working for both global and local installations, but was failing the tests in which the location of package.json is pretty different. As a solution added the package-up package, which is a simple tool for finding the closest package.json.

Note: since the tool does async file reading, had to do some minor refactorings in the content-cli.ts file to fit the async changes.

Update: used the already existing find-up dependency, with no need to add another package.

@ZgjimHaziri Zgjim Haziri (ZgjimHaziri) merged commit 23bad76 into master Jul 9, 2025
1 check passed
@ZgjimHaziri Zgjim Haziri (ZgjimHaziri) deleted the TA-3920-fix-version-command branch July 9, 2025 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

6 participants