cleanup(core): use built in function to strip control chars (#28778)

This commit is contained in:
James Garbutt 2024-11-05 17:13:01 +08:00 committed by GitHub
parent b925f8ccfa
commit 5d21f215a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,8 +11,8 @@ import {
import { join } from 'path'; import { join } from 'path';
import { format, resolveConfig } from 'prettier'; import { format, resolveConfig } from 'prettier';
import { CommandModule } from 'yargs'; import { CommandModule } from 'yargs';
import { stripVTControlCharacters } from 'node:util';
const stripAnsi = require('strip-ansi');
const importFresh = require('import-fresh'); const importFresh = require('import-fresh');
export function sortAlphabeticallyFunction(a: string, b: string): number { export function sortAlphabeticallyFunction(a: string, b: string): number {
@ -45,7 +45,10 @@ export async function generateMarkdownFile(
const filePath = join(outputDirectory, `${templateObject.name}.md`); const filePath = join(outputDirectory, `${templateObject.name}.md`);
outputFileSync( outputFileSync(
filePath, filePath,
await formatWithPrettier(filePath, stripAnsi(templateObject.template)) await formatWithPrettier(
filePath,
stripVTControlCharacters(templateObject.template)
)
); );
} }