diff --git a/src/commands/translate/commands/compose.ts b/src/commands/translate/commands/compose.ts index fe17914f..c62f643e 100644 --- a/src/commands/translate/commands/compose.ts +++ b/src/commands/translate/commands/compose.ts @@ -148,7 +148,7 @@ function pipeline( output: string, {useSource, useExperimentalParser}: ComposeOptions, ) { - return async (file: FileInfo) => { + return async function pipeline(file: FileInfo) { const skeleton = new FileLoader(join(input, file.skl)); const xliff = new FileLoader(join(input, file.xliff)); @@ -156,7 +156,7 @@ function pipeline( const content = new FileLoader(join(output, file.path)); const {schemas, ajvOptions} = await resolveSchemas({ - content: content.data, + content: skeleton.data, path: file.path, }); diff --git a/src/logger/index.ts b/src/logger/index.ts index 6547c1ba..43fa6e77 100644 --- a/src/logger/index.ts +++ b/src/logger/index.ts @@ -192,14 +192,6 @@ export class Logger implements LogConsumer { return this; } - stat(): Record { - return { - [LogLevel.INFO]: this[INFO].count, - [LogLevel.WARN]: this[WARN].count, - [LogLevel.ERROR]: this[ERROR].count, - }; - } - [Write](level: LogLevels, message: string) { if (this.options.quiet) { return; @@ -228,3 +220,11 @@ function extractMessage(error: unknown): string { return String(error); } + +export function stats(logger: Logger) { + return { + [LogLevel.INFO]: logger[INFO].count, + [LogLevel.WARN]: logger[WARN].count, + [LogLevel.ERROR]: logger[ERROR].count, + }; +} diff --git a/src/program/base.ts b/src/program/base.ts index 1d0ba523..8d42ba7e 100644 --- a/src/program/base.ts +++ b/src/program/base.ts @@ -3,7 +3,7 @@ import type {Command, Config, ExtendedOption} from '~/config'; import {AsyncSeriesWaterfallHook, Hook, HookMap, SyncHook} from 'tapable'; import {isAbsolute, resolve} from 'node:path'; import {once} from 'lodash'; -import {Logger} from '~/logger'; +import {Logger, stats} from '~/logger'; import log from '@diplodoc/transform/lib/log'; import { resolveConfig, @@ -152,7 +152,7 @@ export const BaseProgram = < } private async post() { - const stat = this.logger.stat(); + const stat = stats(this.logger); if (stat.error || (this.config.strict && stat.warn)) { throw new HandledError('There is some processing errors.'); }