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 logging --version flag #1419

Merged
merged 1 commit into from
Aug 19, 2024
Merged

Conversation

bluwy
Copy link
Collaborator

@bluwy bluwy commented Jul 18, 2024

Fixes #1418

I didn't realize that meow would read the nearest package.json and auto support the --version flag, so this PR adds that support manually.

Copy link

changeset-bot bot commented Jul 18, 2024

🦋 Changeset detected

Latest commit: 919bcff

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@changesets/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

codecov bot commented Jul 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.02%. Comparing base (b593756) to head (919bcff).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1419   +/-   ##
=======================================
  Coverage   81.02%   81.02%           
=======================================
  Files          54       54           
  Lines        2213     2213           
  Branches      654      659    +5     
=======================================
  Hits         1793     1793           
  Misses        416      416           
  Partials        4        4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

// Version should only be shown if it's the only argument passed
if (parsed.version && args.length === 1) {
// eslint-disable-next-line import/no-extraneous-dependencies
console.log(require("@changesets/cli/package.json").version);
Copy link
Member

Choose a reason for hiding this comment

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

would it work if we'd import it? IIRC Preconstruct (the tools that we use for building packages) uses the json plugin. I'm hesitant when it comes to mixing imports and requires in the same files

Copy link
Collaborator Author

@bluwy bluwy Jul 18, 2024

Choose a reason for hiding this comment

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

I copied this from below

- @changesets/cli@${
// eslint-disable-next-line import/no-extraneous-dependencies
require("@changesets/cli/package.json").version
}

I can give import a try though. The best case would also seem to be inlining the version directly in build-time

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It looks like default importing the package.json works (named import not supported), so it would bundle the entire package.json in the output.

@bluwy
Copy link
Collaborator Author

bluwy commented Aug 19, 2024

Hey, checking in if this is ready to be merged now? I think the require discussion above shouldn't be a problem as there's also the same code currently.

@Andarist Andarist merged commit 4efc038 into changesets:main Aug 19, 2024
7 checks passed
@github-actions github-actions bot mentioned this pull request Aug 19, 2024
@bluwy bluwy deleted the fix-version-flag branch August 19, 2024 12:58
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.

Is --version flag no longer supported?
2 participants