mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 22:22:53 +03:00
28 lines
882 B
JavaScript
28 lines
882 B
JavaScript
|
// Copyright (c) Microsoft Corporation.
|
||
|
// Licensed under the MIT license.
|
||
|
|
||
|
const child_process = require('child_process');
|
||
|
const path = require('path');
|
||
|
|
||
|
const files = [
|
||
|
path.join('src', 'injected', 'cssSelectorEngine.webpack.config.js'),
|
||
|
path.join('src', 'injected', 'xpathSelectorEngine.webpack.config.js'),
|
||
|
path.join('src', 'injected', 'injected.webpack.config.js'),
|
||
|
];
|
||
|
|
||
|
function runOne(runner, file) {
|
||
|
return runner('npx', ['webpack', '--config', file, ...process.argv.slice(2)], { stdio: 'inherit', shell: true });
|
||
|
}
|
||
|
|
||
|
const args = process.argv.slice(2);
|
||
|
if (args.includes('--watch')) {
|
||
|
const spawns = files.map(file => runOne(child_process.spawn, file));
|
||
|
process.on('exit', () => spawns.forEach(s => s.kill()));
|
||
|
} else {
|
||
|
for (const file of files) {
|
||
|
const out = runOne(child_process.spawnSync, file);
|
||
|
if (out.status)
|
||
|
process.exit(out.status);
|
||
|
}
|
||
|
}
|