@ionic/cli-framework
Advanced tools
Comparing version 1.2.0 to 1.3.0-testing.73b2b888
/// <reference types="node" /> | ||
import * as ζinquirer from 'inquirer'; | ||
import * as ζlogUpdate from 'log-update'; | ||
import { Colors } from './colors'; | ||
@@ -11,4 +12,2 @@ import { TaskChain } from './tasks'; | ||
redrawLine(msg?: string): void; | ||
open(): void; | ||
close(): void; | ||
} | ||
@@ -25,2 +24,15 @@ export interface StreamOutputStrategyOptions { | ||
} | ||
export interface LogUpdateOutputStrategyOptions { | ||
readonly LogUpdate: typeof ζlogUpdate; | ||
readonly stream?: NodeJS.WritableStream; | ||
readonly colors?: Colors; | ||
} | ||
export declare class LogUpdateOutputStrategy implements OutputStrategy, RedrawLine { | ||
readonly stream: NodeJS.WritableStream; | ||
protected readonly colors: Colors; | ||
protected readonly logUpdate: typeof ζlogUpdate; | ||
constructor({ LogUpdate, stream, colors }: LogUpdateOutputStrategyOptions); | ||
redrawLine(msg?: string): void; | ||
createTaskChain(): TaskChain; | ||
} | ||
export interface BottomBarOutputStrategyOptions { | ||
@@ -27,0 +39,0 @@ readonly BottomBar: typeof ζinquirer.ui.BottomBar; |
@@ -27,2 +27,38 @@ "use strict"; | ||
exports.StreamOutputStrategy = StreamOutputStrategy; | ||
class LogUpdateOutputStrategy { | ||
constructor({ LogUpdate, stream = process.stdout, colors = colors_1.DEFAULT_COLORS }) { | ||
this.stream = stream; | ||
this.colors = colors; | ||
this.logUpdate = LogUpdate.create(stream); | ||
} | ||
redrawLine(msg = '') { | ||
this.logUpdate(msg); | ||
} | ||
createTaskChain() { | ||
const { failure, strong, success } = this.colors; | ||
const chain = new tasks_1.TaskChain({ taskOptions: { tickInterval: 50 } }); | ||
chain.on('next', task => { | ||
task.on('success', () => { | ||
this.stream.write(`${success(tasks_1.ICON_SUCCESS)} ${task.msg} - done!\n`); | ||
}); | ||
task.on('failure', () => { | ||
this.stream.write(`${failure(tasks_1.ICON_FAILURE)} ${task.msg} - failed!\n`); | ||
}); | ||
const spinner = new tasks_1.Spinner(); | ||
task.on('tick', () => { | ||
const progress = task.progressRatio ? (task.progressRatio * 100).toFixed(2) : ''; | ||
const frame = spinner.frame(); | ||
this.redrawLine(`${strong(frame)} ${task.msg}${progress ? ' (' + strong(String(progress) + '%') + ')' : ''} `); | ||
}); | ||
task.on('clear', () => { | ||
this.logUpdate.clear(); | ||
}); | ||
}); | ||
chain.on('end', () => { | ||
this.logUpdate.done(); | ||
}); | ||
return chain; | ||
} | ||
} | ||
exports.LogUpdateOutputStrategy = LogUpdateOutputStrategy; | ||
class BottomBarOutputStrategy { | ||
@@ -29,0 +65,0 @@ constructor({ BottomBar, input = process.stdin, output = process.stdout, colors = colors_1.DEFAULT_COLORS }) { |
{ | ||
"name": "@ionic/cli-framework", | ||
"version": "1.2.0", | ||
"version": "1.3.0-testing.73b2b888", | ||
"description": "The foundation framework of the Ionic CLI", | ||
@@ -30,3 +30,3 @@ "homepage": "https://ionicframework.com/", | ||
"dependencies": { | ||
"@ionic/utils-fs": "0.0.4", | ||
"@ionic/utils-fs": "0.1.0-testing.73b2b888", | ||
"chalk": "^2.3.0", | ||
@@ -36,2 +36,3 @@ "debug": "^4.0.0", | ||
"lodash": "^4.17.5", | ||
"log-update": "^2.3.0", | ||
"minimist": "^1.2.0", | ||
@@ -55,2 +56,3 @@ "rimraf": "^2.6.2", | ||
"@types/lodash": "^4.14.104", | ||
"@types/log-update": "^2.0.0", | ||
"@types/minimist": "^1.2.0", | ||
@@ -57,0 +59,0 @@ "@types/node": "^6.0.101", |
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 v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
187483
4292
17
20
1
+ Addedlog-update@^2.3.0
+ Added@ionic/utils-fs@0.1.0-testing.73b2b888(transitive)
+ Addedlog-update@2.3.0(transitive)
+ Addedwrap-ansi@3.0.1(transitive)
- Removed@ionic/utils-fs@0.0.4(transitive)