New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

git-label-cli

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-label-cli - npm Package Compare versions

Comparing version
2.0.0
to
3.0.0
+3
-5
dist/index.js

@@ -8,4 +8,2 @@ #!/usr/bin/env node

var _gitLabel = require('git-label');
var _run = require('./util/run');

@@ -15,12 +13,12 @@

_commander2.default.option('-i, --interactive', 'run in interactive mode').option('-a, --api <api>', 'api url').option('-t, --token <token>', 'api token').option('-r, --repo <repo>', 'repo name [username/repo]').option('-p, --packages <glob>', 'globbing pattern to the package file(s)');
_commander2.default.option('-i, --interactive', 'run in interactive mode').option('-a, --api <api>', 'api url').option('-t, --token <token>', 'api token').option('-r, --repo <repo>', 'repo name [username/repo]').option('-p, --pattern <glob>', 'globbing pattern to the label packages');
_commander2.default.command('add').description('Add the specified labels to a repo').action(function () {
return (0, _run.run)(_gitLabel.add, _commander2.default.interactive, _commander2.default).then(console.log).catch(console.log);
return (0, _run.run)('add', _commander2.default.interactive, _commander2.default).then(console.log).catch(console.log);
});
_commander2.default.command('remove').description('Remove the specified labels from a repo').action(function () {
return (0, _run.run)(_gitLabel.remove, _commander2.default.interactive, _commander2.default).then(console.log).catch(console.log);
return (0, _run.run)('remove', _commander2.default.interactive, _commander2.default).then(console.log).catch(console.log);
});
_commander2.default.parse(process.argv);

@@ -28,3 +28,3 @@ 'use strict';

}
}, { type: "input", name: "token", message: "api token" }, { type: "input", name: "packages", message: "path to a label package" }];
}, { type: "input", name: "token", message: "api token" }, { type: "input", name: "pattern", message: "globbing pattern to the label packages" }];

@@ -36,7 +36,7 @@ return new Promise(function (resolve, reject) {

var token = _ref.token;
var packages = _ref.packages;
var pattern = _ref.pattern;
resolve({ server: { api: api, repo: repo, token: token }, packages: packages });
resolve({ server: { api: api, repo: repo, token: token }, pattern: pattern });
});
});
}

@@ -8,3 +8,3 @@ 'use strict';

var _package = require('../lib/package');
var _gitLabel = require('git-label');

@@ -24,3 +24,3 @@ var _prompt = require('../lib/prompt');

* @param {String} options.server.repo the git repo to manipulate
* @param {Array} options.packages globbing pattern to the package file(s)
* @param {Array} options.pattern globbing pattern to the label packages
*/

