Skip to content

Commit acf5854

Browse files
committed
streamline playwright version in catalog, use that as the basis for ci caching
1 parent c4827a7 commit acf5854

6 files changed

Lines changed: 55 additions & 27 deletions

File tree

.github/actions/setup-playwright/action.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,28 @@ runs:
99
shell: bash
1010
run: >
1111
echo "$(
12-
node -e "
13-
const fs = require('fs');
14-
const lockfile = fs.readFileSync('./pnpm-lock.yaml', 'utf8');
15-
const pattern = (name) => new RegExp(name + ':\\\s+specifier: [\\\s\\\w\\\.^]+version: (\\\d+\\\.\\\d+\\\.\\\d+)');
16-
const playwrightVersion = lockfile.match(pattern('playwright'))[1];
12+
node --input-type=module -e "
13+
import fs from 'node:fs';
14+
import path from 'node:path';
15+
16+
const workspaceRoot = process.env.GITHUB_WORKSPACE || process.cwd();
17+
const workspaceFilePath = path.join(workspaceRoot, 'pnpm-workspace.yaml');
18+
const workspaceConfig = fs.readFileSync(workspaceFilePath, 'utf8');
19+
20+
const playwrightVersion = workspaceConfig.match(
21+
/(?:^|\\n)catalog:\\n(?: {2}[^\\n]*\\n)*? {2}playwright:\\s*([^#\\s]+)\\s*(?:#.*)?(?:\\n|$)/,
22+
)?.[1];
23+
24+
if (playwrightVersion === undefined) {
25+
console.error('Failed to resolve playwright from top-level catalog in pnpm-workspace.yaml');
26+
process.exit(1);
27+
}
28+
29+
if (/^[~^]/.test(playwrightVersion)) {
30+
console.error('Playwright catalog entry must be pinned to a specific version:', playwrightVersion);
31+
process.exit(1);
32+
}
33+
1734
console.log('PLAYWRIGHT_VERSION=' + playwrightVersion);
1835
"
1936
)" >> $GITHUB_OUTPUT

apps/internal-storybook/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"@types/react-dom": "^18.2.21",
2222
"@vitejs/plugin-react": "^5.1.1",
2323
"@vitest/browser-playwright": "catalog:",
24+
"playwright": "catalog:",
2425
"react": "^18.2.0",
2526
"react-dom": "^18.2.0",
2627
"storybook": "catalog:",

apps/internal-storybook/pnpm-lock.yaml

Lines changed: 18 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eval/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"istanbul-lib-coverage": "^3.2.0",
4040
"nypm": "^0.6.2",
4141
"oxfmt": "^0.27.0",
42-
"playwright": "^1.56.1",
42+
"playwright": "catalog:",
4343
"radix-ui": "^1.4.3",
4444
"react": "^19.1.1",
4545
"react-dom": "^19.1.1",

eval/pnpm-lock.yaml

Lines changed: 12 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ catalog:
2323
vite: 7.2.2
2424
vitest: 4.0.6
2525
'@vitest/browser-playwright': 4.0.6
26+
playwright: 1.56.1
2627

2728
catalogs:
2829
trials:

0 commit comments

Comments
 (0)