2020-01-07 05:22:35 +03:00
|
|
|
/**
|
|
|
|
* Copyright (c) Microsoft Corporation.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2019-11-23 04:27:09 +03:00
|
|
|
|
|
|
|
const child_process = require('child_process');
|
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
const files = [
|
2019-12-12 20:02:37 +03:00
|
|
|
path.join('src', 'injected', 'zsSelectorEngine.webpack.config.js'),
|
2020-03-26 00:08:46 +03:00
|
|
|
path.join('src', 'injected', 'selectorEvaluator.webpack.config.js'),
|
2019-11-23 04:27:09 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|