Coder Social home page Coder Social logo

opencollective / opencollective-pdf Goto Github PK

View Code? Open in Web Editor NEW
65.0 20.0 36.0 21.24 MB

Open Collective's PDF Server

Home Page: https://opencollective-pdf.vercel.app

License: MIT License

JavaScript 70.75% TypeScript 29.09% Shell 0.16%
opencollective invoices-pdf nodejs gr graphql

opencollective-pdf's Introduction

Open Collective PDF service

Build and Push

Foreword

If you see a step below that could be improved (or is outdated), please update the instructions. We rarely go through this process ourselves, so your fresh pair of eyes and your recent experience with it, makes you the best candidate to improve them for other users. Thank you!

Development

Prerequisite

Make sure you have Node.js version >= 10. We recommend using nvm: nvm use.

Install

We recommend cloning the repository in a folder dedicated to opencollective projects.

git clone [email protected]:opencollective/opencollective-pdf.git opencollective/pdf
cd opencollective/pdf
npm install

Environment variables

This project requires an access to the Open Collective API. You have two options:

  • cp .env.staging .env to connect to the Open Collective staging API
  • cp .env.local .env to connect to the API running locally

If you decide to pick the local strategy, make sure you install and run the opencollective-api project.

Start

To start the service:

npm run dev

Troubleshooting

  • SSL errors

If you get an error like this while trying to generate a PDF:

Error: html-pdf: Unknown Error Auto configuration failed 140673035953984:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot > open shared object file: No such file or directory 140673035953984:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244: 140673035953984:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf 140673035953984:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf

Try adding this line to your .env (source):

OPENSSL_CONF=/dev/null

Usage with fixture data

This is the easy way to start developing. Just go to the root URL http://localhost:3002/ to see a list of test pages and click on any of them to load it in the right pane.

The page will auto-refresh everytime a change is made.

Usage with frontend

If you use this service through local frontend, you will need to add PDF_SERVICE_URL=http://localhost:3002 line to .env. You're ready to go - frontend will pass your authorization token directly to the app.

However this is not practical to develop, you should only use it to debug the bridge between the two services.

Calling URLs directly

This method can be usefull to debug staging or production invoices, or to work with you local development data. It is also the best way if you need to make changes to the graphql queries.

The easier to make it work is to go to /:userSlug/admin/for-developers on the frontend, generate a personal token, and to add ?personalToken=your_key_here to all your requests.

Tips

  • Replace .html by .pdf to see the generated pdf.
  • Add ?pageFormat=A4 with A4 or Letter to change page format
  • Add ?debug=true to the URL to see verbose data on the document
  • Add ?raw=true to disabled HTML sanitazing (useful to debug missing attributes)

Contributing

Code style? Commit convention? Please check our Contributing guidelines.

TL;DR: we use Prettier and ESLint, we do like great commit messages and clean Git history.

Tests

You can run the tests using npm test.

Deployment

Merging to main branch will auto-deploy the pdf service to Heroku.

opencollective-pdf's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opencollective-pdf's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/codeql-analysis.yml
  • actions/checkout v4.1.6
  • github/codeql-action v3
  • github/codeql-action v3
npm
package.json
  • @apollo/client 3.9.6
  • @opencollective/frontend-components 0.5.0
  • @opencollective/taxes 4.1.1
  • @styled-icons/feather 10.47.0
  • babel-plugin-formatjs 10.5.16
  • dayjs 1.11.11
  • dotenv 16.4.5
  • graphql 16.8.1
  • html-pdf ^3.0.1
  • i18n-iso-countries 7.11.1
  • lodash 4.17.21
  • moment 2.30.1
  • next ^12.3.4
  • next-transpile-modules 9.1.0
  • node-fetch 2.7.0
  • pdf-fontkit 1.8.9
  • pdf-lib 1.17.1
  • prop-types 15.8.1
  • qrcode.react 3.1.0
  • react 18.2.0
  • react-dom 18.2.0
  • react-intl 6.6.8
  • sanitize-html 2.13.0
  • styled-components 5.3.11
  • styled-system 5.1.5
  • @babel/core ^7.24.0
  • @babel/eslint-parser ^7.11.0
  • @babel/node ^7.23.9
  • @babel/preset-typescript ^7.23.3
  • @types/node ^20.11.24
  • @types/react ^18.2.61
  • @typescript-eslint/eslint-plugin ^7.1.0
  • @typescript-eslint/parser ^7.1.0
  • babel-plugin-styled-components ^2.0.0
  • codecov ^3.8.2
  • commitizen ^4.3.0
  • cz-conventional-changelog ^3.3.0
  • eslint 8.57.0
  • eslint-config-opencollective ^3.0.0
  • eslint-import-resolver-typescript ^3.6.1
  • eslint-plugin-babel ^5.3.1
  • eslint-plugin-import ^2.23.4
  • eslint-plugin-node ^11.1.0
  • eslint-plugin-react ^7.24.0
  • eslint-plugin-react-hooks ^4.2.0
  • file-loader ^6.2.0
  • jest ^29.7.0
  • jest-junit ^16.0.0
  • jest-styled-components ^7.0.5
  • prettier ^3.0.0
  • react-test-renderer ^18.2.0
  • typescript ^5.3.3
  • url-loader ^4.1.1
  • node 20.x
  • npm 10.x

  • Check this box to trigger a request for Renovate to run again on this repository

