opencollective
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "opencollective", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Official Command Line Interface for Open Collective", | ||
@@ -12,3 +12,3 @@ "main": "index.js", | ||
"test": "npm run clean && npm run build && mocha test --require babel-core/register", | ||
"clean": "rm -rf dist && rm -rf test/*package*/node_modules && git checkout test/*package*/package.json", | ||
"clean": "rm -rf dist && rm -rf test/*package*/node_modules && git checkout test/*package*/package.json || exit 0", | ||
"build": "babel --copy-files -d dist/ src/", | ||
@@ -43,5 +43,5 @@ "prepare": "npm run build" | ||
"babel-cli": "6.24.1", | ||
"babel-core": "6.24.1", | ||
"babel-polyfill": "6.23.0", | ||
"babel-preset-es2015": "6.24.1", | ||
"babel-preset-node6": "11.0.0", | ||
"babel-preset-stage-0": "6.24.1", | ||
@@ -48,0 +48,0 @@ "babel-register": "6.14.0", |
@@ -1,13 +0,29 @@ | ||
# Open Collective | ||
# opencollective-cli | ||
![](https://ci.appveyor.com/api/projects/status/5mf75q34cpr74s53?svg=true) | ||
Official node module for Open Collective. | ||
Command Line Interface for Open Collective. | ||
$ opencollective postinstall [--plain] | ||
## Install | ||
$ npm install -g opencollective | ||
Reads the details of your collective in your `package.json` and invite the user to donate after installing your package. | ||
This will populate a `opencollective` (and its shortcut `oc`) as a command line. | ||
You can also add this as a dependency in your `package.json` to automatically show the `postinstall` donate message: | ||
$ npm install --save opencollective | ||
Then run | ||
$ opencollective setup | ||
## Commands | ||
$ opencollective [collective] [info|stats] | ||
Interactive setup to add your collective info into your `package.json` and add the backers/sponsors badge and avatars in your `README.md`. | ||
Shows the latest stats of the collective (number of contributors, number of backers, annual budget and current balance). | ||
![](https://cl.ly/1n2u281p2o1k/Screen%20Shot%202017-05-01%20at%204.41.58%20PM.png) | ||
$ opencollective [collective] donate [amount] [frequency] | ||
@@ -17,6 +33,16 @@ | ||
$ open collective [collective] info|stats | ||
$ opencollective postinstall [--plain] | ||
Shows the latest stats of the collective (number of contributors, number of backers, annual budget and current balance). | ||
Reads the details of your collective in the `package.json` of the current directory and invite the user to donate after installing your package. | ||
Add this command in the `postinstall` script of your `package.json`. | ||
![](https://cl.ly/0u2a0z0Y3X37/Screen%20Shot%202017-03-24%20at%202.37.46%20PM.png) | ||
If you add the `--plain` option, it won't show any emoji and ascii art (better for old terminals). | ||
$ opencollective setup | ||
Interactive setup to add your collective info into your `package.json` and add the backers/sponsors badge and avatars in your `README.md`. | ||
## Coming soon | ||
@@ -23,0 +49,0 @@ |
@@ -8,2 +8,4 @@ #!/usr/bin/env node | ||
import 'babel-polyfill'; | ||
// Native | ||
@@ -73,2 +75,2 @@ import { resolve } from 'path'; | ||
// With custom parameter to make "pkg" happy | ||
require(bin, 'may-exclude'); | ||
require(bin, 'may-exclude'); |
@@ -28,4 +28,4 @@ import minimist from 'minimist'; | ||
.catch(function(e) { | ||
console.error("Error caught: ", e); | ||
printFooter(); | ||
debug("Error caught: ", e); | ||
printFooter(collective); | ||
process.exit(0); | ||
@@ -32,0 +32,0 @@ }) |
@@ -1,8 +0,5 @@ | ||
const execSync = require('child_process').execSync; | ||
const chalk = require('chalk'); | ||
const utils = require('../lib/utils'); | ||
import { execSync } from 'child_process'; | ||
import chalk from 'chalk'; | ||
import { padding, formatCurrency } from '../lib/utils'; | ||
const padding = utils.padding; | ||
const formatCurrency = utils.formatCurrency; | ||
const collective_suggested_donation_amount = process.env.npm_package_collective_suggested_donation_amount; | ||
@@ -12,3 +9,3 @@ const collective_suggested_donation_interval = process.env.npm_package_collective_suggested_donation_interval; | ||
function getDonateURL(collective) { | ||
export function getDonateURL(collective) { | ||
var donate_url = collective.url; | ||
@@ -27,3 +24,3 @@ if (collective_suggested_donation_amount) { | ||
const print = function(str, opts) { | ||
export function print(str, opts) { | ||
opts = opts || { color: null, align: 'center'}; | ||
@@ -46,3 +43,3 @@ if (opts.plain) { | ||
const printStats = function(stats, opts) { | ||
export function printStats(stats, opts) { | ||
if (!stats) return; | ||
@@ -55,3 +52,3 @@ print(`Number of contributors: ${stats.contributorsCount}`, opts); | ||
const printLogo = function(logotxt) { | ||
export function printLogo(logotxt) { | ||
if (!logotxt) return; | ||
@@ -67,3 +64,3 @@ logotxt.split('\n').forEach(function(line) { | ||
*/ | ||
const emoji = function(emoji) { | ||
export function emoji(emoji) { | ||
if (process.stdout.isTTY && process.platform === 'darwin') { | ||
@@ -76,3 +73,3 @@ return emoji; | ||
const printFooter = function(collective) { | ||
export function printFooter(collective) { | ||
console.log(""); | ||
@@ -87,9 +84,2 @@ print(`Thanks for installing ${collective.slug} ${emoji('🙏')}`, { color: 'yellow' }); | ||
console.log(""); | ||
} | ||
module.exports = { | ||
print, | ||
printLogo, | ||
printStats, | ||
printFooter | ||
}; | ||
} |
@@ -19,3 +19,4 @@ import fs from 'fs'; | ||
export function isFancyEnvironment() { | ||
return (isDevEnvironment() && process.stdout.isTTY && process.platform !== 'win32'); | ||
const npm_config_node_version = process.env.npm_config_node_version; | ||
return (isDevEnvironment() && process.stdout.isTTY && process.platform !== 'win32' && (!npm_config_node_version || parseInt(npm_config_node_version.substr(0,npm_config_node_version.indexOf('.')))) >= 5); | ||
} | ||
@@ -22,0 +23,0 @@ |
@@ -22,3 +22,3 @@ import { exec } from 'child_process'; | ||
it("runs the postinstall script after npm install", function(done) { | ||
this.timeout(10000); | ||
this.timeout(15000); | ||
var proc = exec("npm install", { cwd: paths.package }, function(err, stdout, stderr) { | ||
@@ -33,4 +33,4 @@ stdout = stdout.toString('utf8'); | ||
it("installs a package that has opencollective-postinstall", function(done) { | ||
this.timeout(8000); | ||
var proc = exec("cross-env DEBUG=postinstall npm install --save " + paths.package, { cwd: paths.parentpackage }, function(err, stdout, stderr) { | ||
this.timeout(15000); | ||
var proc = exec("npm install --save " + paths.package, { cwd: paths.parentpackage }, function(err, stdout, stderr) { | ||
stdout = stdout.toString('utf8'); | ||
@@ -37,0 +37,0 @@ var pkg = JSON.parse(fs.readFileSync(paths.parentpackagejson, 'utf8')); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
0
71
24
5
432152
32
703