Skip to content

Commit 7beef3d

Browse files
Merge branch 'main' into update-examples-1.4.0
2 parents c43b412 + 06df46f commit 7beef3d

File tree

5 files changed

+38
-2
lines changed

5 files changed

+38
-2
lines changed

.github/workflows/biome.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ jobs:
1414
steps:
1515
- name: Checkout
1616
uses: actions/checkout@v4
17+
- name: Check Biome Version
18+
run: ./scripts/check-biome-version.sh
1719
- name: Setup Biome
1820
uses: biomejs/setup-biome@v2
1921
with:
20-
version: latest
22+
version: "1.9.4"
2123
- name: Run Biome
2224
run: biome ci .

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
npm run lint-staged
2+
npm run check-biome-version

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,14 @@ This repository contains various examples of the usage of [Nutrient Web SDK](htt
66
- **Guides**: https://www.nutrient.io/guides/web/
77
- **API**: https://www.nutrient.io/guides/web/api/
88

9+
## Development
10+
11+
### Biome Version Check
12+
13+
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:
14+
15+
- During CI/CD in the GitHub workflow
16+
- As a pre-commit hook to prevent commits with mismatched versions
17+
- Manually using `npm run check-biome-version`
18+
19+
If you update the Biome version in `package.json`, make sure to update it in `.github/workflows/biome.yml` as well.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"lint-staged": "lint-staged",
2525
"test": "playwright test",
2626
"audit-fix": "./scripts/audit-dependencies.sh",
27-
"update-nutrient-version": "./scripts/update-nutrient-in-examples.sh"
27+
"update-nutrient-version": "./scripts/update-nutrient-in-examples.sh",
28+
"check-biome-version": "./scripts/check-biome-version.sh"
2829
},
2930
"lint-staged": {
3031
"*": ["biome check --write --no-errors-on-unmatched"]

scripts/check-biome-version.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# Script to check if Biome version in package.json matches the version in .github/workflows/biome.yml
4+
5+
# Extract Biome version from package.json (removing the ^ if present)
6+
PACKAGE_VERSION=$(grep -o '"@biomejs/biome": "\^*[0-9.]*"' package.json | grep -o '[0-9.]*')
7+
8+
# Extract Biome version from .github/workflows/biome.yml
9+
WORKFLOW_VERSION=$(grep -o 'version: "[0-9.]*"' .github/workflows/biome.yml | grep -o '[0-9.]*')
10+
11+
echo "Biome version in package.json: $PACKAGE_VERSION"
12+
echo "Biome version in workflow file: $WORKFLOW_VERSION"
13+
14+
# Check if versions match
15+
if [ "$PACKAGE_VERSION" != "$WORKFLOW_VERSION" ]; then
16+
echo "Error: Biome versions do not match!"
17+
echo "Please update the version in .github/workflows/biome.yml to match the version in package.json."
18+
exit 1
19+
else
20+
echo "Biome versions match."
21+
fi

0 commit comments

Comments
 (0)