@chengyixu/gitignore-gen
v1.0.0
Published
Generate .gitignore files from GitHub templates. Supports multiple languages, auto-detection, and local caching.
Downloads
63
Maintainers
Readme
gitignore-gen
Generate .gitignore files from GitHub's official templates. Supports 155+ languages and frameworks, multi-language projects, auto-detection, and local caching.
Install
npm install -g gitignore-genUsage
Generate for a single language
gitignore-gen node
gitignore-gen python
gitignore-gen rustCombine multiple templates
gitignore-gen node python reactDuplicate rules are automatically deduplicated.
Auto-detect project type
gitignore-gen --initScans your project directory for package.json, requirements.txt, go.mod, Cargo.toml, etc. and generates the right .gitignore automatically.
List all available templates
gitignore-gen --listWrite directly to file
# Write to .gitignore
gitignore-gen node --write
# Write to custom path
gitignore-gen node -o .gitignore.backup
# Append to existing .gitignore
gitignore-gen python --write --appendBypass cache
gitignore-gen node --no-cacheSupported Aliases
Use friendly names instead of exact GitHub template names:
| Alias | Template |
|-------|----------|
| node, js, javascript, ts, typescript | Node |
| python, py, django, flask | Python |
| react, vue, angular, nextjs | Node |
| go, golang | Go |
| rust | Rust |
| java | Java |
| ruby, rb | Ruby |
| swift, ios, macos | Swift |
| kotlin | Kotlin |
| csharp, c# | VisualStudio |
| cpp, c++ | C++ |
| dart, flutter | Dart |
| php, laravel | Laravel |
| tex, latex | TeX |
| unity | Unity |
| unreal | UnrealEngine |
| android | Android |
| terraform | Terraform |
...and many more. Partial matching is also supported.
Features
- Fetches from GitHub's official gitignore API (155+ templates)
- Bundled fallback templates for offline use
- 24-hour local cache for speed
- Smart alias resolution (e.g.,
js-> Node,py-> Python) - Multi-template merging with deduplication
- Project type auto-detection (
--init) - Stdout by default,
--writefor file output
License
MIT
