Comparing version 1.1.1 to 1.2.0
30
index.js
@@ -6,4 +6,3 @@ const chalk = require('chalk'); | ||
module.exports = function (options, cb, errorCb) { | ||
module.exports = function(options, cb, errorCb) { | ||
if (options.stdio === undefined) options.stdio = [0, 1, 2]; | ||
@@ -22,4 +21,3 @@ if (options.suppressLogging === undefined) options.suppressLogging = false; | ||
try { | ||
if (!options.suppressLogging) | ||
console.log(`\n${chalk.cyan(path.basename(options.displayDir))}:`); | ||
if (!options.suppressLogging) console.log(`\n${chalk.cyan(path.basename(options.displayDir))}:`); | ||
@@ -32,35 +30,33 @@ code = execSync(options.cmd, { | ||
} catch (err) { | ||
if (errorCb) errorCb(err); | ||
if (errorCb) errorCb(err); | ||
// if there is no error callback, we're just going to forward the output | ||
let errorMessage = `${chalk.red(path.basename(options.displayDir))}: command '${options.cmd}' exited with error: ${err.toString()}`; | ||
if ( ! options.suppressLogging) console.error(errorMessage); | ||
let errorMessage = `${chalk.red(path.basename(options.displayDir))}: command '${ | ||
options.cmd | ||
}' exited with error: ${err.toString()}`; | ||
if (!options.suppressLogging) console.error(errorMessage); | ||
if (cb) return cb(null, { error: errorMessage }); | ||
return; | ||
} | ||
if (code) { | ||
let errorMessage = `${chalk.red(path.basename(options.displayDir))} '${options.cmd}' exited with code: ${code}`; | ||
if (errorCb) errorCb(new Error(errorMessage)); | ||
if ( ! options.suppressLogging) console.error(errorMessage); | ||
if (!options.suppressLogging) console.error(errorMessage); | ||
if (cb) return cb(null, { err: errorMessage }); | ||
return; | ||
} | ||
} | ||
let success = chalk.green(`${path.basename(options.displayDir)} ✓`); | ||
if ( ! options.suppressLogging) console.log(success); | ||
if (!options.suppressLogging) console.log(success); | ||
if (cb) return cb(null, { output: success }); | ||
}; |
{ | ||
"name": "meta-exec", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "exec plugin for meta for executing synchronous commands to stdout with a standard format", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\"" | ||
"commit": "git-cz", | ||
"lint": "prettier --write \"bin/*\" index.js", | ||
"test": "jest --config jest.json --coverage", | ||
"test:coverage": "jest --config jest.json --coverage", | ||
"test:watch": "jest --config jest.json --watch" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS", | ||
"pre-commit": "pretty-quick --staged" | ||
} | ||
}, | ||
"repository": { | ||
@@ -26,3 +36,13 @@ "type": "git", | ||
"debug": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "8.0.0", | ||
"@commitlint/config-conventional": "8.0.0", | ||
"commitizen": "3.1.1", | ||
"cz-conventional-changelog": "2.1.0", | ||
"husky": "2.4.1", | ||
"jest": "24.8.0", | ||
"prettier": "1.18.2", | ||
"pretty-quick": "1.11.0" | ||
} | ||
} |
@@ -0,2 +1,4 @@ | ||
[![Build Status](https://travis-ci.com/mateodelnorte/meta-exec.svg?branch=master)](https://travis-ci.com/mateodelnorte/meta-exec) | ||
# Introduction | ||
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
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
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
4851
10
59
0
5
8