mirror of
https://github.com/graphql-hive/console
synced 2026-05-24 09:38:26 +00:00
20 lines
581 B
TypeScript
20 lines
581 B
TypeScript
|
|
export function normalizeCliOutput(value: string) {
|
|||
|
|
return value
|
|||
|
|
.split('\n')
|
|||
|
|
.map(line =>
|
|||
|
|
line
|
|||
|
|
.replaceAll('✔', 'v')
|
|||
|
|
.replaceAll('ℹ', 'i')
|
|||
|
|
// eslint-disable-next-line no-control-regex
|
|||
|
|
.replace(/\x1B[[(?);]{0,2}(;?\d)*./g, '')
|
|||
|
|
.replace(
|
|||
|
|
/http:\/\/localhost:8080\/[$]*\w+\/[$]*\w+\/production/i,
|
|||
|
|
'http://localhost:8080/$organization/$project/production',
|
|||
|
|
)
|
|||
|
|
.replace(/history\/[$]*\w+-\w+-\w+-\w+-\w+/i, 'history/$version')
|
|||
|
|
.trim(),
|
|||
|
|
)
|
|||
|
|
.filter(Boolean)
|
|||
|
|
.join('\n');
|
|||
|
|
}
|