Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
common-ignore
Advanced tools
A tool for generating .gitignore and .npmignore files with a common file for both ignores.
A tool for generating .gitignore and .npmignore files with a common file for both ignores.
npm install --save-dev common-ignore
.npmignore
works.By default npm uses .gitignore
. If there is also a .npmignore
file, then npm will use the .npmignore
file instead of the .gitignore
file.
The .npmignore
file can be useful, especially for repositories with other files that the npm package doesn't need. However, you need to remember to also include things that would be in .gitignore
, which usually include secrets. It can be annoying to copy and paste things from .gitignore
to .npmignore
, and it can be easy to forget. For example, you could add something to .gitignore
, but then forgot to also add it to .npmignore
.
There are three properties in a config object
./
, for top level outputs.)a.txt
extends b.txt
, and b.txt
extends c.txt
, then a.txt
will extend both b.txt
and c.txt
..gitignore
or .npmignore
, but you can add whatever output names you want.Here is an example which has two inputs. git.txt
and npm.txt
. Both of them extend common.txt
, which is another file in the commonignore
folder.
{
inputDir: "./commonignore",
outputDir: "./",
files: {
"git.txt": {
extends: ["common.txt"],
output: ".gitignore"
},
"npm.txt": {
extends: ["common.txt"],
output: ".npmignore"
},
"another.txt": {
extends: ["git.txt", "npm.txt"],
output: "another.ignore"
}
}
}
import commonIgnore from 'common-ignore'
The commonIgnore function takes two parameters. The first one is the options / config. The second parameter is optional, and it is the base directory. Usually the base directory is the root folder of your project. It returns a promise, which resolves undefined
once done.
Example
commonIgnore(myOptions, __dirname)
.then(() => {
console.log("Done");
})
.catch(err => {
console.log("Error");
})
FAQs
A tool for generating .gitignore and .npmignore files with a common file for both ignores.
We found that common-ignore 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.