2024-02-11 22:37:25 -06:00
|
|
|
const {join, relative} = require('path');
|
2024-02-04 13:55:14 -06:00
|
|
|
|
|
|
|
const {processCode, spawnWith} = require('@flecks/core/src/server');
|
|
|
|
const {glob} = require('glob');
|
|
|
|
|
2024-02-09 01:11:27 -06:00
|
|
|
const concurrent = require('./concurrent');
|
|
|
|
|
2024-02-04 13:55:14 -06:00
|
|
|
const {
|
|
|
|
FLECKS_CORE_ROOT = process.cwd(),
|
|
|
|
} = process.env;
|
|
|
|
|
2024-02-09 01:11:27 -06:00
|
|
|
const args = process.argv.slice(2);
|
2024-02-04 13:55:14 -06:00
|
|
|
const {workspaces} = require(join(FLECKS_CORE_ROOT, 'package.json'));
|
|
|
|
|
|
|
|
(async () => {
|
2024-02-09 01:11:27 -06:00
|
|
|
process.exitCode = await concurrent(
|
|
|
|
(await Promise.all(workspaces.map((path) => glob(join(FLECKS_CORE_ROOT, path))))).flat(),
|
2024-02-11 22:37:25 -06:00
|
|
|
async (cwd) => {
|
|
|
|
console.log(`::group::{${relative(FLECKS_CORE_ROOT, cwd)}}`);
|
|
|
|
const code = await processCode(spawnWith(args, {cwd}));
|
|
|
|
console.log(`::endgroup::{${relative(FLECKS_CORE_ROOT, cwd)}}`);
|
|
|
|
return code;
|
|
|
|
},
|
2024-02-09 01:11:27 -06:00
|
|
|
);
|
2024-02-04 13:55:14 -06:00
|
|
|
})();
|