mirror of
https://github.com/tiktok/sparo.git
synced 2024-11-14 19:35:12 -05:00
fix: stable output
This commit is contained in:
parent
e6f85b42e6
commit
8cd75c52e3
4 changed files with 19 additions and 9 deletions
|
@ -73,9 +73,12 @@ export class ListProfilesCommand implements ICommand<IListProfilesCommandOptions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profileProjects.has(project)) {
|
const profilesContainProject: string[] | undefined = profileProjects.get(project);
|
||||||
|
if (profilesContainProject) {
|
||||||
|
// Ensure the stable order of the profiles
|
||||||
|
Sort.sortBy(profilesContainProject, (x) => x, Sort.compareByValue);
|
||||||
terminalService.terminal.writeLine(
|
terminalService.terminal.writeLine(
|
||||||
`${project} was included in the below profiles:\n ${profileProjects.get(project)?.join('\n')}`
|
`${project} was included in the below profiles:\n ${profilesContainProject.join('\n')}`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
terminalService.terminal.writeErrorLine(`${project} is not included in any pre-configured profile`);
|
terminalService.terminal.writeErrorLine(`${project} is not included in any pre-configured profile`);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Running "sparo clone git@github.com:tiktok/sparo.git --branch build-test":
|
Running "sparo clone __GITHUB_HOSTNAME__:tiktok/sparo.git --branch build-test":
|
||||||
|
|
||||||
[1mSparo accelerator for Git __VERSION__ -[22m[36m https://tiktok.github.io/sparo/[39m
|
[1mSparo accelerator for Git __VERSION__ -[22m[36m https://tiktok.github.io/sparo/[39m
|
||||||
Node.js version is __VERSION__ (LTS)
|
Node.js version is __VERSION__ (LTS)
|
||||||
|
|
|
@ -17,5 +17,5 @@ Checking out skeleton...
|
||||||
[90m-------------------------------------------------------------------------------[39m
|
[90m-------------------------------------------------------------------------------[39m
|
||||||
|
|
||||||
sparo-lib was included in the below profiles:
|
sparo-lib was included in the below profiles:
|
||||||
sparo-development
|
my-build-test
|
||||||
my-build-test
|
sparo-development
|
||||||
|
|
|
@ -107,10 +107,10 @@ export async function executeCommandsAndCollectOutputs({
|
||||||
const outputPath: string = path.join(tempFolder, `${name}.txt`);
|
const outputPath: string = path.join(tempFolder, `${name}.txt`);
|
||||||
FileSystem.writeFile(
|
FileSystem.writeFile(
|
||||||
outputPath,
|
outputPath,
|
||||||
`Running "sparo ${args.join(' ')}":\n${processSparoOutput(
|
processSparoOutput(
|
||||||
stdout,
|
`Running "sparo ${args.join(' ')}":\n${stdout}`,
|
||||||
currentWorkingDirectory || process.cwd()
|
currentWorkingDirectory || process.cwd()
|
||||||
)}`
|
)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -263,7 +263,8 @@ function processSparoOutput(text: string, workingDirectory: string): string {
|
||||||
replaceVersionString,
|
replaceVersionString,
|
||||||
replaceDurationString,
|
replaceDurationString,
|
||||||
replaceWorkingDirectoryPath,
|
replaceWorkingDirectoryPath,
|
||||||
replaceFolderCountString
|
replaceFolderCountString,
|
||||||
|
replaceGitHostname
|
||||||
].reduce((text, fn) => fn(text, workingDirectory), text);
|
].reduce((text, fn) => fn(text, workingDirectory), text);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -290,6 +291,12 @@ function replaceWorkingDirectoryPath(text: string, workingDirectory: string): st
|
||||||
function replaceFolderCountString(text: string): string {
|
function replaceFolderCountString(text: string): string {
|
||||||
return text.replace(/Checking out \d+ folders/g, 'Checking out __FOLDER_COUNT__ folders');
|
return text.replace(/Checking out \d+ folders/g, 'Checking out __FOLDER_COUNT__ folders');
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Replace "https://github.com" and "git@github.com" with "__GITHUB_HOSTNAME__".
|
||||||
|
*/
|
||||||
|
function replaceGitHostname(text: string): string {
|
||||||
|
return text.replace(/(https?:\/\/|git\@)github\.com/g, '__GITHUB_HOSTNAME__');
|
||||||
|
}
|
||||||
|
|
||||||
async function* enumerateFolderPaths(
|
async function* enumerateFolderPaths(
|
||||||
absoluteFolderPath: string,
|
absoluteFolderPath: string,
|
||||||
|
|
Loading…
Reference in a new issue