Socket
Socket
Sign inDemoInstall

opencollective-postinstall

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opencollective-postinstall - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

8

bin/setup.js
#!/usr/bin/env node
// Only run in development environment
if (process.env.NODE_ENV && process.env.NODE_ENV !== 'dev' && process.env.NODE_ENV !== 'development') {
process.exit(0);
}
const fs = require('fs');

@@ -86,3 +92,3 @@ const inquirer = require('inquirer');

}
let postinstall = "./node_modules/.bin/opencollective-postinstall";
let postinstall = "./node_modules/.bin/opencollective-postinstall || exit 0";
if (package.scripts.postinstall && package.scripts.postinstall.indexOf(postinstall) === -1) {

@@ -89,0 +95,0 @@ package.scripts.postinstall = `${package.scripts.postinstall} && ${postinstall}`;

6

package.json
{
"name": "opencollective-postinstall",
"version": "1.0.9",
"version": "1.0.10",
"description": "Prompt users to donate after they install your node module with npm install",

@@ -32,5 +32,7 @@ "main": "index.js",

"chalk": "1.1.3",
"inquirer": "3.0.6",
"node-fetch": "1.6.3"
},
"devDependencies": {
"inquirer": "^3.0.6"
}
}
# opencollective-postinstall
Prompt your users to donate to your collective after `npm install`
![](https://cl.ly/323M3x2Y1J3E/Screen%20Shot%202017-02-22%20at%202.03.58%20AM.png)
![](https://cl.ly/3u182e3B0323/Screen%20Shot%202017-03-14%20at%2010.51.21%20AM.png)
## Install
npm install opencollective-postinstall --save
npm install opencollective-postinstall --save-dev
In your `package.json`, add:
This will run an interactive cli to configure your package.json
Note: because you are adding this in your `devDependencies`, it will only be installed in development enviromnent.
![](https://cl.ly/2k0G1C461A09/Screen%20Shot%202017-03-14%20at%2010.53.36%20AM.png)
In your `package.json`, it will add a new `"collective"` attribute and update the postinstall script.
{

@@ -16,6 +21,7 @@ ...

"type": "opencollective",
"url": "https://opencollective.com/yourcollective_slug" // e.g. https://opencollective.com/webpack
"url": "https://opencollective.com/yourcollective_slug", // e.g. https://opencollective.com/webpack
"logo": "https://opencollective.com/webpack/logo.txt?variant=wide&width=26"
},
"scripts": {
"postinstall": "./node_modules/.bin/opencollective-postinstall"
"postinstall": "./node_modules/.bin/opencollective-postinstall || exit 0"
},

@@ -25,4 +31,22 @@ ...

**Why `|| exit 0` in `scripts.postinstall`?**<br />
Since we are adding the dependency in `devDependencies`, the script `./node_modules/.bin/opencollective-postinstall` won't be installed in production. Therefore, the `postinstall` script will return an error and will interrupt the `npm install` process. Adding `|| exit 0` makes sure that this `postinstall` script always returns true.
## Options
### Customize the ASCII art logo of your collective
You can play with different sizes and variants to get the perfect ASCII art for your collective:
https://opencollective.com/:slug/logo.txt?variant=:string&width=:integer&reverse=:boolean
e.g. https://opencollective.com/webpack/logo.txt?variant=wide&width=26&reverse=false
Possible values for `variant`: `wide`, `ultra-wide`, `variant1`, `variant2`, `variant3`, `variant4`, `blocks`, `bits`, `binary`, `greyscale`, `solid`
You can also change `reverse` to `true`.
### Suggest a donation amount
You can specify a suggested donation amount or a different URL to use for your logo in ascii.

@@ -29,0 +53,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc