From cee74870e613a6e9624f4e487282737547db5b7c Mon Sep 17 00:00:00 2001 From: fatme Date: Fri, 31 May 2019 10:13:32 +0300 Subject: [PATCH] fix: pass --env.verbose to webpack compiler --- lib/common/definitions/logger.d.ts | 1 + lib/common/logger/logger.ts | 4 ++++ lib/common/test/unit-tests/stubs.ts | 1 + lib/services/webpack/webpack-compiler-service.ts | 4 +++- test/stubs.ts | 2 ++ 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/common/definitions/logger.d.ts b/lib/common/definitions/logger.d.ts index 6077c31d7d..5d51828965 100644 --- a/lib/common/definitions/logger.d.ts +++ b/lib/common/definitions/logger.d.ts @@ -25,6 +25,7 @@ declare global { trace(formatStr?: any, ...args: any[]): void; printMarkdown(...args: any[]): void; prepare(item: any): string; + isVerbose(): boolean; } interface Log4JSAppenderConfiguration extends Configuration { diff --git a/lib/common/logger/logger.ts b/lib/common/logger/logger.ts index cd105e4969..1dc980725e 100644 --- a/lib/common/logger/logger.ts +++ b/lib/common/logger/logger.ts @@ -135,6 +135,10 @@ export class Logger implements ILogger { this.info(formattedMessage, { [LoggerConfigData.skipNewLine]: true }); } + public isVerbose(): boolean { + return log4js.levels.DEBUG.isGreaterThanOrEqualTo(this.getLevel()); + } + private logMessage(inputData: any[], logMethod: string): void { this.initialize(); diff --git a/lib/common/test/unit-tests/stubs.ts b/lib/common/test/unit-tests/stubs.ts index 075dcb4806..199980b088 100644 --- a/lib/common/test/unit-tests/stubs.ts +++ b/lib/common/test/unit-tests/stubs.ts @@ -51,6 +51,7 @@ export class CommonLoggerStub implements ILogger { printInfoMessageOnSameLine(message: string): void { } async printMsgWithTimeout(message: string, timeout: number): Promise { } printOnStderr(formatStr?: any, ...args: any[]): void { } + isVerbose(): boolean { return false; } } export class ErrorsStub implements IErrors { diff --git a/lib/services/webpack/webpack-compiler-service.ts b/lib/services/webpack/webpack-compiler-service.ts index c657583381..3bd67c10e5 100644 --- a/lib/services/webpack/webpack-compiler-service.ts +++ b/lib/services/webpack/webpack-compiler-service.ts @@ -133,9 +133,11 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp const appResourcesPath = this.$projectData.getAppResourcesRelativeDirectoryPath(); Object.assign(envData, appPath && { appPath }, - appResourcesPath && { appResourcesPath } + appResourcesPath && { appResourcesPath }, ); + envData.verbose = this.$logger.isVerbose(); + return envData; } diff --git a/test/stubs.ts b/test/stubs.ts index a1ba362197..47c9013371 100644 --- a/test/stubs.ts +++ b/test/stubs.ts @@ -41,6 +41,8 @@ export class LoggerStub implements ILogger { printInfoMessageOnSameLine(message: string): void { } async printMsgWithTimeout(message: string, timeout: number): Promise { } printOnStderr(formatStr?: any, ...args: any[]): void { } + + isVerbose(): boolean { return false; } } export class FileSystemStub implements IFileSystem {