kohheepeace / docusaurus-pdf

Generate PDF for docusaurus
https://drive.google.com/file/d/19P3qSwLLUHYigrxH3QXIMXmRpTFi4pKB/view
113 stars 18 forks source link

feat: support generating PDF from docusaurus build directory #4

Closed maxarndt closed 4 years ago

maxarndt commented 4 years ago

Hey @KohheePeace!

At first thank you for adding me as a contributor. But unfortunately I'm not able to create/push a new branch directly to this repository. Is this by purpose or could you check the permissions?

This PR includes a feature which enables using this tool in a CD pipeline.

I added express to serve the previously built static files (normally by executing npx docusaurus build) and called your generatePdf() function afterwards.

To support this functionality I added the from-build command to commander:

Usage: docusaurus-pdf from-build [options] <dirPath> <firstDocPagePath> [baseUrl]

Generate PDF from a docusaurus build artifact

Options:
  -o, --output-file [name]  Specify your file name. Default is docusaurus.pdf
  -h, --help                output usage information

What do you think about this feature?

kohheepeace commented 4 years ago

Hi @maxarndt, I think you become a contributor because I merged your PR. I sent invitation mail for collaborator.

I will review this PR later ! Looks cool for people who wants to generate PDF during build!

maxarndt commented 4 years ago

Thanks for reviewing, I will fix the typos.

Iā€˜m using Google Cloud Build as CI/CD runner. I could update the docs after the new version is released as npm package. Currently I have to :

  1. git clone the feature branch
  2. npm install
  3. npm run build
  4. run the program with node

So I think it would be much more helpful to illustrate using this program with npx instead with the four steps listed above.

I already figured out that special dependencies in the execution environment are required for puppeteer. Currently Iā€˜m using zenika/alpine-chrome:with-puppeteer image to run this CD step but there are still some issues to fix. I will further analyze this on Tuesday next week. I think it is helpful to suggest a docker image which runs the PDF generation without any problems.

Do you use any CI/CD tools to give it a try?

kohheepeace commented 4 years ago

So I think it would be much more helpful to illustrate using this program with npx instead with the four steps listed above.

=> okay šŸ‘

I will further analyze this on Tuesday next week

=> okay šŸ‘

I think it is helpful to suggest a docker image which runs the PDF generation without any problems.

=> Thanks! šŸ‘

Do you use any CI/CD tools to give it a try?

=> No. but I will try with Netlify.


So, I merge this PR and publish and try during build! Thanks!