
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
git-grep-json
Advanced tools
It's a tool for git-grep. See https://git-grep-json.netlify.app/ also.
npm install git-grep-json
grep with -n and -C
git grep -n -C 2 -e "some" | npx grep2json
grep with -n and -A
git grep -n -A 1 -e "some" | npx grep2json
grep with -n and -B
git grep -n -B 1 -e "some" | npx grep2json
result
[
{
"fileName": "test.js",
"matchedLineNumber": 1,
"codeLines": [
"function someFunc(){",
" return 1;"
],
"lineRange": {
"start": 1,
"end": 2
}
},
{
"fileName": "test.js",
"matchedLineNumber": 6,
"codeLines": [
"function otherFunc(){",
" return \"awesome\";",
"}"
],
"lineRange": {
"start": 5,
"end": 7
}
}
]
grep2json.config.js in process currend directory can change the outout.
You can get grep2json.config.js with the below line
npx gren2json --init-config
configuration example
module.exports = {
prepareStore: async () => await Promise.resolve({}),
setupResult: async (block, structuredLine, store) => {
return await Promise.resolve({
fileName: structuredLine.fileName,
matchedLineNumber: structuredLine.lineNumber,
line: structuredLine.codeLine
});
}
};
prepareStore() in grep2json.config.js will be executed once before setupResult().
prepareStore() should return a Promise that resolves as any object.
setupResult() in grep2json.config.js will be executed with each matched line.
setupResult() should return a Promise that resolves as any object.
setupResult() receives block, line, and store as the parameters.
FAQs
A tool for git-grep
We found that git-grep-json demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.