@@ -31,13 +31,14 @@ function run(type, interactive, _ref) {

var repo = _ref.repo;
var packages = _ref.packages;
var pattern = _ref.pattern;
var fn = type === 'add' ? _gitLabel.add : _gitLabel.remove;
if (interactive) {
return (0, _prompt.prompt)().then(function (_ref2) {
var packages = _ref2.packages;
var server = _ref2.server;
return (0, _package.find)(packages).then(type.bind(null, server));
var pattern = _ref2.pattern;
return (0, _gitLabel.find)(pattern).then(fn.bind(null, server));
});
}
return (0, _package.find)(packages).then(type.bind(null, { api: api, token: token, repo: repo }));
return (0, _gitLabel.find)(pattern).then(fn.bind(null, { api: api, token: token, repo: repo }));
}
{
"name": "git-label-cli",
"description": "CLI utility for git-label",
"version": "2.0.0",
"version": "3.0.0",
"homepage": "https://github.com/jasonbellamy",

@@ -34,3 +34,3 @@ "author": {

"commander": "^2.9.0",
"git-label": "^4.0.0",
"git-label": "^4.1.0",
"glob": "^6.0.3",

@@ -37,0 +37,0 @@ "inquirer": "^0.11.1"

@@ -26,8 +26,8 @@ # git-label-cli

-h, --help output usage information
-i, --interactive run in interactive mode
-a, --api <api> api url
-t, --token <token> api token
-r, --repo <repo> repo name [username/repo]
-p, --packages <glob> globbing pattern to the package file(s)
-h, --help output usage information
-i, --interactive run in interactive mode
-a, --api <api> api url
-t, --token <token> api token
-r, --repo <repo> repo name [username/repo]
-p, --pattern <glob> globbing pattern to the label packages
```

@@ -34,0 +34,0 @@

#!/usr/bin/env node
import program from 'commander';
import {add, remove} from 'git-label';
import {run} from './util/run';

@@ -13,3 +12,3 @@

.option('-r, --repo <repo>', 'repo name [username/repo]')
.option('-p, --packages <glob>', 'globbing pattern to the package file(s)');
.option('-p, --pattern <glob>', 'globbing pattern to the label packages');

@@ -19,3 +18,3 @@ program

.description('Add the specified labels to a repo')
.action(() => run(add, program.interactive, program).then(console.log).catch(console.log));
.action(() => run('add', program.interactive, program).then(console.log).catch(console.log));

@@ -25,4 +24,4 @@ program

.description('Remove the specified labels from a repo')
.action(() => run(remove, program.interactive, program).then(console.log).catch(console.log));
.action(() => run('remove', program.interactive, program).then(console.log).catch(console.log));
program.parse(process.argv);

@@ -20,10 +20,10 @@ import inquirer from 'inquirer';

{type: "input", name: "token", message: "api token"},
{type: "input", name: "packages", message: "path to a label package"}
{type: "input", name: "pattern", message: "globbing pattern to the label packages"}
];
return new Promise((resolve, reject) => {
inquirer.prompt(questions, ({api, repo, token, packages}) => {
resolve({server: {api, repo, token}, packages});
inquirer.prompt(questions, ({api, repo, token, pattern}) => {
resolve({server: {api, repo, token}, pattern});
});
});
}

@@ -1,2 +0,2 @@

import {find} from '../lib/package';
import {add, remove, find} from 'git-label';
import {prompt} from '../lib/prompt';

@@ -16,10 +16,11 @@

* @param {String} options.server.repo the git repo to manipulate
* @param {Array} options.packages globbing pattern to the package file(s)
* @param {Array} options.pattern globbing pattern to the label packages
*/
export function run(type, interactive, {api, token, repo, packages}) {
export function run(type, interactive, {api, token, repo, pattern}) {
const fn = type === 'add' ? add : remove;
if (interactive) {
return prompt().then(({packages, server}) => find(packages).then(type.bind(null, server)));
return prompt().then(({server, pattern}) => find(pattern).then(fn.bind(null, server)));
}
return find(packages).then(type.bind(null, {api, token, repo}));
return find(pattern).then(fn.bind(null, {api, token, repo}));
}
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.findPackages = findPackages;
exports.readPackages = readPackages;
exports.readPackage = readPackage;
exports.find = find;
var _fs = require('fs');
var _glob = require('glob');
/**
* Takes a glob and returns a list of label package files
*
* @name findPackages
* @function
* @param {String} path a globbing pattern
* @return {Promise} array containing any found label packages
*/
function findPackages(path) {
return new Promise(function (resolve, reject) {
(0, _glob.glob)(path, function (err, res) {
if (err) {
reject(err);
}
resolve(res.filter(function (file) {
return file.endsWith('.json');
}));
});
});
};
/**
* Processes a list of packages and concatenates their contents into a single object.
*
* @name readPackages
* @function
* @param {Array} packages array of paths to package files
* @return {Promise}
*/
function readPackages() {
var packages = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
return Promise.all(packages.map(readPackage)).then(function (labels) {
return labels.reduce(function (prev, curr) {
return prev.concat(curr);
});
});
}
/**
* Reads and returns the contents of a package file
*
* @name readPackage
* @function
* @param {String} path the path of the file to read
* @return {Promise}
*/
function readPackage(path) {
return new Promise(function (resolve, reject) {
(0, _fs.readFile)(path, 'utf8', function (err, res) {
if (err) {
reject(err);
}
resolve(JSON.parse(res));
});
});
}
/**
* Finds and gets the labels from package files
*
* @name find
* @function
* @param {String} path a globbing pattern to the package file(s)
* @return {Promise} an array of label objects
*/
function find(path) {
return findPackages(path).then(readPackages);
}
import {readFile} from 'fs';
import {glob} from 'glob';
/**
* Takes a glob and returns a list of label package files
*
* @name findPackages
* @function
* @param {String} path a globbing pattern
* @return {Promise} array containing any found label packages
*/
export function findPackages(path) {
return new Promise((resolve, reject) => {
glob(path, function (err, res) {
if (err) { reject(err); }
resolve(res.filter(file => file.endsWith('.json')));
});
});
};
/**
* Processes a list of packages and concatenates their contents into a single object.
*
* @name readPackages
* @function
* @param {Array} packages array of paths to package files
* @return {Promise}
*/
export function readPackages(packages = []) {
return Promise
.all(packages.map(readPackage))
.then(labels => labels.reduce((prev, curr) => prev.concat(curr)))
}
/**
* Reads and returns the contents of a package file
*
* @name readPackage
* @function
* @param {String} path the path of the file to read
* @return {Promise}
*/
export function readPackage(path) {
return new Promise((resolve, reject) => {
readFile(path, 'utf8', (err, res) => {
if (err) { reject(err); }
resolve(JSON.parse(res));
});
});
}
/**
* Finds and gets the labels from package files
*
* @name find
* @function
* @param {String} path a globbing pattern to the package file(s)
* @return {Promise} an array of label objects
*/
export function find(path) {
return findPackages(path).then(readPackages);
}