chore(build): add --install watch flag for automatic browser install (#35639)

This commit is contained in:
Adam Gastineau 2025-04-17 05:19:48 -07:00 committed by GitHub
parent 53abf161b0
commit 2ece112cb3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -63,6 +63,7 @@ const copyFiles = [];
const watchMode = process.argv.slice(2).includes('--watch'); const watchMode = process.argv.slice(2).includes('--watch');
const lintMode = process.argv.slice(2).includes('--lint'); const lintMode = process.argv.slice(2).includes('--lint');
const withSourceMaps = process.argv.slice(2).includes('--sourcemap') || watchMode; const withSourceMaps = process.argv.slice(2).includes('--sourcemap') || watchMode;
const installMode = process.argv.slice(2).includes('--install');
const ROOT = path.join(__dirname, '..', '..'); const ROOT = path.join(__dirname, '..', '..');
/** /**
@ -405,6 +406,15 @@ onChanges.push({
script: 'utils/generate_types/index.js', script: 'utils/generate_types/index.js',
}); });
if (installMode) {
// Keep browser installs up to date.
onChanges.push({
inputs: ['packages/playwright-core/browsers.json'],
command: 'npx',
args: ['playwright', 'install'],
});
}
// The recorder and trace viewer have an app_icon.png that needs to be copied. // The recorder and trace viewer have an app_icon.png that needs to be copied.
copyFiles.push({ copyFiles.push({
files: 'packages/playwright-core/src/server/chromium/*.png', files: 'packages/playwright-core/src/server/chromium/*.png',