Skip to content

Commit

Permalink
fix: copy
Browse files Browse the repository at this point in the history
  • Loading branch information
whes1015 committed Dec 3, 2024
1 parent a6926eb commit a8b87fa
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/js/core/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -807,21 +807,27 @@ class PluginLoader {

const copyFiles = async (dir, baseTarget, baseSource) => {
const items = await fs.readdir(dir, { withFileTypes: true });
const ignoreFiles = ['.', 'package.json', 'package-lock.json', 'LICENSE'];

for (const item of items) {
if (item.name.startsWith('.')) {
if (item.name.startsWith('.') || ignoreFiles.includes(item.name)) {
continue;
}

const sourceFull = path.join(dir, item.name);
const targetFull = path.join(baseTarget, path.relative(baseSource, sourceFull));

if (item.isDirectory()) {
await fs.ensureDir(targetFull);
await copyFiles(sourceFull, baseTarget, baseSource);
try {
if (item.isDirectory()) {
await fs.ensureDir(targetFull);
await copyFiles(sourceFull, baseTarget, baseSource);
}
else {
await fs.copyFile(sourceFull, targetFull);
}
}
else {
await fs.copyFile(sourceFull, targetFull);
catch (error) {
console.error(`Error copying ${sourceFull}:`, error);
}
}
};
Expand Down

0 comments on commit a8b87fa

Please sign in to comment.