1
0

Parallelize plug builds

This commit is contained in:
Zef Hemel 2022-11-28 11:42:27 +01:00
parent 19e5d8f21d
commit cab0c5aa23

View File

@ -121,7 +121,6 @@ export async function bundleRun(
watch: boolean, watch: boolean,
options: CompileOptions = {}, options: CompileOptions = {},
) { ) {
// console.log("Args", arguments);
let building = false; let building = false;
async function buildAll() { async function buildAll() {
if (building) { if (building) {
@ -130,7 +129,9 @@ export async function bundleRun(
console.log("Building", manifestFiles); console.log("Building", manifestFiles);
building = true; building = true;
Deno.mkdirSync(dist, { recursive: true }); Deno.mkdirSync(dist, { recursive: true });
for (const plugManifestPath of manifestFiles) { const startTime = Date.now();
// Build all plugs in parallel
await Promise.all(manifestFiles.map(async (plugManifestPath) => {
const manifestPath = plugManifestPath as string; const manifestPath = plugManifestPath as string;
try { try {
await buildManifest( await buildManifest(
@ -141,8 +142,8 @@ export async function bundleRun(
} catch (e) { } catch (e) {
console.error(`Error building ${manifestPath}:`, e); console.error(`Error building ${manifestPath}:`, e);
} }
} }));
console.log("Done building plugs."); console.log(`Done building plugs in ${Date.now() - startTime}ms`);
building = false; building = false;
} }