Skip to content

Commit a17c5f9

Browse files
feat(deps): add dependency management recipes and playwright version check
1 parent 4af7315 commit a17c5f9

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

justfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,43 @@ default:
1919
install:
2020
bun install
2121

22+
# Update dependencies to latest compatible versions (respects ^, ~)
23+
[group('workspace')]
24+
update:
25+
bun update
26+
27+
# Upgrade dependencies to latest versions (ignoring semver constraints)
28+
[group('workspace')]
29+
upgrade:
30+
bun upgrade
31+
32+
# Show outdated dependencies
33+
[group('workspace')]
34+
outdated:
35+
bun outdated
36+
37+
# Check if @playwright/test matches playwright-web-flake version
38+
[group('workspace')]
39+
check-playwright:
40+
@./scripts/check-playwright-sync.sh
41+
42+
# Update @playwright/test to match playwright-web-flake, update lockfile, and test
43+
[group('workspace')]
44+
update-playwright: check-playwright
45+
#!/usr/bin/env bash
46+
set -euo pipefail
47+
FLAKE_VERSION=$(grep "playwright-web-flake.url" flake.nix | sed 's/.*\/\([0-9.]*\)".*/\1/')
48+
echo "Updating @playwright/test to ^$FLAKE_VERSION..."
49+
cd packages/docs
50+
# Use jq to update package.json
51+
jq ".devDependencies.\"@playwright/test\" = \"^$FLAKE_VERSION\"" package.json > package.json.tmp
52+
mv package.json.tmp package.json
53+
cd ../..
54+
echo "Running bun install to update lockfile..."
55+
bun install
56+
echo "Running tests to verify..."
57+
just docs-test
58+
2259
# Clean all workspace build artifacts
2360
[group('workspace')]
2461
clean:

scripts/check-playwright-sync.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
2+
# Check if @playwright/test version matches playwright-web-flake pin
3+
set -euo pipefail
4+
5+
# Colors for output
6+
RED='\033[0;31m'
7+
GREEN='\033[0;32m'
8+
YELLOW='\033[1;33m'
9+
NC='\033[0m' # No Color
10+
11+
# Get playwright-web-flake version from flake.nix
12+
FLAKE_VERSION=$(grep "playwright-web-flake.url" flake.nix | sed 's/.*\/\([0-9.]*\)".*/\1/')
13+
14+
# Get @playwright/test version from package.json (strip ^, ~, etc.)
15+
NPM_VERSION=$(jq -r '.devDependencies."@playwright/test"' packages/docs/package.json | sed 's/[^0-9.]//g')
16+
17+
# Extract major.minor for comparison (ignore patch)
18+
FLAKE_MAJ_MIN=$(echo "$FLAKE_VERSION" | cut -d. -f1-2)
19+
NPM_MAJ_MIN=$(echo "$NPM_VERSION" | cut -d. -f1-2)
20+
21+
echo "Version Check:"
22+
echo " playwright-web-flake: $FLAKE_VERSION"
23+
echo " @playwright/test: $NPM_VERSION"
24+
echo ""
25+
26+
if [ "$FLAKE_MAJ_MIN" = "$NPM_MAJ_MIN" ]; then
27+
echo -e "${GREEN}✓ Versions synchronized${NC}"
28+
exit 0
29+
else
30+
echo -e "${RED}✗ Version mismatch detected!${NC}"
31+
echo ""
32+
echo -e "${YELLOW}Action required:${NC}"
33+
if [[ "$FLAKE_VERSION" > "$NPM_VERSION" ]]; then
34+
echo " 1. Update @playwright/test to match flake:"
35+
echo " just deps-update-playwright"
36+
else
37+
echo " 1. Update playwright-web-flake in flake.nix to $NPM_MAJ_MIN.x"
38+
echo " 2. Run: nix flake update playwright-web-flake"
39+
echo " 3. Test: just docs-test"
40+
fi
41+
exit 1
42+
fi

0 commit comments

Comments
 (0)