cli-engine-command
Advanced tools
Comparing version 5.1.4 to 5.1.5
@@ -8,3 +8,3 @@ 'use strict'; | ||
function shouldDisplaySpinner(out) { | ||
return !out.mock && !out.config.debug && !!process.stdin.isTTY && !!process.stderr.isTTY && !process.env.CI && process.env.TERM !== 'dumb'; | ||
return !process.env.DEBUG && !out.mock && !out.config.debug && !!process.stdin.isTTY && !!process.stderr.isTTY && !process.env.CI && process.env.TERM !== 'dumb'; | ||
} | ||
@@ -14,2 +14,6 @@ | ||
constructor(out) { | ||
this.out = out; | ||
} | ||
start(action, status) { | ||
@@ -19,2 +23,3 @@ const task = this.task = { action, status, active: this.task && this.task.active }; | ||
task.active = true; | ||
this.log(task); | ||
} | ||
@@ -25,2 +30,3 @@ | ||
if (!task) return; | ||
// TODO: is this right? | ||
this.status = msg; | ||
@@ -41,2 +47,3 @@ this._stop(); | ||
task.status = status; | ||
this.log(task); | ||
} | ||
@@ -58,2 +65,7 @@ | ||
log({ action, status }) { | ||
let msg = status ? `${action}... ${status}\n` : `${action}...\n`; | ||
this.out.stderr.writeLogFile(msg, true); | ||
} | ||
_start() { | ||
@@ -76,8 +88,2 @@ throw new Error('not implemented'); | ||
class SimpleAction extends ActionBase { | ||
constructor(out) { | ||
super(); | ||
this.out = out; | ||
} | ||
_start() { | ||
@@ -114,3 +120,3 @@ const task = this.task; | ||
_write(s) { | ||
this.out.stderr.write(s); | ||
this.out.stderr.write(s, { log: false }); | ||
} | ||
@@ -123,4 +129,3 @@ } | ||
constructor(out) { | ||
super(); | ||
this.out = out; | ||
super(out); | ||
this.ansi = require('ansi-escapes'); | ||
@@ -137,3 +142,3 @@ this.frames = require('./spinners.js')[process.platform === 'win32' ? 'line' : 'dots2'].frames; | ||
this._render(); | ||
let interval = this.spinner = setInterval(this._render.bind(this), 100, 'spinner'); | ||
let interval = this.spinner = setInterval(this._render.bind(this), this.out.config.windows ? 500 : 100, 'spinner'); | ||
interval.unref(); | ||
@@ -183,5 +188,5 @@ } | ||
_write(s) { | ||
this.out.stderr.write(s); | ||
this.out.stderr.write(s, { log: false }); | ||
} | ||
} | ||
exports.SpinnerAction = SpinnerAction; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.StreamOutput = exports.CustomColors = undefined; | ||
exports.CustomColors = undefined; | ||
@@ -39,2 +39,6 @@ var _util = require('util'); | ||
var _stream = require('./stream'); | ||
var _stream2 = _interopRequireDefault(_stream); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -104,25 +108,2 @@ | ||
class StreamOutput { | ||
constructor(stream, output) { | ||
this.output = ''; | ||
this.out = output; | ||
this.stream = stream; | ||
} | ||
write(msg) { | ||
if (this.out.mock) this.output += msg;else this.stream.write(msg); | ||
} | ||
log(data, ...args) { | ||
let msg = data ? _util2.default.format(data, ...args) : ''; | ||
msg += '\n'; | ||
this.out.action.pause(() => { | ||
if (this.out.mock) this.output += msg;else this.stream.write(msg); | ||
}); | ||
} | ||
} | ||
exports.StreamOutput = StreamOutput; | ||
class Output { | ||
@@ -134,4 +115,4 @@ constructor(options = {}) { | ||
this.config = (0, _cliEngineConfig.buildConfig)(options.config); | ||
this.stdout = new StreamOutput(process.stdout, this); | ||
this.stderr = new StreamOutput(process.stderr, this); | ||
this.stdout = new _stream2.default(process.stdout, this); | ||
this.stderr = new _stream2.default(process.stderr, this); | ||
this.action = (0, _action.shouldDisplaySpinner)(this) ? new _action.SpinnerAction(this) : new _action.SimpleAction(this); | ||
@@ -142,5 +123,2 @@ if (this.mock) _chalk2.default.enabled = CustomColors.supports = false; | ||
get fs() { | ||
return require('fs-extra'); | ||
} | ||
get color() { | ||
@@ -225,2 +203,5 @@ return new Proxy(_chalk2.default, { | ||
} | ||
get autoupdatelog() { | ||
return _path2.default.join(this.config.cacheDir, 'autoupdate.log'); | ||
} | ||
@@ -262,9 +243,3 @@ error(err, exitCode = 1) { | ||
logError(err) { | ||
try { | ||
err = this.color.stripColor(_util2.default.inspect(err)); | ||
this.fs.mkdirpSync(_path2.default.dirname(this.errlog)); | ||
this.fs.appendFileSync(this.errlog, `${err}\n`); | ||
} catch (err) { | ||
console.error(err); | ||
} | ||
(0, _stream.logToFile)(_util2.default.inspect(err), this.errlog); | ||
} | ||
@@ -271,0 +246,0 @@ |
{ | ||
"name": "cli-engine-command", | ||
"description": "base CLI command for cli-engine", | ||
"version": "5.1.4", | ||
"version": "5.1.5", | ||
"author": "Jeff Dickey @dickeyxxx", | ||
@@ -12,3 +12,3 @@ "bugs": "https://github.com/heroku/cli-engine-command/issues", | ||
"fs-extra": "3.x", | ||
"http-call": "^2.1.2", | ||
"http-call": "^2.1.3", | ||
"lodash.ary": "^4.1.1", | ||
@@ -24,2 +24,3 @@ "lodash.defaults": "^4.2.0", | ||
"lodash.result": "^4.5.2", | ||
"moment": "^2.18.1", | ||
"string": "3.x", | ||
@@ -36,3 +37,3 @@ "supports-color": "3.x" | ||
"cli-engine-config": "^1.3.7", | ||
"eslint": "3.19.0", | ||
"eslint": "^4.0.0", | ||
"eslint-config-standard": "10.2.1", | ||
@@ -45,3 +46,3 @@ "eslint-plugin-flowtype": "2.34.0", | ||
"eslint-plugin-standard": "3.0.1", | ||
"flow-bin": "0.47.0", | ||
"flow-bin": "^0.48.0", | ||
"flow-copy-source": "1.1.0", | ||
@@ -48,0 +49,0 @@ "flow-typed": "2.1.2", |
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 2 instances 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
145257
40
2077
19
10
+ Addedmoment@^2.18.1
+ Addedmoment@2.30.1(transitive)
Updatedhttp-call@^2.1.3