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 CLI version output #1079

Merged

Conversation

codykaup
Copy link
Contributor

@codykaup codykaup commented Oct 3, 2024

This fixes a couple issues around versioning in our CLI output.

  1. The version that prints at the start of a build is the previous release
  2. Calling --version shows the project's package.json version and not the CLI version

Incorrect version information on build

This one stems from a timing issue between auto shipit and our build process. We actually build the CLI before we call auto shipit (which is what auto recommends). However, auto figures out what the version will be during it's deployment step. Therefore, we need to

  1. Call auto shipit --dry-run to get the latest version without deploying
  2. Bump the version in package.json
  3. Build
  4. Reset all changes
  5. Then auto shipit again

Incorrect version from --version

We use meow for our CLI flags and it tries to figure out the version for you, if it's not set. Therefore, calling npx chromatic --version will just print the version in your project instead of the CLI version. Simply setting this value when building fixes that issue!

image

📦 Published PR as canary version: 11.11.1--canary.1079.11182593192.0

✨ Test out this PR locally via:

npm install [email protected]
# or 
yarn add [email protected]

@codykaup codykaup added patch Auto: Increment the patch version when merged skip-release Auto: Preserve the current version when merged labels Oct 3, 2024
@codykaup codykaup self-assigned this Oct 3, 2024
Copy link

codacy-production bot commented Oct 3, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-0.16% (target: -1.00%) 3.70% (target: 80.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (bd798a1) 8606 4647 54.00%
Head commit (b079245) 8633 (+27) 4648 (+1) 53.84% (-0.16%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#1079) 27 1 3.70%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Copy link
Contributor

github-actions bot commented Oct 3, 2024

📦 Package Size: 5268 KB
✅ Compared to main: 0 KB bd798a1 (5268 KB)

@codykaup codykaup force-pushed the cody/cap-2202-chromatic-cli-doesnt-show-correct-version branch 2 times, most recently from 3ec7343 to 035c9b7 Compare October 4, 2024 14:52
@codykaup codykaup force-pushed the cody/cap-2202-chromatic-cli-doesnt-show-correct-version branch from 035c9b7 to 0542e1f Compare October 4, 2024 15:01
@codykaup codykaup changed the title Build after versioning package Fix CLI version output Oct 4, 2024
@codykaup codykaup requested a review from a team October 4, 2024 15:32
@codykaup codykaup marked this pull request as ready for review October 4, 2024 15:33
@codykaup codykaup added this pull request to the merge queue Oct 7, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 7, 2024
@codykaup codykaup added this pull request to the merge queue Oct 7, 2024
Merged via the queue into main with commit d642d22 Oct 7, 2024
22 of 23 checks passed
@codykaup codykaup deleted the cody/cap-2202-chromatic-cli-doesnt-show-correct-version branch October 7, 2024 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Auto: Increment the patch version when merged skip-release Auto: Preserve the current version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants