From 1060b5a12ad7591b1a3250c27214d32fde154ffe Mon Sep 17 00:00:00 2001 From: YongGit <1013588891@qq.com> Date: Mon, 24 Oct 2022 15:40:41 +0800 Subject: [PATCH 1/4] fix: the build end task does not exit When I used automated building, I found that vitepress did not quit the task at the end of the construction, causing the subsequent process --- src/node/build/build.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/node/build/build.ts b/src/node/build/build.ts index 59f4fb122ae..018d13a024b 100644 --- a/src/node/build/build.ts +++ b/src/node/build/build.ts @@ -105,6 +105,7 @@ export async function build( await siteConfig.buildEnd?.(siteConfig) console.log(`build complete in ${((Date.now() - start) / 1000).toFixed(2)}s.`) + process.exit(0); } function linkVue() { From 26b288c939ad9705da3e4e41e4b68eb773ccb38e Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Mon, 24 Oct 2022 13:57:16 +0530 Subject: [PATCH 2/4] chore: format --- 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 018d13a024b..7f142b5b068 100644 --- a/src/node/build/build.ts +++ b/src/node/build/build.ts @@ -105,7 +105,7 @@ export async function build( await siteConfig.buildEnd?.(siteConfig) console.log(`build complete in ${((Date.now() - start) / 1000).toFixed(2)}s.`) - process.exit(0); + process.exit(0) } function linkVue() { From e1a0c954ba274a4bbc26f95a242a91b1f06da879 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Mon, 24 Oct 2022 13:58:44 +0530 Subject: [PATCH 3/4] 0 is default --- 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 7f142b5b068..15468878b4f 100644 --- a/src/node/build/build.ts +++ b/src/node/build/build.ts @@ -105,7 +105,7 @@ export async function build( await siteConfig.buildEnd?.(siteConfig) console.log(`build complete in ${((Date.now() - start) / 1000).toFixed(2)}s.`) - process.exit(0) + process.exit() } function linkVue() { From 0ff0156b197f67d5122c5126bf6d7f3c996e0cf0 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Mon, 24 Oct 2022 14:11:24 +0530 Subject: [PATCH 4/4] fix: exit on cli instead of build fn --- .gitignore | 1 + src/node/build/build.ts | 1 - src/node/cli.ts | 12 ++++++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index c72914019b1..b0bd43cf04f 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ pnpm-global TODOs.md .temp *.tgz +examples-temp diff --git a/src/node/build/build.ts b/src/node/build/build.ts index 15468878b4f..59f4fb122ae 100644 --- a/src/node/build/build.ts +++ b/src/node/build/build.ts @@ -105,7 +105,6 @@ export async function build( await siteConfig.buildEnd?.(siteConfig) console.log(`build complete in ${((Date.now() - start) / 1000).toFixed(2)}s.`) - process.exit() } function linkVue() { diff --git a/src/node/cli.ts b/src/node/cli.ts index 0d992fab8e4..1d95c3e7358 100644 --- a/src/node/cli.ts +++ b/src/node/cli.ts @@ -28,10 +28,14 @@ if (!command || command === 'dev') { process.exit(1) }) } else if (command === 'build') { - build(root, argv).catch((err) => { - console.error(c.red(`build error:\n`), err) - process.exit(1) - }) + build(root, argv) + .then(() => { + process.exit() + }) + .catch((err) => { + console.error(c.red(`build error:\n`), err) + process.exit(1) + }) } else if (command === 'serve') { serve(argv).catch((err) => { console.error(c.red(`failed to start server. error:\n`), err)