Skip to content

Commit

Permalink
fix(assets): copy nested files and directories when no wildcard #2687
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Aug 9, 2024
1 parent 6ebb6e5 commit 793f319
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lib/compiler/assets-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,18 @@ export class AssetsManager {

this.watchers.push(watcher);
} else {
const files = sync(item.glob, { ignore: item.exclude }).filter(
(matched) => statSync(matched).isFile(),
);
const matchedPaths = sync(item.glob, { ignore: item.exclude });
const files = item.glob.endsWith('*')
? matchedPaths.filter((matched) => statSync(matched).isFile())
: matchedPaths.flatMap((matched) => {
if (statSync(matched).isDirectory()) {
return sync(`${matched}/**/*`, {
ignore: item.exclude,
}).filter((file) => statSync(file).isFile());
}
return matched;
});

for (const path of files) {
this.actionOnFile({ ...option, path, action: 'change' });
}
Expand Down

0 comments on commit 793f319

Please sign in to comment.