Skip to content

Commit

Permalink
add progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Caio-Bessa committed Nov 16, 2020
1 parent ed5de20 commit 0fbb1bb
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ const EJB_SERVER = "EJBServer";
const WEB_CLIENT = "webclient";

const findAndCopyFiles = async (path, baseDir) => {
const files = await glob(path,{silent :true});
console.log("files found", JSON.stringify(files));
const files = await glob(path);
await copyFileToResultsDir(files, baseDir);
};

Expand Down Expand Up @@ -63,8 +62,9 @@ const copyFileToResultsDir = async function (files, baseDir) {
};

const copyJavaRenderers = async ({ webClientComponents }) => {
const files = await glob(webClientComponents + "/**/DomainsConfig.xml",{ silent :true});

const files = await glob(webClientComponents + "/**/DomainsConfig.xml",{ silent :true});
progressBarCli.setTotal( progressBarCli.getTotal() + files.length);
//TODO - Read in parallel - https://stackoverflow.com/questions/37576685/using-async-await-with-a-foreach-loop
return Promise.all(
files.map(async (filePath) => {
Expand All @@ -86,6 +86,7 @@ const copyJavaRenderers = async ({ webClientComponents }) => {
}
}
}
progressBarCli.increment();
})
);
};
Expand All @@ -98,7 +99,11 @@ const run = async () => {
// EjbServer

progressBarCli.start(1, 0);

var start = new Date();





await Promise.all(
[findAndCopyFiles(ejbServerComponents + CSS_FILES_PATTERN, EJB_SERVER),
Expand All @@ -108,6 +113,11 @@ const run = async () => {
copyJavaRenderers({ webClientComponents })
]);
progressBarCli.increment();

var end = new Date();
console.log(`Start ${start}- End: ${end}`);

progressBarCli.stop();
};

run();

0 comments on commit 0fbb1bb

Please sign in to comment.