What is opencollective-postinstall?
The opencollective-postinstall npm package is designed to display a message after the installation of an npm package. This is typically used by open source projects to encourage users to support their work via Open Collective. It helps maintainers to promote their funding needs directly in the terminal after a user installs their package.
What are opencollective-postinstall's main functionalities?
Display a custom message post-installation
This feature allows package maintainers to display a custom message in the terminal after their package is installed. The message is usually a call to support the project on Open Collective. The code snippet shows how to set up the postinstall script in the package.json file to trigger the opencollective-postinstall command.
{
"scripts": {
"postinstall": "opencollective-postinstall"
}
}
Other packages similar to opencollective-postinstall
funding
Similar to opencollective-postinstall, the 'funding' package is used to display a message about funding options for the package. However, 'funding' allows for more customization in terms of the message content and the funding platforms it supports, making it a more flexible option compared to opencollective-postinstall.
postinstall-postinstall
This package serves a similar purpose by allowing messages or scripts to be run after npm install. While opencollective-postinstall focuses specifically on Open Collective funding messages, postinstall-postinstall can be used for a variety of post-install scripts, not limited to funding appeals.
opencollective-postinstall
Prompt your users to donate to your collective after npm install
Install
npm install opencollective-postinstall --save
In your package.json
, add:
{
...
"collective": {
"type": "opencollective",
"url": "https://opencollective.com/yourcollective_slug" // e.g. https://opencollective.com/webpack
},
"scripts": {
"postinstall": "./bin/opencollective-postinstall [--no-logo]" // if you pass --no-logo, we won't show the Open Collective logo
},
...
}
Suggest a donation amount (optional)
In the "collective" section of your package.json
, add:
{
...
"collective": {
"type": "opencollective",
"url": "https://opencollective.com/yourcollective_slug", // e.g. https://opencollective.com/webpack
"suggested_donation": {
"amount": 2,
"currency": "USD", // must be same currency than your collective's default currency
"interval": "monthly" // or "one-time" or "yearly"
}
}
}
Join the #opensource channel on our slack: https://slack.opencollective.org