An in-range update of styled-system is breaking the build 🚨

The dependency styled-system was updated from 4.0.5 to 4.0.6.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

styled-system is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • now: Now is deploying your app (Details).
  • ci/circleci: build: Your tests failed on CircleCI (Details).

Commits

The new version differs by 8 commits.

  • 92f8000 Edit changelog
  • bcf59eb 4.0.6
  • a29528d Merge pull request #429 from kkir/fix-border-props-sequence
  • 81d63e0 clean-tag v3.0.0
  • b62e49e Merge pull request #410 from StevenLangbroek/feat/clean-tag-terminology
  • c52e292 rearrange borderWidth and borderStyle
  • d43d3ac fix border props sequence
  • 7816e7c feat: rename blacklist to omitProps

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of eslint is breaking the build 🚨

The devDependency eslint was updated from 5.15.3 to 5.16.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ci/circleci: build: Your tests failed on CircleCI (Details).
  • now: Deployment has completed (Details).

Release Notes for v5.16.0
  • dfef227 Build: gensite passes rulesMeta to formatter rendering (#11567) (Kevin Partington)
  • c06d38c Fix: Allow HTML formatter to handle no meta data (#11566) (Ilya Volodin)
  • 87a5c03 Docs: func-style: clarify when allowArrowFunctions is used (#11548) (Oliver Joseph Ash)
  • bc3e427 Update: pass rule meta to formatters RFC 10 (#11551) (Chris Meyer)
  • b452f27 Chore: Update README to pull in reviewer data (#11506) (Nicholas C. Zakas)
  • afe3d25 Upgrade: Bump js-yaml dependency to fix Denial of Service vulnerability (#11550) (Vernon de Goede)
  • 4fe7eb7 Chore: use nyc instead of istanbul (#11532) (Toru Nagashima)
  • f16af43 Chore: fix formatters/table test (#11534) (Toru Nagashima)
  • 78358a8 Docs: fix duplicate punctuation in CLI docs (#11528) (Teddy Katz)
Commits

The new version differs by 11 commits.

  • ded2f94 5.16.0
  • ea36e13 Build: changelog update for 5.16.0
  • dfef227 Build: gensite passes rulesMeta to formatter rendering (#11567)
  • c06d38c Fix: Allow HTML formatter to handle no meta data (#11566)
  • 87a5c03 Docs: func-style: clarify when allowArrowFunctions is used (#11548)
  • bc3e427 Update: pass rule meta to formatters RFC 10 (#11551)
  • b452f27 Chore: Update README to pull in reviewer data (#11506)
  • afe3d25 Upgrade: Bump js-yaml dependency to fix Denial of Service vulnerability (#11550)
  • 4fe7eb7 Chore: use nyc instead of istanbul (#11532)
  • f16af43 Chore: fix formatters/table test (#11534)
  • 78358a8 Docs: fix duplicate punctuation in CLI docs (#11528)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.

An in-range update of eslint-plugin-react is breaking the build 🚨

The devDependency eslint-plugin-react was updated from 7.12.2 to 7.12.3.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint-plugin-react is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ci/circleci: build: Your tests failed on CircleCI (Details).

Release Notes for v7.12.3

Fixed

Changed

Commits

The new version differs by 14 commits.

  • 2f5cec9 Update CHANGELOG and bump version
  • 096161a Merge pull request #2120 from jomasti/issue-2119
  • 9d3955a Prevent crash of jsx-indent rule
  • 230c7e0 Merge pull request #2117 from haideralsh/patch-1
  • b4b0e72 fix: add a missing in the JSON settings
  • d2aa260 Merge pull request #2115 from drx/class_body_prop_types
  • 41974e5 Fix propType detection inside class bodies
  • 40f2565 [Docs] update README to document React version detection
  • dd0757f Merge pull request #2113 from alexzherdev/2112-fix-self-closing-fragments
  • e997f6c [Fix] avoid crashing on self-closing fragments
  • b48b479 Merge pull request #2111 from drx/prop_types_class_properties
  • e15bafa [Fix] no-unused-prop-types: fix issue with propTypes misclassifying props
  • a86b339 Merge pull request #2109 from jomasti/issue-2105
  • 5f9863e Fix display-name false positive for React.memo

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

We have a sorted index on Transaction's ID column to help with calculating the current balance from the balance checkpoint

    We have a sorted index on Transaction's ID column to help with calculating the current balance from the balance checkpoint 

(which uses the max transaction id for a collective). This assumes that we are not back dating transactions from now on, so only id works there.

Here, because we are summing up all transactions and we have some backdated inserts in our history it makes sense to order the sum windows by createdAt.

image

Originally posted by @hdiniz in opencollective/opencollective-api#8372 (comment)

Not working

Permission denied couldn't read from remote repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.