Skip to content
Merged
16 changes: 15 additions & 1 deletion packages/wxt/src/core/zip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,23 @@ async function zipDir(
onlyFiles: true,
})
).filter((relativePath) => {
function negateCheck() {
return options?.exclude?.some(
(option) =>
option.startsWith('!') && minimatch(relativePath, option.slice(1)),
);
}
if (negateCheck()) {
return true;
}
Comment thread
nishu-murmu marked this conversation as resolved.
Outdated
const updatedExcludeOptions = options?.exclude?.filter(
(option) => !option.startsWith('!'),
);
return (
options?.include?.some((pattern) => minimatch(relativePath, pattern)) ||
!options?.exclude?.some((pattern) => minimatch(relativePath, pattern))
!updatedExcludeOptions?.some((pattern) =>
minimatch(relativePath, pattern),
)
);
});
const filesToZip = [
Expand Down