mirror of
https://github.com/tiktok/sparo.git
synced 2024-11-14 19:35:12 -05:00
chore: format ANSI chars ta a more readable format
This commit is contained in:
parent
57842c3938
commit
cf9b018949
13 changed files with 68 additions and 55 deletions
|
@ -1,6 +1,6 @@
|
|||
Running "sparo checkout --help":
|
||||
|
||||
[1mSparo accelerator for Git __VERSION__ -[22m[36m https://tiktok.github.io/sparo/[39m
|
||||
[bold]Sparo accelerator for Git __VERSION__ -[normal][cyan] https://tiktok.github.io/sparo/[default]
|
||||
Node.js version is __VERSION__ (LTS)
|
||||
Git version is __VERSION__
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Running "sparo clone --help":
|
||||
|
||||
[1mSparo accelerator for Git __VERSION__ -[22m[36m https://tiktok.github.io/sparo/[39m
|
||||
[bold]Sparo accelerator for Git __VERSION__ -[normal][cyan] https://tiktok.github.io/sparo/[default]
|
||||
Node.js version is __VERSION__ (LTS)
|
||||
Git version is __VERSION__
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Running "sparo --help":
|
||||
|
||||
[1mSparo accelerator for Git __VERSION__ -[22m[36m https://tiktok.github.io/sparo/[39m
|
||||
[bold]Sparo accelerator for Git __VERSION__ -[normal][cyan] https://tiktok.github.io/sparo/[default]
|
||||
Node.js version is __VERSION__ (LTS)
|
||||
Git version is __VERSION__
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
Running "sparo nonexistent-command":
|
||||
|
||||
[1mSparo accelerator for Git __VERSION__ -[22m[36m https://tiktok.github.io/sparo/[39m
|
||||
[bold]Sparo accelerator for Git __VERSION__ -[normal][cyan] https://tiktok.github.io/sparo/[default]
|
||||
Node.js version is __VERSION__ (LTS)
|
||||
Git version is __VERSION__
|
||||
|
||||
|
||||
[90m--[[39m [1mgit nonexistent-command[22m [90m]--------------------------------------------------[39m
|
||||
[90m-------------------------------------------------------------------------------[39m
|
||||
[gray]--[[default] [bold]git nonexistent-command[normal] [gray]]--------------------------------------------------[default]
|
||||
[gray]-------------------------------------------------------------------------------[default]
|
||||
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
Running "sparo checkout --profile my-build-test":
|
||||
|
||||
[1mSparo accelerator for Git __VERSION__ -[22m[36m https://tiktok.github.io/sparo/[39m
|
||||
[bold]Sparo accelerator for Git __VERSION__ -[normal][cyan] https://tiktok.github.io/sparo/[default]
|
||||
Node.js version is __VERSION__ (LTS)
|
||||
Git version is __VERSION__
|
||||
|
||||
|
||||
[90m--[[39m [1mgit checkout[22m [90m]-------------------------------------------------------------[39m
|
||||
Your branch is up to date with 'origin/build-test'.
|
||||
[90m-------------------------------------------------------------------------------[39m
|
||||
[gray]--[[default] [bold]git checkout[normal] [gray]]-------------------------------------------------------------[default]
|
||||
Your branch is up to date with 'origin/test-artifacts/sparo-real-repo-test'.
|
||||
[gray]-------------------------------------------------------------------------------[default]
|
||||
|
||||
Syncing checkout with the Sparo profile: my-build-test
|
||||
|
||||
Checking out and updating core files...
|
||||
|
||||
[90m--[[39m [1mgit sparse-checkout[22m [90m]------------------------------------------------------[39m
|
||||
[90m-------------------------------------------------------------------------------[39m
|
||||
[gray]--[[default] [bold]git sparse-checkout[normal] [gray]]------------------------------------------------------[default]
|
||||
[gray]-------------------------------------------------------------------------------[default]
|
||||
|
||||
Checking out skeleton...
|
||||
|
||||
[90m--[[39m [1mgit sparse-checkout[22m [90m]------------------------------------------------------[39m
|
||||
[90m-------------------------------------------------------------------------------[39m
|
||||
[gray]--[[default] [bold]git sparse-checkout[normal] [gray]]------------------------------------------------------[default]
|
||||
[gray]-------------------------------------------------------------------------------[default]
|
||||
|
||||
Sparse checkout completed in __DURATION__
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
Running "sparo checkout --profile my-build-test":
|
||||
|
||||
[1mSparo accelerator for Git __VERSION__ -[22m[36m https://tiktok.github.io/sparo/[39m
|
||||
[bold]Sparo accelerator for Git __VERSION__ -[normal][cyan] https://tiktok.github.io/sparo/[default]
|
||||
Node.js version is __VERSION__ (LTS)
|
||||
Git version is __VERSION__
|
||||
|
||||
|
||||
[90m--[[39m [1mgit checkout[22m [90m]-------------------------------------------------------------[39m
|
||||
Your branch is up to date with 'origin/build-test'.
|
||||
[90m-------------------------------------------------------------------------------[39m
|
||||
[gray]--[[default] [bold]git checkout[normal] [gray]]-------------------------------------------------------------[default]
|
||||
Your branch is up to date with 'origin/test-artifacts/sparo-real-repo-test'.
|
||||
[gray]-------------------------------------------------------------------------------[default]
|
||||
|
||||
Syncing checkout with the Sparo profile: my-build-test
|
||||
|
||||
Checking out and updating core files...
|
||||
|
||||
[90m--[[39m [1mgit sparse-checkout[22m [90m]------------------------------------------------------[39m
|
||||
[90m-------------------------------------------------------------------------------[39m
|
||||
[gray]--[[default] [bold]git sparse-checkout[normal] [gray]]------------------------------------------------------[default]
|
||||
[gray]-------------------------------------------------------------------------------[default]
|
||||
|
||||
Checking out skeleton...
|
||||
|
||||
[90m--[[39m [1mgit sparse-checkout[22m [90m]------------------------------------------------------[39m
|
||||
[90m-------------------------------------------------------------------------------[39m
|
||||
[gray]--[[default] [bold]git sparse-checkout[normal] [gray]]------------------------------------------------------[default]
|
||||
[gray]-------------------------------------------------------------------------------[default]
|
||||
|
||||
Checking out __FOLDER_COUNT__ folders...
|
||||
|
||||
[90m--[[39m [1mgit sparse-checkout[22m [90m]------------------------------------------------------[39m
|
||||
[90m-------------------------------------------------------------------------------[39m
|
||||
[gray]--[[default] [bold]git sparse-checkout[normal] [gray]]------------------------------------------------------[default]
|
||||
[gray]-------------------------------------------------------------------------------[default]
|
||||
|
||||
Sparse checkout completed in __DURATION__
|
||||
|
|
|
@ -1,40 +1,40 @@
|
|||
Running "sparo clone https://github.com/tiktok/sparo.git --branch build-test":
|
||||
Running "sparo clone https://github.com/tiktok/sparo.git --branch test-artifacts/sparo-real-repo-test":
|
||||
|
||||
[1mSparo accelerator for Git __VERSION__ -[22m[36m https://tiktok.github.io/sparo/[39m
|
||||
[bold]Sparo accelerator for Git __VERSION__ -[normal][cyan] https://tiktok.github.io/sparo/[default]
|
||||
Node.js version is __VERSION__ (LTS)
|
||||
Git version is __VERSION__
|
||||
|
||||
Initializing working directory...
|
||||
|
||||
[90m--[[39m [1mgit clone[22m [90m]----------------------------------------------------------------[39m
|
||||
[90m-------------------------------------------------------------------------------[39m
|
||||
[gray]--[[default] [bold]git clone[normal] [gray]]----------------------------------------------------------------[default]
|
||||
[gray]-------------------------------------------------------------------------------[default]
|
||||
|
||||
Checking out and updating core files...
|
||||
|
||||
[90m--[[39m [1mgit sparse-checkout[22m [90m]------------------------------------------------------[39m
|
||||
[90m-------------------------------------------------------------------------------[39m
|
||||
[gray]--[[default] [bold]git sparse-checkout[normal] [gray]]------------------------------------------------------[default]
|
||||
[gray]-------------------------------------------------------------------------------[default]
|
||||
|
||||
Checking out skeleton...
|
||||
|
||||
[90m--[[39m [1mgit sparse-checkout[22m [90m]------------------------------------------------------[39m
|
||||
[90m-------------------------------------------------------------------------------[39m
|
||||
[gray]--[[default] [bold]git sparse-checkout[normal] [gray]]------------------------------------------------------[default]
|
||||
[gray]-------------------------------------------------------------------------------[default]
|
||||
|
||||
Applying recommended configuration...
|
||||
|
||||
[90m--[[39m [1mgit maintenance[22m [90m]----------------------------------------------------------[39m
|
||||
[90m-------------------------------------------------------------------------------[39m
|
||||
[gray]--[[default] [bold]git maintenance[normal] [gray]]----------------------------------------------------------[default]
|
||||
[gray]-------------------------------------------------------------------------------[default]
|
||||
|
||||
[32mSuccess: Working directory "sparo" was prepared in __DURATION__.[39m
|
||||
[green]Success: Working directory "sparo" was prepared in __DURATION__.[default]
|
||||
|
||||
Don't forget to change your shell path:
|
||||
[36mcd sparo[39m
|
||||
[cyan]cd sparo[default]
|
||||
|
||||
Your next step is to choose a Sparo profile for checkout.
|
||||
To see available profiles in this repo:
|
||||
[36msparo list-profiles[39m
|
||||
[cyan]sparo list-profiles[default]
|
||||
To checkout and set profile:
|
||||
[36msparo checkout --profile <profile_name>[39m
|
||||
[cyan]sparo checkout --profile <profile_name>[default]
|
||||
To checkout and add profile:
|
||||
[36msparo checkout --add-profile <profile_name>[39m
|
||||
[cyan]sparo checkout --add-profile <profile_name>[default]
|
||||
To create a new profile:
|
||||
[36msparo init-profile --profile <profile_name>[39m
|
||||
[cyan]sparo init-profile --profile <profile_name>[default]
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
Running "sparo init-profile --profile my-build-test":
|
||||
|
||||
[1mSparo accelerator for Git __VERSION__ -[22m[36m https://tiktok.github.io/sparo/[39m
|
||||
[bold]Sparo accelerator for Git __VERSION__ -[normal][cyan] https://tiktok.github.io/sparo/[default]
|
||||
Node.js version is __VERSION__ (LTS)
|
||||
Git version is __VERSION__
|
||||
|
||||
[32mSuccessfully initialized the "my-build-test" profile.[39m
|
||||
[green]Successfully initialized the "my-build-test" profile.[default]
|
||||
|
||||
Next step: Open this file in your editor and configure the project selectors:
|
||||
|
||||
[36m__WORKING_DIRECTORY__/common/sparo-profiles/my-build-test.json[39m
|
||||
[cyan]__WORKING_DIRECTORY__/common/sparo-profiles/my-build-test.json[default]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Running "sparo list-profiles --project sparo-lib":
|
||||
|
||||
[1mSparo accelerator for Git __VERSION__ -[22m[36m https://tiktok.github.io/sparo/[39m
|
||||
[bold]Sparo accelerator for Git __VERSION__ -[normal][cyan] https://tiktok.github.io/sparo/[default]
|
||||
Node.js version is __VERSION__ (LTS)
|
||||
Git version is __VERSION__
|
||||
|
||||
|
@ -8,13 +8,13 @@ Listing profiles...
|
|||
|
||||
Checking out and updating core files...
|
||||
|
||||
[90m--[[39m [1mgit sparse-checkout[22m [90m]------------------------------------------------------[39m
|
||||
[90m-------------------------------------------------------------------------------[39m
|
||||
[gray]--[[default] [bold]git sparse-checkout[normal] [gray]]------------------------------------------------------[default]
|
||||
[gray]-------------------------------------------------------------------------------[default]
|
||||
|
||||
Checking out skeleton...
|
||||
|
||||
[90m--[[39m [1mgit sparse-checkout[22m [90m]------------------------------------------------------[39m
|
||||
[90m-------------------------------------------------------------------------------[39m
|
||||
[gray]--[[default] [bold]git sparse-checkout[normal] [gray]]------------------------------------------------------[default]
|
||||
[gray]-------------------------------------------------------------------------------[default]
|
||||
|
||||
sparo-lib was included in the below profiles:
|
||||
my-build-test
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Running "sparo list-profiles":
|
||||
|
||||
[1mSparo accelerator for Git __VERSION__ -[22m[36m https://tiktok.github.io/sparo/[39m
|
||||
[bold]Sparo accelerator for Git __VERSION__ -[normal][cyan] https://tiktok.github.io/sparo/[default]
|
||||
Node.js version is __VERSION__ (LTS)
|
||||
Git version is __VERSION__
|
||||
|
||||
|
@ -8,13 +8,13 @@ Listing profiles...
|
|||
|
||||
Checking out and updating core files...
|
||||
|
||||
[90m--[[39m [1mgit sparse-checkout[22m [90m]------------------------------------------------------[39m
|
||||
[90m-------------------------------------------------------------------------------[39m
|
||||
[gray]--[[default] [bold]git sparse-checkout[normal] [gray]]------------------------------------------------------[default]
|
||||
[gray]-------------------------------------------------------------------------------[default]
|
||||
|
||||
Checking out skeleton...
|
||||
|
||||
[90m--[[39m [1mgit sparse-checkout[22m [90m]------------------------------------------------------[39m
|
||||
[90m-------------------------------------------------------------------------------[39m
|
||||
[gray]--[[default] [bold]git sparse-checkout[normal] [gray]]------------------------------------------------------[default]
|
||||
[gray]-------------------------------------------------------------------------------[default]
|
||||
|
||||
All available profiles:
|
||||
my-build-test
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
"dependencies": {
|
||||
"@rushstack/node-core-library": "~3.64.2",
|
||||
"jest-diff": "~29.7.0",
|
||||
"sparo": "workspace:*"
|
||||
"sparo": "workspace:*",
|
||||
"@rushstack/terminal": "~0.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rushstack/heft": "0.64.3",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import * as path from 'path';
|
||||
import * as os from 'os';
|
||||
import { Async, Executable, FileSystem, Text, type FolderItem } from '@rushstack/node-core-library';
|
||||
import { AnsiEscape } from '@rushstack/terminal';
|
||||
import { diff } from 'jest-diff';
|
||||
import type { ChildProcess } from 'child_process';
|
||||
import type { IScopedLogger } from '@rushstack/heft';
|
||||
|
@ -264,7 +265,8 @@ function processSparoOutput(text: string, workingDirectory: string): string {
|
|||
replaceVersionString,
|
||||
replaceDurationString,
|
||||
replaceWorkingDirectoryPath,
|
||||
replaceFolderCountString
|
||||
replaceFolderCountString,
|
||||
formatForTests
|
||||
].reduce((text, fn) => fn(text, workingDirectory), text);
|
||||
}
|
||||
/**
|
||||
|
@ -298,6 +300,13 @@ function replaceWorkingDirectoryPath(text: string, workingDirectory: string): st
|
|||
function replaceFolderCountString(text: string): string {
|
||||
return text.replace(/Checking out \d+ folders/g, 'Checking out __FOLDER_COUNT__ folders');
|
||||
}
|
||||
/**
|
||||
* ANSI characters are a bit awkward and they are not well rendered in the website.
|
||||
* So we replace them with a more readable format.
|
||||
*/
|
||||
function formatForTests(text: string): string {
|
||||
return AnsiEscape.formatForTests(text);
|
||||
}
|
||||
|
||||
async function* enumerateFolderPaths(
|
||||
absoluteFolderPath: string,
|
||||
|
|
|
@ -210,6 +210,9 @@ importers:
|
|||
'@rushstack/node-core-library':
|
||||
specifier: ~3.64.2
|
||||
version: 3.64.2(@types/node@20.11.16)
|
||||
'@rushstack/terminal':
|
||||
specifier: ~0.8.1
|
||||
version: 0.8.1(@types/node@20.11.16)
|
||||
jest-diff:
|
||||
specifier: ~29.7.0
|
||||
version: 29.7.0
|
||||
|
|
Loading…
Reference in a new issue