Skip to content

Commit

Permalink
Upgrade commander
Browse files Browse the repository at this point in the history
- In version 7 there was a breaking change
  https://github.com/tj/commander.js/blob/master/CHANGELOG.md#700-2021-01-15
- By default, options are no longer available on program
  tj/commander.js#1409
- Updated code to follow the quick start example
  https://github.com/tj/commander.js#quick-start
  • Loading branch information
maxwell-k committed Jun 20, 2022
1 parent 14e8151 commit 691574e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
7 changes: 4 additions & 3 deletions a4.js
Expand Up @@ -65,6 +65,7 @@ if (flagged) {
}

(async () => {
const options = program.opts();
const browser = await puppeteer.launch({
executablePath: paths.filter(existsSync)[0],
});
Expand All @@ -75,12 +76,12 @@ if (flagged) {
await page.pdf({
...{
path: pdf,
format: program.format,
landscape: program.landscape || false,
format: options.format,
landscape: options.landscape || false,
/* margins set to 25mm to match Microsoft Word Online defaults */
margin: { top: "25mm", right: "25mm", bottom: "25mm", left: "25mm" },
},
...(program.number ? numbering : {}),
...(options.number ? numbering : {}),
});

await browser.close();
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -25,7 +25,7 @@
"homepage": "https://github.com/maxwell-k/a4#readme",
"bin": "a4.js",
"dependencies": {
"commander": "^6.2.1",
"commander": "^9.3.0",
"puppeteer-core": "^14.4.1"
},
"resolutions": {
Expand Down

0 comments on commit 691574e

Please sign in to comment.