opencollective-postinstall
Advanced tools
Comparing version 1.0.12 to 1.0.13
#!/usr/bin/env node | ||
const utils = require('../lib/utils'); | ||
const debug = utils.debug; | ||
// Only run in development environment | ||
if (process.env.NODE_ENV && process.env.NODE_ENV !== 'dev' && process.env.NODE_ENV !== 'development') { | ||
debug("Wrong environment", process.env.NODE_ENV); | ||
process.exit(0); | ||
} | ||
// In some CI environment, NODE_ENV might not be defined. | ||
@@ -12,14 +17,18 @@ // We exit if `inquirer` module is not installed | ||
} catch(e) { | ||
debug("Can't find inquirer module, exiting"); | ||
process.exit(0); | ||
} | ||
const inquirer = require('inquirer'); | ||
if (typeof inquirer.prompt([]).then !== 'function') { | ||
debug("Wrong version of inquirer, exiting"); | ||
process.exit(0); | ||
} | ||
const fs = require('fs'); | ||
const inquirer = require('inquirer'); | ||
const fetchData = require('../lib/fetchData'); | ||
const print = require('../lib/print'); | ||
const utils = require('../lib/utils'); | ||
const fetchLogo = fetchData.fetchLogo; | ||
const printLogo = print.printLogo; | ||
const debug = utils.debug; | ||
@@ -29,4 +38,4 @@ const parentDir = process.cwd().split('/').slice(-2, -1)[0]; | ||
// No need to run the setup in standalone mode | ||
debug("parent dir", parentDir); | ||
debug("cwd", process.cwd()); | ||
debug(`Parent dir (${parentDir}) is not "node_modules", exiting`); | ||
debug("Current dir (cwd):", process.cwd()); | ||
process.exit(0); | ||
@@ -39,2 +48,3 @@ } | ||
package = JSON.parse(fs.readFileSync(projectPackageJSON, 'utf8')); | ||
debug(`package.json successfully loaded for ${package.name}`); | ||
} catch(e) { | ||
@@ -120,2 +130,6 @@ debug(`Unable to load ${process.cwd()}/${projectPackageJSON}`, e); | ||
return process.exit(0); | ||
}) | ||
.catch(e => { | ||
debug("Error while running the prompt", e); | ||
process.exit(0); | ||
}); | ||
@@ -127,2 +141,6 @@ } | ||
.then(printLogo) | ||
.then(askQuestions); | ||
.then(askQuestions) | ||
.catch(e => { | ||
debug("Error while trying to fetch the open collective logo or running the prompt", e); | ||
process.exit(0) | ||
}); |
{ | ||
"name": "opencollective-postinstall", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "Prompt users to donate after they install your node module with npm install", | ||
@@ -32,7 +32,5 @@ "main": "index.js", | ||
"chalk": "1.1.3", | ||
"node-fetch": "1.6.3" | ||
}, | ||
"devDependencies": { | ||
"node-fetch": "1.6.3", | ||
"inquirer": "^3.0.6" | ||
} | ||
} |
# opencollective-postinstall | ||
Prompt your users to donate to your collective after `npm install` | ||
![](https://cl.ly/0u2a0z0Y3X37/Screen%20Shot%202017-03-24%20at%202.37.46%20PM.png) | ||
You can also add your ASCII art logo: | ||
![](https://cl.ly/3u182e3B0323/Screen%20Shot%202017-03-14%20at%2010.51.21%20AM.png) | ||
@@ -5,0 +8,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
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
17482
0
292
76
3
17
+ Addedinquirer@^3.0.6
+ Addedansi-escapes@3.2.0(transitive)
+ Addedansi-regex@3.0.1(transitive)
+ Addedansi-styles@3.2.1(transitive)
+ Addedchalk@2.4.2(transitive)
+ Addedchardet@0.4.2(transitive)
+ Addedcli-cursor@2.1.0(transitive)
+ Addedcli-width@2.2.1(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedexternal-editor@2.2.0(transitive)
+ Addedfigures@2.0.0(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addediconv-lite@0.4.24(transitive)
+ Addedinquirer@3.3.0(transitive)
+ Addedis-fullwidth-code-point@2.0.0(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedmimic-fn@1.2.0(transitive)
+ Addedmute-stream@0.0.7(transitive)
+ Addedonetime@2.0.1(transitive)
+ Addedos-tmpdir@1.0.2(transitive)
+ Addedrestore-cursor@2.0.0(transitive)
+ Addedrun-async@2.4.1(transitive)
+ Addedrx-lite@4.0.8(transitive)
+ Addedrx-lite-aggregates@4.0.8(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedstring-width@2.1.1(transitive)
+ Addedstrip-ansi@4.0.0(transitive)
+ Addedsupports-color@5.5.0(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedtmp@0.0.33(transitive)