File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
packages/vuepress-plugin-export-pdf-core/src/utils Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ import { join, relative } from "node:path";
2
2
import type { Buffer } from "node:buffer" ;
3
3
import fse from "fs-extra" ;
4
4
import { mergePDFs } from "@condorhero/merge-pdfs" ;
5
+ import pc from "picocolors" ;
5
6
import pdf from "pdfjs" ;
6
-
7
7
export interface NormalizePage {
8
8
location : string
9
9
pagePath : string
@@ -28,7 +28,11 @@ export const mergePDF = async (
28
28
outDir && fse . ensureDirSync ( saveDirPath ) ;
29
29
const saveFilePath = join ( saveDirPath , outFile ) ;
30
30
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 ) {
32
36
fse . moveSync ( pages [ 0 ] . pagePath , saveFilePath , { overwrite : true } ) ;
33
37
}
34
38
else {
You can’t perform that action at this time.
0 commit comments