Registry / devops / ignore-sync

ignore-sync

JSON →
library8.0.0jsnpmunverified

ignore-sync is a command-line interface (CLI) tool designed to streamline the management and synchronization of various ignore files, such as `.gitignore`, `.npmignore`, and `.eslintignore`, across projects and repositories. Currently at version 8.0.0, this tool automates the tedious process of composing and maintaining multiple ignore files, which often involves combining patterns from different sources like GitHub's official gitignore templates (e.g., Node.gitignore + macOS.gitignore). Its key differentiator lies in its ability to consolidate ignore patterns from diverse sources—including specific files from GitHub repositories, local files (with optional relative path prefixing), and inline patterns—all configured within a single `*.ignore-sync` file. This approach significantly reduces manual updates, minimizes human error, and ensures consistent ignore rules throughout a development ecosystem. The package is actively maintained, though a specific release cadence isn't published. It targets Node.js environments (`^18.12.0 || >=20.9.0`) and is primarily used via `npm scripts` or `npx`.

npm install ignore-sync
INSTALL
IMPORT
SIG · IGNORE-SYNC
I
ignore-sync
devopsjavascriptv8.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

ignore-sync CLI
npx ignore-sync [path/to/config]
import ignoreSync from 'ignore-sync'
ignore-sync is a CLI tool and not intended for direct programmatic import into JavaScript/TypeScript files. It should be executed via `npx` or an npm script.
npm script integration
In `package.json` scripts: `"ignore-sync": "ignore-sync ."`
Directly running `node node_modules/ignore-sync/cli.js`
The recommended way to integrate and run ignore-sync in a project is by defining a dedicated script in `package.json` for ease of use and consistency.
Configuration file format
Create a file named `.gitignore-sync` (or similar) using INI-like syntax.
Attempting to use JSON or YAML for `*.ignore-sync` files.
Configuration files like `.gitignore-sync` use a custom INI-like format with bracketed source tags, not standard data interchange formats.

This quickstart demonstrates installing ignore-sync, configuring an npm script, creating a sample `.gitignore-sync` file with various source types, and running the tool to generate the `.gitignore` file.

npm install --save-dev ignore-sync // Add to package.json scripts // { // "scripts": { // "ignore-sync": "ignore-sync ." // } // } // Create a .gitignore-sync file in your project root // This example combines GitHub's Node and macOS gitignore files // with some local project-specific patterns. // Save this content as '.gitignore-sync' [github/gitignore] Node.gitignore Global/macOS.gitignore [inline] # Project-specific ignores *.test.js yarn.lock .env.local [local] # Reference another local ignore file, e.g., for build artifacts config/.buildignore // After creating the .gitignore-sync file, // run the command to generate or update .gitignore npm run ignore-sync
ignore-sync --version
Debug
Known issues
breakingMajor version updates (e.g., 7.x to 8.x) may introduce breaking changes to configuration file formats or CLI options. Always review the release notes for migration steps.
fix
Consult the official GitHub repository's release notes for version-specific breaking changes and migration guides.
affects: >=8.0.0
gotchaIncorrectly specified paths for `[local]` or `[relative]` source tags can lead to files not being found or unexpected ignore patterns. Glob patterns must be correctly formatted.
fix
Ensure local paths are correct relative to the `ignore-sync` configuration file and test glob patterns thoroughly. Use absolute paths if necessary or for clarity.
affects: >=1.0.0
gotchaRepeatedly fetching GitHub ignore files without proper caching or during rapid development can hit GitHub API rate limits, especially in CI/CD environments.
fix
Consider caching generated ignore files in CI/CD, or configure a GitHub token (if supported by `ignore-sync` or future versions) to increase rate limits. Run `ignore-sync` less frequently during development cycles.
affects: >=1.0.0
gotchaThe `ignore-sync` tool overwrites the target ignore file (e.g., `.gitignore`) based on its configuration. Make sure to back up any manually added patterns or content if you intend to merge them.
fix
Manually extract any unique patterns from the target ignore file and integrate them into an `[inline]` section of your `*.ignore-sync` file before running the tool.
affects: >=1.0.0
Errors
Common errors & fixes
command not found: ignore-sync
The `ignore-sync` package is installed as a dev dependency, but `npx` or an npm script is not being used, or the package is not installed.
fix
Ensure `ignore-sync` is installed (`npm install --save-dev ignore-sync`) and run it via `npx ignore-sync` or `npm run <your-script-name>` if defined in `package.json`.
Error: Failed to read file for source [local]: /path/to/nonexistent-file.ignore
A file specified under a `[local]` or `[relative]` source tag in the `*.ignore-sync` configuration does not exist at the given path.
fix
Double-check the file path specified in your `*.ignore-sync` file to ensure it's correct and the file exists. Paths are relative to the `ignore-sync` config file by default.
Error: Invalid GitHub repository format for source [github/gitignore]
The GitHub repository reference in `*.ignore-sync` (e.g., `github/gitignore`) is malformed or doesn't follow the `[$username/$repo#$ref]` pattern.
fix
Verify that the GitHub repository path is correctly formatted, including the username/organization and repository name. The optional `#$ref` (branch/commit) should also be valid.
Upgrade
Version history
8.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
ignore-sync — npm install ignore-sync · libregistry