diff --git a/package-lock.json b/package-lock.json index a8892791..3e2bc5ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "virmator", - "version": "1.3.5", + "version": "1.3.6", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "1.3.5", + "version": "1.3.6", "license": "MIT", "dependencies": { "ansi-styles": "5.2.0", diff --git a/package.json b/package.json index f989b51f..0ac58d6c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "virmator", - "version": "1.3.5", + "version": "1.3.6", "description": "Handle all the stuffs in one package.", "keywords": [ "automation", diff --git a/src/cli/cli-util/shell-command-wrapper.ts b/src/cli/cli-util/shell-command-wrapper.ts index 9e3f3801..99bb975c 100644 --- a/src/cli/cli-util/shell-command-wrapper.ts +++ b/src/cli/cli-util/shell-command-wrapper.ts @@ -13,9 +13,9 @@ function outputWrapper( filter: OutputFilter, ): (input: string | Buffer) => void { return (input) => { - const stringInput = input.toString(); - if (filter(stringInput)) { - callback(stringInput); + const callbackString = filter(input.toString()); + if (callbackString) { + callback(callbackString); } }; } diff --git a/src/cli/cli.test.ts b/src/cli/cli.test.ts index 667e3c7b..e8135f54 100644 --- a/src/cli/cli.test.ts +++ b/src/cli/cli.test.ts @@ -107,10 +107,7 @@ testGroup((runTest) => { args: [CliFlagName.NoWriteConfig, CliCommandName.Format, FormatOperation.Check], description: 'runs format', expect: { - stdout: `running format...\nAll matched files use Prettier code style!\n\n${getResultMessage( - CliCommandName.Format, - true, - )}`, + stdout: `running format...\n${getResultMessage(CliCommandName.Format, true)}`, }, cwd: testFormatPaths.validRepo, }); diff --git a/src/cli/commands/implementations/format.command.ts b/src/cli/commands/implementations/format.command.ts index 33f49e59..f6c2a94b 100644 --- a/src/cli/commands/implementations/format.command.ts +++ b/src/cli/commands/implementations/format.command.ts @@ -23,7 +23,7 @@ type FormatArgs = Required< export const defaultFormatArgs: FormatArgs = { operation: FormatOperation.Write, prettierFlags: [], - fileExtensions: ['ts', 'json', 'html', 'css', 'md', 'js', 'yml', 'yaml'], + fileExtensions: ['ts', 'tsx', 'json', 'html', 'css', 'md', 'js', 'yml', 'yaml'], } as const; export const filesMarkerArg = '--format-files' as const; @@ -85,7 +85,12 @@ export async function runFormatCommand(inputs: CommandFunctionInput): Promise stdout.replace('Checking formatting...\n', ''), + stdoutFilter: (stdout) => + stdout + // only relevant when running the check command + .replace('Checking formatting...\n', '') + // only relevant when running the check command + .replace('All matched files use Prettier code style!\n', ''), }); return { diff --git a/src/cli/commands/implementations/test.command.ts b/src/cli/commands/implementations/test.command.ts index 017da7c0..83eaaae7 100644 --- a/src/cli/commands/implementations/test.command.ts +++ b/src/cli/commands/implementations/test.command.ts @@ -37,7 +37,11 @@ export async function runTestCommand(inputs: CommandFunctionInput): Promise + // weird looking hex codes here are for color codes from test-vir + logString.replace('\x1B[1m\x1B[32mAll tests passed.\x1B[0m\n', ''), + }); return { success: !results.error, diff --git a/src/cli/commands/run-command.ts b/src/cli/commands/run-command.ts index cb949521..3365d109 100644 --- a/src/cli/commands/run-command.ts +++ b/src/cli/commands/run-command.ts @@ -64,10 +64,10 @@ export async function runCommand( ? EmptyOutputCallbacks : { stdoutCallback: (input: string) => { - console.info(input.replace(/\n\n$/, '\n')); + console.info(input.replace(/\n$/, '')); }, stderrCallback: (input: string) => { - console.error(input.replace(/\n\n$/, '\n')); + console.error(input.replace(/\n$/, '')); }, };