opencollective-postinstall
Advanced tools
Comparing version 1.0.9 to 1.0.10
#!/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}`; |
{ | ||
"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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16176
2
267
73
1
11
- Removedinquirer@3.0.6
- Removedansi-escapes@1.4.0(transitive)
- Removedansi-regex@3.0.1(transitive)
- Removedchardet@0.4.2(transitive)
- Removedcli-cursor@2.1.0(transitive)
- Removedcli-width@2.2.1(transitive)
- Removedexternal-editor@2.2.0(transitive)
- Removedfigures@2.0.0(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedinquirer@3.0.6(transitive)
- Removedis-fullwidth-code-point@2.0.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removedmimic-fn@1.2.0(transitive)
- Removedmute-stream@0.0.7(transitive)
- Removedonetime@2.0.1(transitive)
- Removedos-tmpdir@1.0.2(transitive)
- Removedrestore-cursor@2.0.0(transitive)
- Removedrun-async@2.4.1(transitive)
- Removedrx@4.1.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedstring-width@2.1.1(transitive)
- Removedstrip-ansi@4.0.0(transitive)
- Removedthrough@2.3.8(transitive)
- Removedtmp@0.0.33(transitive)