Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion apps/zui/scripts/download-zdeps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,24 @@ async function zedDevBuild(destPath) {
}
}

// Suricata rules are dropped from the Windows build to fix a false positive
// malware flagging. See https://github.com/brimdata/zui/issues/2857.
const filterBrimcapZdeps = (src, dest) => {
if (process.platform == "win32" &&
(/suricata\.rules$/.test(src) || /emerging\.rules\.tar\.gz$/.test(src)) &&
fs.statSync(src).isFile()) {
return false
} else {
return true
}
}

async function main() {
try {
fs.copySync(
path.resolve("..", "..", "node_modules", "brimcap", "build", "dist"),
zdepsPath
zdepsPath,
{ filter: filterBrimcapZdeps }
Copy link
Member

@nwt nwt Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nits: I'd just use an arrow function. And no need for an if statement. And I'd just use one regular expression.

Non-nit: fs.statSync is much slower than the other tests so call it last.

Suggested change
{ filter: filterBrimcapZdeps }
{
// Drop Suricata rules on Windows to fix false positive malware flagging.
// See https://github.com/brimdata/zui/issues/2857.
filter: (src, _dest) =>
process.platform == "win32" &&
src.match(/(emerging\.rules\.tar\.gz|suricata\.rules)$/) &&
fs.statSync(src).isFile(),
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@philrz: My original suggestion had some bad syntax and bad formatting so I updated it.

)
const brimcapVersion = child_process
.execSync(path.join(zdepsPath, "brimcap") + " -version")
Expand Down