This commit is contained in:
parent
e9b6035c58
commit
2165ed0c33
3 changed files with 34 additions and 2 deletions
|
|
@ -10,7 +10,7 @@ required client JavaScript.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm install
|
npm install
|
||||||
npx playwright install chromium # required before `npm run qa:overflow`
|
npx playwright install --with-deps chromium # required before `npm run qa:overflow`
|
||||||
```
|
```
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
"build": "astro build",
|
"build": "astro build",
|
||||||
"preview": "astro preview",
|
"preview": "astro preview",
|
||||||
"qa:no-js": "node scripts/check-no-js.mjs",
|
"qa:no-js": "node scripts/check-no-js.mjs",
|
||||||
"qa:overflow": "node scripts/check-overflow.mjs",
|
"qa:overflow": "node scripts/install-playwright-deps.mjs && node scripts/check-overflow.mjs",
|
||||||
"qa": "npm run typecheck && npm run lint && npm run build && npm run qa:no-js && npm run qa:overflow"
|
"qa": "npm run typecheck && npm run lint && npm run build && npm run qa:no-js && npm run qa:overflow"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
||||||
32
scripts/install-playwright-deps.mjs
Normal file
32
scripts/install-playwright-deps.mjs
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
import { spawnSync } from 'node:child_process';
|
||||||
|
import { existsSync } from 'node:fs';
|
||||||
|
import { chromium } from 'playwright';
|
||||||
|
|
||||||
|
const isLinux = process.platform === 'linux';
|
||||||
|
|
||||||
|
if (!isLinux) {
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
const executablePath = chromium.executablePath();
|
||||||
|
let needsInstall = !existsSync(executablePath);
|
||||||
|
|
||||||
|
if (!needsInstall) {
|
||||||
|
const ldd = spawnSync('ldd', [executablePath], { encoding: 'utf8' });
|
||||||
|
const output = `${ldd.stdout ?? ''}${ldd.stderr ?? ''}`;
|
||||||
|
needsInstall = ldd.status !== 0 || output.includes('not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!needsInstall) {
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = spawnSync('playwright', ['install', '--with-deps', 'chromium'], {
|
||||||
|
stdio: 'inherit',
|
||||||
|
});
|
||||||
|
|
||||||
|
if (result.error) {
|
||||||
|
throw result.error;
|
||||||
|
}
|
||||||
|
|
||||||
|
process.exit(result.status ?? 1);
|
||||||
Loading…
Add table
Add a link
Reference in a new issue