chromaui / chromatic-cli

Chromatic CLI: `npx chromatic`
https://www.chromatic.com/docs/cli
MIT License
289 stars 70 forks source link

Fix CLI version output #1079

Closed codykaup closed 1 month ago

codykaup commented 1 month ago

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
:sparkles: Test out this PR locally via: ```bash npm install chromatic@11.11.1--canary.1079.11182593192.0 # or yarn add chromatic@11.11.1--canary.1079.11182593192.0 ```
codacy-production[bot] commented 1 month ago

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
:white_check_mark: -0.16% (target: -1.00%) :x: 3.70% (target: 80.00%)
Coverage variation details | | Coverable lines | Covered lines | Coverage | | ------------- | ------------- | ------------- | ------------- | | Common ancestor commit (bd798a15c2736daf4cec5be50fcb826cf992e502) | 8606 | 4647 | 54.00% | | | Head commit (b079245619688e8e929c0d5f401aba41c47a729f) | 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: ` - `
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: `/ * 100%`

See your quality gate settings    Change summary preferences

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

github-actions[bot] commented 1 month ago

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