Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/sample-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"ci:build": "run-s clean build"
},
"devDependencies": {
"@climateinteractive/docs-builder": "workspace:*"
"@climateinteractive/docs-builder": "workspace:*",
"puppeteer": "^25.10.0"
}
}
9 changes: 9 additions & 0 deletions packages/docs-builder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ Once the `.npmrc` file is updated, you can install the package the usual way:
npm install @climateinteractive/docs-builder
```

Note that PDF files are generated using [Puppeteer](https://pptr.dev), which is
declared as a peer dependency so that your project can control which version is
used (many projects already depend on Puppeteer for end-to-end tests), so you
will need to install it alongside `docs-builder`:

```sh
npm install --save-dev puppeteer
```

## Usage

### Command Line
Expand Down
7 changes: 5 additions & 2 deletions packages/docs-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,19 @@
"open": "^11.0.2",
"postcss": "^8.5.6",
"postcss-rtlcss": "^5.7.1",
"puppeteer": "^25.10.0",
"rev-hash": "^3.0.0",
"semver-compare": "^1.0.0",
"sirv": "^3.0.2",
"tinyglobby": "^0.2.15"
},
"peerDependencies": {
"puppeteer": ">=24.0.0"
},
"devDependencies": {
"@types/lunr": "^2.3.4",
"@types/marked": "^4.0.1",
"@types/node": "^22.20.1"
"@types/node": "^22.20.1",
"puppeteer": "^25.10.0"
},
"author": "Climate Interactive",
"license": "MIT",
Expand Down
5 changes: 5 additions & 0 deletions packages/docs-builder/src/gen-pdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import puppeteer from 'puppeteer'

import type { Context } from './context'

/**
* Generate a PDF file from the complete HTML page for the project.
*
* @param context The language-specific context.
*/
export async function writePdfFile(context: Context): Promise<void> {
// Launch a headless browser instance
const browser = await puppeteer.launch({ headless: true })
Expand Down
9 changes: 6 additions & 3 deletions pnpm-lock.yaml

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