2026-03-10 22:28:37 -06:00
|
|
|
#!/usr/bin/env node
|
2026-03-12 09:18:13 -06:00
|
|
|
|
|
|
|
|
import { exec as execCb } from 'child_process'
|
2026-03-11 01:10:13 -06:00
|
|
|
import { dirname, resolve } from 'path'
|
2026-03-12 09:18:13 -06:00
|
|
|
import { fileURLToPath } from 'url'
|
2026-03-10 22:28:37 -06:00
|
|
|
|
2026-03-11 01:10:13 -06:00
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
2026-03-12 09:18:13 -06:00
|
|
|
const cwd = resolve(__dirname, '..')
|
2026-03-16 21:35:04 -06:00
|
|
|
const shouldSkip =
|
2026-03-14 13:28:14 -05:00
|
|
|
process.env.PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD === '1' ||
|
|
|
|
|
process.env.PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD === 'true'
|
2026-03-12 09:18:13 -06:00
|
|
|
|
2026-03-16 21:35:04 -06:00
|
|
|
function run(cmd) {
|
2026-03-12 09:18:13 -06:00
|
|
|
return new Promise((resolve) => {
|
2026-03-16 21:35:04 -06:00
|
|
|
execCb(cmd, { cwd }, (error, stdout, stderr) => {
|
|
|
|
|
resolve({ ok: !error, stdout, stderr })
|
2026-03-12 09:18:13 -06:00
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
2026-03-11 01:10:13 -06:00
|
|
|
|
2026-03-16 21:35:04 -06:00
|
|
|
if (!shouldSkip) {
|
|
|
|
|
await run('npx playwright install chromium')
|
|
|
|
|
}
|