From 2a3f015f07afb16075ba2a0e485d51202f663d94 Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Thu, 28 Dec 2017 08:57:50 -0500 Subject: [PATCH] Update publish function --- scripts/tasks/publish.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/tasks/publish.ts b/scripts/tasks/publish.ts index 854596bd..df76ea7c 100644 --- a/scripts/tasks/publish.ts +++ b/scripts/tasks/publish.ts @@ -63,12 +63,18 @@ function prepare() { }); } -function publish() { - // TODO apply queue system so it doesn't publish everything at once - PACKAGES.forEach((pkg: string) => { - console.log('Going to run the following command: ', `npm publish ${ pkg } ${ FLAGS }`); - // exec(`npm publish ${ pkg } ${ FLAGS }`); - }); +async function publish() { + // TODO apply queue system to process them concurrently + for (let pkg of PACKAGES) { + // console.log('Going to run the following command: ', `npm publish ${ pkg } ${ FLAGS }`); + await new Promise((resolve, reject) => { + exec(`npm publish ${ pkg } ${ FLAGS }`, (err, stdout, stderr) => { + if (err) reject(err); + if (stderr) reject(stderr); + if (stdout) resolve(stdout); + }); + }); + } } prepare();