Skip to content

Commit 1155ed9

Browse files
fix: #14
1 parent e598452 commit 1155ed9

File tree

1 file changed

+6
-2
lines changed
  • packages/vuepress-plugin-export-pdf-core/src/utils

1 file changed

+6
-2
lines changed

packages/vuepress-plugin-export-pdf-core/src/utils/mergePDF.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { join, relative } from "node:path";
22
import type { Buffer } from "node:buffer";
33
import fse from "fs-extra";
44
import { mergePDFs } from "@condorhero/merge-pdfs";
5+
import pc from "picocolors";
56
import pdf from "pdfjs";
6-
77
export interface NormalizePage {
88
location: string
99
pagePath: string
@@ -28,7 +28,11 @@ export const mergePDF = async (
2828
outDir && fse.ensureDirSync(saveDirPath);
2929
const saveFilePath = join(saveDirPath, outFile);
3030

31-
if (pages.length === 1) {
31+
if (pages.length === 0) {
32+
process.stdout.write(pc.red("The website has no pages, please check whether the export path is set correctly"));
33+
process.exit(1);
34+
}
35+
else if (pages.length === 1) {
3236
fse.moveSync(pages[0].pagePath, saveFilePath, { overwrite: true });
3337
}
3438
else {

0 commit comments

Comments
 (0)