fix: github hostname regex

This commit is contained in:
Cheng Liu 2024-03-11 16:09:53 -07:00
parent 8cd75c52e3
commit fdfaf6b72b
No known key found for this signature in database
GPG key ID: EEC8452F7DB85CD6
2 changed files with 5 additions and 5 deletions

View file

@ -1,4 +1,4 @@
Running "sparo clone __GITHUB_HOSTNAME__:tiktok/sparo.git --branch build-test":
Running "sparo clone __GITHUB_HOSTNAME__tiktok/sparo.git --branch build-test":
Sparo accelerator for Git __VERSION__ - https://tiktok.github.io/sparo/
Node.js version is __VERSION__ (LTS)

View file

@ -264,7 +264,7 @@ function processSparoOutput(text: string, workingDirectory: string): string {
replaceDurationString,
replaceWorkingDirectoryPath,
replaceFolderCountString,
replaceGitHostname
replaceGitHubHostname
].reduce((text, fn) => fn(text, workingDirectory), text);
}
/**
@ -292,10 +292,10 @@ function replaceFolderCountString(text: string): string {
return text.replace(/Checking out \d+ folders/g, 'Checking out __FOLDER_COUNT__ folders');
}
/**
* Replace "https://github.com" and "git@github.com" with "__GITHUB_HOSTNAME__".
* 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__');
function replaceGitHubHostname(text: string): string {
return text.replace(/(https?:\/\/|git\@)github\.com[/:]/g, '__GITHUB_HOSTNAME__');
}
async function* enumerateFolderPaths(