Skip to content

Commit

Permalink
feat: Notify user of deprecated pdfFormat param.
Browse files Browse the repository at this point in the history
  • Loading branch information
jafin committed May 2, 2022
1 parent 577975a commit ab95a98
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ program
'set margin around PDF file',
generatePuppeteerPDFMargin,
)
.option('--pdfFormat <format>', 'pdf format ex: A3, A4...')
.option('--pdfFormat <format>', '(DEPRECATED use paperFormat)') //TODO: Remove at next major version, replaced by paperFormat
.option('--paperFormat <format>', 'pdf format ex: A3, A4...')
.option('--coverTitle <title>', 'title for PDF cover')
.option('--coverImage <src>', 'image for PDF cover. *.svg file not working!')
.option('--disableTOC', 'disable table of contents')
Expand All @@ -51,6 +52,10 @@ program
'wait for document render in milliseconds',
)
.action((options: generatePDFOptions) => {
if (options.pdfFormat) {
console.log(chalk.red('--pdfFormat is deprecated, use --paperFormat'));
process.exit(1);
}
generatePDF(options)
.then(() => {
console.log(chalk.green('Finish generating PDF!'));
Expand Down
2 changes: 2 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export interface generatePDFOptions {
pdfMargin: puppeteer.PDFOptions['margin'];
contentSelector: string;
paginationSelector: string;
// deprecated - user paperFormat
pdfFormat?: puppeteer.PaperFormat;
paperFormat: puppeteer.PaperFormat;
excludeSelectors: Array<string>;
cssStyle: string;
Expand Down

0 comments on commit ab95a98

Please sign in to comment.