Registry / devops / gitignore

gitignore

JSON →
library0.7.0jsnpmunverified

CLI tool and Node.js module to automatically fetch .gitignore templates for any project type from GitHub's official gitignore repository. Current stable version is 0.7.0. Release cadence is irregular; last update was in 2019. Key differentiator: provides both a global CLI command and a programmatic API, with support for NPX for one-off invocations. Compared to alternatives (e.g., gitignore.io), it directly pulls from GitHub's authoritative collection with no external API dependency.

devops
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

This package is CommonJS-only; ESM import will fail. Use require for now.

const { getTypes } = require('gitignore');

Same as getTypes: CommonJS only. No default export; named exports require destructuring.

const { writeFile } = require('gitignore');

If you import the whole module, it will be an object with getTypes and writeFile. ESM import will not work.

const gitignore = require('gitignore');

Programmatically fetch the Node.gitignore template and write it to a local file.

const { writeFile } = require('gitignore'); const fs = require('fs'); const fileStream = fs.createWriteStream('.gitignore'); writeFile({ type: 'node', file: fileStream }, (err) => { if (err) console.error(err); else console.log('Created .gitignore for Node'); });
Debug
Known footguns
deprecatedPackage uses deprecated 'request' library which is no longer maintained.
gotchaCLI command needs global install or npx; using globally installed version may conflict with module install.
gotchaThe 'types' list is fetched live from GitHub; network issues can cause failure.
gotchaThe module's getTypes and writeFile only work with callbacks; no promise support.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
8 hits · last 30 days
gptbot
3
ahrefsbot
1
Resources