Change replace "/" with replaceAll "/"

This commit is contained in:
Pablo Portas López 2024-04-15 20:57:00 +02:00
parent 46e67f7259
commit 170b034679
3 changed files with 3 additions and 4 deletions

View File

@ -51,8 +51,7 @@ export const index = async (
const accessToken = await getAccessToken(options.client_email, options.private_key, options.path);
let siteUrl = convertToSiteUrl(input);
console.log(`🔎 Processing site: ${siteUrl}`);
const cacheFileName = `${convertToFilePath(siteUrl)}`+".json";
const cachePath = path.join(".cache", cacheFileName.replace("/", ""));
const cachePath = path.join(".cache", `${convertToFilePath(siteUrl)}.json`);
if (!accessToken) {
console.error("❌ Failed to get access token, check your service account credentials.");

View File

@ -20,7 +20,7 @@ export function convertToSiteUrl(input: string) {
* @returns The converted file path
*/
export function convertToFilePath(path: string) {
return path.replace("http://", "http_").replace("https://", "https_").replace("/", "_");
return path.replace("http://", "http_").replace("https://", "https_").replaceAll("/", "_");
}
/**

View File

@ -2,7 +2,7 @@
"compilerOptions": {
"target": "esnext",
"module": "commonjs",
"lib": ["dom", "es6", "es2017", "esnext.asynciterable"],
"lib": ["dom", "es6", "es2021", "esnext.asynciterable"],
"skipLibCheck": true,
"sourceMap": true,
"outDir": "./dist",