Skip to content

Commit

Permalink
Merge pull request #42 from vtexdocs/fix-contentful-script-folder-cre…
Browse files Browse the repository at this point in the history
…ation

Fix contentful script folder creation
  • Loading branch information
PedroAntunesCosta authored Sep 24, 2024
2 parents e3bdf7c + 08f7b89 commit 2f7a3aa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ async function deleteMarkdownFiles(folderPath, isTopLevel = true) {
// Recursively delete markdown files in subdirectories
await deleteMarkdownFiles(filePath, false);
await fs.rmdir(filePath); // Delete folder after processing
console.log(`Deleted folder: ${filePath}`);
// console.log(`Deleted folder: ${filePath}`);
} else if (file.endsWith('.md')) {
// Delete markdown files
await fs.unlink(filePath);
console.log(`Deleted: ${filePath}`);
// console.log(`Deleted: ${filePath}`);
}
});

Expand Down Expand Up @@ -766,10 +766,10 @@ ${textPT}
// Construct the paths
const localeFolder = path.join('./docs', locales[i]);
const baseFolder = path.join(localeFolder, fileFolders);
const subFolder = fileSubFolder ? path.join(baseFolder, fileSubFolder).replace(": ", " - ") : null;
const subcategoryFolder = fileSubcategoryFolder ? path.join(subFolder, fileSubcategoryFolder).replace(": ", " - ") : null;
const subFolder = fileSubFolder ? path.join(baseFolder, fileSubFolder).replace(": ", " - ").trim() : null;
const subcategoryFolder = fileSubcategoryFolder ? path.join(subFolder, fileSubcategoryFolder).replace(": ", " - ").trim() : null;
const filePath = fileSubcategoryFolder ? path.join(subcategoryFolder, fileNameEN).replace(": ", " - ") : fileSubFolder ? path.join(subFolder, fileNameEN).replace(": ", " - ") : path.join(baseFolder, fileNameEN).replace(": ", " - ");

// Array of folders to create
const foldersToCreate = [localeFolder, baseFolder, subFolder, subcategoryFolder].filter(Boolean);

Expand Down

0 comments on commit 2f7a3aa

Please sign in to comment.