From a15140eedb713f14d0ad3b4fe24c485528fdce0c Mon Sep 17 00:00:00 2001 From: Sanjaiyan Parthipan Date: Sun, 11 Sep 2022 18:26:05 +0530 Subject: [PATCH 1/3] sanjaiyan: async parallel --- src/node/build/build.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/node/build/build.ts b/src/node/build/build.ts index 3de81d06c727..17d527593c35 100644 --- a/src/node/build/build.ts +++ b/src/node/build/build.ts @@ -65,8 +65,8 @@ export async function build( const pages = ['404.md', ...siteConfig.pages] - for (const page of pages) { - await renderPage( + await Promise.allSettled( + pages.map((page) => renderPage( render, siteConfig, page, @@ -75,8 +75,8 @@ export async function build( cssChunk, pageToHashMap, hashMapString - ) - } + )) + ) } catch (e) { spinner.stopAndPersist({ symbol: failMark From 0571fe0971b8071b17d387e060078b155a1c499b Mon Sep 17 00:00:00 2001 From: Sanjaiyan Parthipan Date: Mon, 12 Sep 2022 00:36:04 +0530 Subject: [PATCH 2/3] convert to Promise.all --- src/node/build/build.ts | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/node/build/build.ts b/src/node/build/build.ts index 17d527593c35..a48a10a5576c 100644 --- a/src/node/build/build.ts +++ b/src/node/build/build.ts @@ -65,17 +65,19 @@ export async function build( const pages = ['404.md', ...siteConfig.pages] - await Promise.allSettled( - pages.map((page) => renderPage( - render, - siteConfig, - page, - clientResult, - appChunk, - cssChunk, - pageToHashMap, - hashMapString - )) + await Promise.all( + pages.map((page) => + renderPage( + render, + siteConfig, + page, + clientResult, + appChunk, + cssChunk, + pageToHashMap, + hashMapString + ) + ) ) } catch (e) { spinner.stopAndPersist({ @@ -114,5 +116,5 @@ function linkVue(root: string) { fs.unlinkSync(dest) } } - return () => {} + return () => { } } From e4c140e3a5a41803949cea6d109787518587dccc Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Mon, 12 Sep 2022 01:35:09 +0530 Subject: [PATCH 3/3] Update src/node/build/build.ts --- src/node/build/build.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/build/build.ts b/src/node/build/build.ts index a48a10a5576c..853cc1a3cf11 100644 --- a/src/node/build/build.ts +++ b/src/node/build/build.ts @@ -116,5 +116,5 @@ function linkVue(root: string) { fs.unlinkSync(dest) } } - return () => { } + return () => {} }