Skip to content

Pin Biome version in GitHub CI to match package.json #30

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

Merged
merged 3 commits into from
Jun 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/biome.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check Biome Version
run: ./scripts/check-biome-version.sh
- name: Setup Biome
uses: biomejs/setup-biome@v2
with:
version: latest
version: "1.9.4"
- name: Run Biome
run: biome ci .
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
npm run lint-staged
npm run check-biome-version
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,14 @@ This repository contains various examples of the usage of [Nutrient Web SDK](htt
- **Guides**: https://www.nutrient.io/guides/web/
- **API**: https://www.nutrient.io/guides/web/api/

## Development

### Biome Version Check

This repository includes a check to ensure that the Biome version in `package.json` matches the version in `.github/workflows/biome.yml`. This check is run:

- During CI/CD in the GitHub workflow
- As a pre-commit hook to prevent commits with mismatched versions
- Manually using `npm run check-biome-version`

If you update the Biome version in `package.json`, make sure to update it in `.github/workflows/biome.yml` as well.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"lint-staged": "lint-staged",
"test": "playwright test",
"audit-fix": "./scripts/audit-dependencies.sh",
"update-nutrient-version": "./scripts/update-nutrient-in-examples.sh"
"update-nutrient-version": "./scripts/update-nutrient-in-examples.sh",
"check-biome-version": "./scripts/check-biome-version.sh"
},
"lint-staged": {
"*": ["biome check --write --no-errors-on-unmatched"]
Expand Down
21 changes: 21 additions & 0 deletions scripts/check-biome-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Script to check if Biome version in package.json matches the version in .github/workflows/biome.yml

# Extract Biome version from package.json (removing the ^ if present)
PACKAGE_VERSION=$(grep -o '"@biomejs/biome": "\^*[0-9.]*"' package.json | grep -o '[0-9.]*')

# Extract Biome version from .github/workflows/biome.yml
WORKFLOW_VERSION=$(grep -o 'version: "[0-9.]*"' .github/workflows/biome.yml | grep -o '[0-9.]*')

echo "Biome version in package.json: $PACKAGE_VERSION"
echo "Biome version in workflow file: $WORKFLOW_VERSION"

# Check if versions match
if [ "$PACKAGE_VERSION" != "$WORKFLOW_VERSION" ]; then
echo "Error: Biome versions do not match!"
echo "Please update the version in .github/workflows/biome.yml to match the version in package.json."
exit 1
else
echo "Biome versions match."
fi
Loading