{"id":13319,"library":"ignore-sync","title":"ignore-sync CLI Tool","description":"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`.","status":"active","version":"8.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/foray1010/ignore-sync","tags":["javascript",".dockerignore",".eslintignore",".gitignore",".npmignore","dockerignore","eslintignore","gitignore","ignore"],"install":[{"cmd":"npm install ignore-sync","lang":"bash","label":"npm"},{"cmd":"yarn add ignore-sync","lang":"bash","label":"yarn"},{"cmd":"pnpm add ignore-sync","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"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.","wrong":"import ignoreSync from 'ignore-sync'","symbol":"ignore-sync CLI","correct":"npx ignore-sync [path/to/config]"},{"note":"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.","wrong":"Directly running `node node_modules/ignore-sync/cli.js`","symbol":"npm script integration","correct":"In `package.json` scripts: `\"ignore-sync\": \"ignore-sync .\"`"},{"note":"Configuration files like `.gitignore-sync` use a custom INI-like format with bracketed source tags, not standard data interchange formats.","wrong":"Attempting to use JSON or YAML for `*.ignore-sync` files.","symbol":"Configuration file format","correct":"Create a file named `.gitignore-sync` (or similar) using INI-like syntax."}],"quickstart":{"code":"npm install --save-dev ignore-sync\n\n// Add to package.json scripts\n// {\n//   \"scripts\": {\n//     \"ignore-sync\": \"ignore-sync .\"\n//   }\n// }\n\n// Create a .gitignore-sync file in your project root\n// This example combines GitHub's Node and macOS gitignore files\n// with some local project-specific patterns.\n// Save this content as '.gitignore-sync'\n\n[github/gitignore]\nNode.gitignore\nGlobal/macOS.gitignore\n\n[inline]\n# Project-specific ignores\n*.test.js\nyarn.lock\n.env.local\n\n[local]\n# Reference another local ignore file, e.g., for build artifacts\nconfig/.buildignore\n\n// After creating the .gitignore-sync file,\n// run the command to generate or update .gitignore\nnpm run ignore-sync\n","lang":"typescript","description":"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."},"warnings":[{"fix":"Consult the official GitHub repository's release notes for version-specific breaking changes and migration guides.","message":"Major 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.","severity":"breaking","affected_versions":">=8.0.0"},{"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.","message":"Incorrectly 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"Repeatedly fetching GitHub ignore files without proper caching or during rapid development can hit GitHub API rate limits, especially in CI/CD environments.","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"The `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.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"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`.","cause":"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.","error":"command not found: ignore-sync"},{"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.","cause":"A file specified under a `[local]` or `[relative]` source tag in the `*.ignore-sync` configuration does not exist at the given path.","error":"Error: Failed to read file for source [local]: /path/to/nonexistent-file.ignore"},{"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.","cause":"The GitHub repository reference in `*.ignore-sync` (e.g., `github/gitignore`) is malformed or doesn't follow the `[$username/$repo#$ref]` pattern.","error":"Error: Invalid GitHub repository format for source [github/gitignore]"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"ignore-sync","cli_version":null}