update with prettier

This commit is contained in:
Antoine Kingue 2024-06-29 13:49:31 +02:00
parent 177a8f1daf
commit 5632c342ca
2 changed files with 4 additions and 4 deletions

View File

@ -95,7 +95,7 @@ export const index = async (input: string = process.argv[2], options: IndexOptio
pages = checkCustomUrls(siteUrl, pages);
console.log(`👉 Found ${pages.length} URLs in the provided list`);
}
const statusPerUrl: Record<string, { status: Status; lastCheckedAt: string }> = existsSync(cachePath)
? JSON.parse(readFileSync(cachePath, "utf8"))
: {};
@ -123,7 +123,7 @@ export const index = async (input: string = process.argv[2], options: IndexOptio
const shouldRecheck = (status: Status, lastCheckedAt: string) => {
const shouldIndexIt = indexableStatuses.includes(status);
const isOld = new Date(lastCheckedAt) < new Date(Date.now() - CACHE_TIMEOUT);
return shouldIndexIt && isOld;;
return shouldIndexIt && isOld;
};
await batch(

View File

@ -130,7 +130,7 @@ export async function checkSiteUrl(accessToken: string, siteUrl: string) {
export function checkCustomUrls(siteUrl: string, urls: string[]) {
const protocol = siteUrl.startsWith("http://") ? "http://" : "https://";
const domain = siteUrl.replace("https://", "").replace("http://", "").replace("sc-domain:", "");
const formattedUrls: string[] = urls.map((url) =>{
const formattedUrls: string[] = urls.map((url) => {
url = url.trim();
if (url.startsWith("/")) {
// the url is a relative path (e.g. /about)
@ -143,7 +143,7 @@ export function checkCustomUrls(siteUrl: string, urls: string[]) {
return `${protocol}${url}`;
} else {
// the url is a relative path without the leading slash (e.g. about)
return `${protocol}${domain}/${url}`
return `${protocol}${domain}/${url}`;
}
});