Skip to content

Commit a790c0a

Browse files
authored
refactor: don't copy markdown files if they already exist (#649)
1 parent 27f455c commit a790c0a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

vite-config/markdownPlugin.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async function processCssFile(src, dest) {
3131
}
3232
}
3333

34-
const createMarkdownPlugin = () => {
34+
const createMarkdownPlugin = (force = false) => {
3535
return {
3636
name: "markdown-plugin",
3737
async buildStart() {
@@ -84,6 +84,12 @@ const createMarkdownPlugin = () => {
8484
const { src, dest, type } = operation;
8585
const destDir = dirname(dest);
8686

87+
if (!force && existsSync(dest)) {
88+
console.log(`ℹ Skipping existing file: ${dest}`);
89+
90+
continue;
91+
}
92+
8793
// Ensure destination directory exists
8894
if (!existsSync(destDir)) {
8995
mkdirSync(destDir, { recursive: true });

0 commit comments

Comments
 (0)