Unverified Commit 27d39d7e authored by Shiqi Mei's avatar Shiqi Mei Committed by GitHub

[NEW] Support verbose option to show additional details (#96)

* [NEW] Support verbose option to show additional details

* Apply code reviews
parent 09203fcf
......@@ -27,6 +27,10 @@ export default class Deploy extends Command {
char: 't',
description: 'API token to use with UserID (instead of username & password)',
}),
verbose: flags.boolean({
char: 'v',
description: 'show additional details about the results of running the command',
}),
userid: flags.string({
char: 'i',
description: 'UserID to use with API token (instead of username & password)',
......@@ -64,6 +68,10 @@ export default class Deploy extends Command {
const compiler = new AppCompiler(fd);
const result = await compiler.compile();
if (flags.verbose) {
this.log(`${chalk.green('[info]')} using TypeScript v${ result.typeScriptVersion }`);
}
if (result.diagnostics.length && !flags.force) {
this.reportDiagnostics(result.diagnostics);
this.error('TypeScript compiler error(s) occurred');
......
......@@ -19,6 +19,10 @@ export default class Package extends Command {
char: 'f',
description: 'forcefully package the App, ignores lint & TypeScript errors',
}),
'verbose': flags.boolean({
char: 'v',
description: 'show additional details about the results of running the command',
}),
};
public async run(): Promise<void> {
......@@ -40,6 +44,10 @@ export default class Package extends Command {
const { flags } = this.parse(Package);
if (flags.verbose) {
this.log(`${chalk.green('[info]')} using TypeScript v${ result.typeScriptVersion }`);
}
if (result.diagnostics.length && !flags.force) {
this.reportDiagnostics(result.diagnostics);
this.error('TypeScript compiler error(s) occurred');
......
......@@ -32,6 +32,10 @@ export default class Watch extends Command {
char: 'i',
description: 'UserID to use with API token (instead of username & password)',
}),
verbose: flags.boolean({
char: 'v',
description: 'show additional details about the results of running the command',
}),
// flag with no value (-f, --force)
force: flags.boolean({ char: 'f', description: 'forcefully deploy the App, ignores lint & TypeScript errors' }),
code: flags.string({ char: 'c', dependsOn: ['username'], description: '2FA code of the user' }),
......@@ -91,6 +95,10 @@ const tasks = async (command: Command, fd: FolderDetails, flags: { [key: string]
const compiler = new AppCompiler(fd);
const result = await compiler.compile();
if (flags.verbose) {
command.log(`${chalk.green('[info]')} using TypeScript v${ result.typeScriptVersion }`);
}
if (result.diagnostics.length && !flags.force) {
reportDiagnostics(command, result.diagnostics);
command.error('TypeScript compiler error(s) occurred');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment