{"id":16886119,"url":"https://github.com/vdustr/simple-ignore","last_synced_at":"2025-11-27T08:30:15.396Z","repository":{"id":221938319,"uuid":"755460664","full_name":"VdustR/simple-ignore","owner":"VdustR","description":"One `.gitignore` file to rule them all.","archived":true,"fork":false,"pushed_at":"2024-02-11T12:38:04.000Z","size":345,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-25T07:41:24.242Z","etag":null,"topics":["cli","docker","eslint","git","gitignore","ignorefile","monorepo","nodejs","npm","prettier","stylelint"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VdustR.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-10T09:24:46.000Z","updated_at":"2024-05-01T04:09:58.000Z","dependencies_parsed_at":"2024-02-11T08:38:38.127Z","dependency_job_id":null,"html_url":"https://github.com/VdustR/simple-ignore","commit_stats":null,"previous_names":["vdustr/simple-ignore"],"tags_count":4,"template":false,"template_full_name":"VdustR/template-aio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VdustR%2Fsimple-ignore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VdustR%2Fsimple-ignore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VdustR%2Fsimple-ignore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VdustR%2Fsimple-ignore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VdustR","download_url":"https://codeload.github.com/VdustR/simple-ignore/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239643207,"owners_count":19673572,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","docker","eslint","git","gitignore","ignorefile","monorepo","nodejs","npm","prettier","stylelint"],"created_at":"2024-10-13T16:38:21.626Z","updated_at":"2025-11-27T08:30:15.346Z","avatar_url":"https://github.com/VdustR.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simple-ignore\n\nOne `.gitignore` file to rule them all.\n\n## Background\n\n- Some tools do not consistently follow the rules outlined in the `.gitignore` file. While a few of these tools may offer the option to enforce `.gitignore` rules, this feature is not universally compatible. For example, there might be a necessity to exclude specific files from version control without modifying their formatting, such as autogenerated files like `CHANGELOG.md`.\n- Certain tools exhibit suboptimal performance within the VSCode workspace environment. For instance, `eslint` may encounter issues when used within a subfolder of a monorepo.\n- Different ignore files, such as `.dockerignore`, employ distinct syntax conventions. For instance, while specifying `package.json` in `.gitignore` is equivalent to `**/package.json` in `.dockerignore`, specifying `/package.json` in `.gitignore` equates to specifying `package.json` in `.dockerignore`.\n\n## Features\n\n- Generate ignore files for multiple tools.\n- Add extra rules for files that should not undergo formatting.\n- Structure ignore files for packages within monorepositories.\n- Translate rules into `.dockerignore` syntax.\n\n## Usage\n\nWhen embarking on a new project, it's advisable to procure the `.gitignore` file from [github/gitignore](https://github.com/github/gitignore).\n\nAlternatively, you can obtain one from Toptal by using the following command:\n\n```sh\ncurl -o .gitignore https://www.toptal.com/developers/gitignore/api/node\n```\n\nIf your repository is not a node project, you can generate a tailored `.gitignore` file for your needs on [Toptal's gitignore generator](https://www.toptal.com/developers/gitignore).\n\nIt's strongly encouraged to employ project-specific `.gitignore` files exclusively within the repository. Any environment-specific ignore files, such as those for operating systems or editors, should be stored directly within your user directory.\n\nTo obtain such files for macOS and Visual Studio Code, you can use the following command:\n\n```sh\ncurl -o ~/.gitignore https://www.toptal.com/developers/gitignore/api/macos,visualstudiocode\n```\n\nIf you're already working within a project, you can employ the following command to delete the ignore files:\n\n```sh\nrm .*ignore packages/*/.*ignore\ngit checkout .gitignore\n```\n\nIf you wish to lint the dotfiles using tools such as `eslint`, you can prepend it to the `.gitignore` file:\n\n```ini\n!.*\n```\n\nYou only need to maintain `.gitignore`, so you can remove all other files and append the following rules to it:\n\n```ini\n.*ignore\n!/.gitignore\n```\n\nAdd the following to your `package.json`:\n\n```json\n{\n  \"scripts\": {\n    \"postinstall\": \"npx simple-ignore\"\n  }\n}\n```\n\nEach time you run `npm install`, the required ignore files will be generated automatically, following the specifications outlined in the `.gitignore` file. Additionally, `simple-ignore` will detect monorepos and generate ignore files for each package by locating the `package.json` files.\n\nIf you prefer to run it locally or are concerned about potential breaking changes, we highly recommend installing and running it locally:\n\n```sh\nnpm install simple-ignore\nnpm exec simple-ignore\n```\n\n## Configuration\n\nTo customize the ignore files, simply add a `simple-ignore.config.ts` file to the root directory of your project.\n\n```ts\n// simple-ignore.config.ts\nimport { defineConfig } from \"simple-ignore\";\n\nexport default defineConfig({\n  // ...\n});\n```\n\nYou can also utilize other methods supported by [cosmiconfig](https://github.com/cosmiconfig/cosmiconfig), like adding a `simple-ignore` field to your `package.json` file.\n\nTo view all available options, you can refer to the [default configuration](https://github.com/VdustR/simple-ignore/blob/main/packages/simple-ignore/src/defaultConfig.ts).\n\n## CLI\n\n```sh\n# Default Usage\nnpx simple-ignore\n\n# Help Command\nnpx simple-ignore -h\n\n# Using Specific Configuration File\nnpx simple-ignore -c simple-ignore.config.ts\n\n# Dry Run Mode\nnpx simple-ignore -d\n\n# Overriding Rules\nnpx simple-ignore -lr __snapshots__,/package-lock.json,/pnpm-lock.yaml,/yarn.lock,CHANGELOG.md\n\n# Override Root Directory\n# By default, the rootDir is the directory where the configuration file resides.\n# If the configuration file is absent, the rootDir defaults to the directory where the command is executed.\n# You can specify a different rootDir using the -r flag.\nnpx simple-ignore -r ..\n```\n\n## API\n\n```ts\nimport { generateIgnoreFiles } from \"simple-ignore\";\n\nawait generateIgnoreFiles({\n  // configuration\n});\n```\n\n## License\n\n[MIT](https://github.com/VdustR/simple-ignore/blob/main/LICENSE)\n\nCopyright (c) 2024 ViPro \u003cvdustr@gmail.com\u003e (http://vdustr.dev)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvdustr%2Fsimple-ignore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvdustr%2Fsimple-ignore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvdustr%2Fsimple-ignore/lists"}