Closed haozi closed 1 year ago
filter
is passed all paths, including directories. You'll have to add logic to only run your .js
check on files, and return true
for directories (note that this will copy empty directories if they do not contain JS files).
filter
is passed all paths, including directories. You'll have to add logic to only run your.js
check on files, and returntrue
for directories (note that this will copy empty directories if they do not contain JS files).
but if allow folder return true, it will copy a lot of empty folder
Honestly, the filter probably isn't the best tool for the job here, you'd be better off using something like https://www.npmjs.com/package/globby to get a list of JS files, then copying each of them individually.
Honestly, the filter probably isn't the best tool for the job here, you'd be better off using something like https://www.npmjs.com/package/globby to get a list of JS files, then copying each of them individually.
Could you consider adding support for glob matching in the first parameter? Like:
fs.copy('src/**/*.png', dest)
Glob support adds another entire layer of complexity and edge cases to deal with, it's unlikely we'll add it.
when I copying a folder, I wish skip file it is not *.js ,but if I return false, it will break copy, the desired purpose is to copy all non-.js files
fs-extra
version: