{"id":18777285,"url":"https://github.com/iyowei/cli-fast-gitignore","last_synced_at":"2025-07-05T01:34:19.468Z","repository":{"id":57119746,"uuid":"442432028","full_name":"iyowei/cli-fast-gitignore","owner":"iyowei","description":"命令行工具，用来生成、更新 .gitignore 文件。 ’github/gitignore‘ 模板库已内嵌。","archived":false,"fork":false,"pushed_at":"2022-12-08T05:56:33.000Z","size":169,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-19T16:47:42.896Z","etag":null,"topics":["cli","generator","gitignore","iyowei","scoffold","tool"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/iyowei.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}},"created_at":"2021-12-28T10:44:57.000Z","updated_at":"2022-01-06T11:20:33.000Z","dependencies_parsed_at":"2023-01-24T15:15:55.759Z","dependency_job_id":null,"html_url":"https://github.com/iyowei/cli-fast-gitignore","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyowei%2Fcli-fast-gitignore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyowei%2Fcli-fast-gitignore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyowei%2Fcli-fast-gitignore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyowei%2Fcli-fast-gitignore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iyowei","download_url":"https://codeload.github.com/iyowei/cli-fast-gitignore/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239687440,"owners_count":19680733,"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","generator","gitignore","iyowei","scoffold","tool"],"created_at":"2024-11-07T20:09:35.717Z","updated_at":"2025-02-19T15:44:42.923Z","avatar_url":"https://github.com/iyowei.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# $ fast-gitignore | fgi [主题] [选项]\n\n命令行工具，用来生成、更新 .gitignore 文件。 ’github/gitignore‘ 模板库已内嵌。\n\n- [x] **简单**，非跨项目情况，一般而言，只需要运行 `fast-gitignore` / `fgi` 指令即可；\n- [x] **可离线** 操作，所有模板在安装 [@iyowei/cli-fast-gitignore][@iyowei/cli-fast-gitignore] 时就已经下载到本地，生成 `.gitignore` 文件非常快;\n- [x] 更新当前/指定项目的 .gitignore 文件；\n- [x] 支持 **跨项目** 创建 .gitignore 文件，并使用当前工作目录的预设；\n- [x] 无预设、无指定的情况下，可从 **上次使用的预设** 创建；\n- [x] 多入口读取预设，用户输入、用户预设、上次预设；\n\n## 使用\n\n\u003e 在命令行里从上百个主题中选择，这并非高效的做法，所以 [@iyowei/cli-fast-gitignore][@iyowei/cli-fast-gitignore] 并不提供交互式列表以供选择，推荐翻看 [github/gitignore][github/gitignore]。\n\n```\n$ 使用方式\n  $ fast-gitignore | fgi [主题] [选项]\n\n  选项\n    --out, -o,                                 '.gitignore' 文件存储位置，默认：'process.cwd()'\n    --config-from-cwd                          使用从当前工作路径处读取到的配置，跨项目操作时如有需要可使用\n\n    --version, -V,                             查看版本号\n    --help, -h                                 查看帮助\n\n  示例\n    $ fgi macOS Windows Linux                  在当前工作路径读取配置并生成（更新） .gitignore 文件\n```\n\n### 为当前项目生成\n\n```shell\n# 第一次生成\nfgi macOS Windows Linux\n\n# 更新\nfgi\n```\n\n### 给非工作目录生成\n\n即：在指定路径里生成生成/更新 .gitignore 文件。前提是指定路径里存在必须配置。如果指定路径没有预设，会读取上次预设，如果上次预设也没有，系统退出。\n\n```shell\nfgi -o /Users/iyowei/Development/iyowei/wext\n\n# 当前工作路径 /Users/iyowei/Development/iyowei/cli-fast-gitignore\n# 为 /Users/iyowei/Development/iyowei/wext 项目生成 .gitignore\n```\n\n### 使用当前项目的预设跨项目生成\n\n```shell\nfgi -o /Users/iyowei/Development/iyowei/wext --config-from-cwd\n\n# 当前工作路径 /Users/iyowei/Development/iyowei/cli-fast-gitignore\n# 为 /Users/iyowei/Development/iyowei/wext 项目生成 .gitignore\n```\n\n**如果同时在配置文件、命令行中都指定了模板，[@iyowei/cli-fast-gitignore][@iyowei/cli-fast-gitignore] 会选择在命令行中的声明。** 💥\n\n## 安装\n\n[![Node Version Badge][node version badge]][download node.js] ![esm][esm]\n\n在全局系统环境下使用的话，需要先全局安装 [@iyowei/cli-fast-gitignore][@iyowei/cli-fast-gitignore]，\n\n**NPM**\n\n```shel\nnpm i -g @iyowei/cli-fast-gitignore\n```\n\n**PNPM**\n\n```shel\npnpm add @iyowei/cli-fast-gitignore --global\n```\n\n**Yarn**\n\n```shel\nyarn global add @iyowei/cli-fast-gitignore\n```\n\n## 预设\n\n默认情况下，[@iyowei/cli-fast-gitignore][@iyowei/cli-fast-gitignore] 会搜索以下文件中的 `gitignore` 属性：\n\n- `package.json` 属性；\n- `JSON` 或者 `YAML` 等无后缀的 `rc` 文件；\n- 有后缀的 `rc` 文件，诸如：`.json`, `.yaml`, `.yml`, 或者 `.js`；\n- `.config.js` **CommonJS** 模块；\n\n例如：\n\n- `package.json` 文件中的 `gitignore` 属性\n- `JSON` 或者 `YAML` 格式的 `.gitignorerc` 文件\n- `.gitignorerc.json` 文件\n- `.gitignorerc.yaml`, `.gitignorerc.yml`, 或者 `.gitignorerc.js` 文件\n- 导出一个 JS 对象的 `gitignore.config.js` 文件\n\n[@iyowei/cli-fast-gitignore][@iyowei/cli-fast-gitignore] 从工作目录开始搜索配置，如果在根目录没有找到，会继续搜索子目录，直到找到有效的配置。\n\n预设示例：\n\n```json\n{\n  \"gitignore\": {\n    \"topics\": [\n      \"macOS\",\n      \"Windows\",\n      \"Linux\",\n      \"Node\",\n      \"VisualStudioCode\",\n      \"SublimeText\",\n      \"CVS\",\n      \"Diff\",\n      \"Vim\",\n      \"TortoiseGit\"\n    ],\n    \"custom\": []\n  }\n}\n```\n\n## 相关\n\n- [@iyowei/fast-gitignore][@iyowei/fast-gitignore]，API，收集模板但不会生成 .gitignore 文件；\n- [@iyowei/latest-gitignore][@iyowei/latest-gitignore]，API，从远程 [github/gitignore][github/gitignore] 收集模板，不会生成 .gitignore 文件；\n- [@iyowei/cli-latest-gitignore][@iyowei/cli-latest-gitignore]，命令行应用，生成 .gitignore 文件。\n\n## 参与贡献\n\n![PRs Welcome][prs welcome badge]\n\n[github/gitignore]: https://github.com/github/gitignore\n[@iyowei/cli-fast-gitignore]: https://github.com/iyowei/cli-fast-gitignore\n[@iyowei/latest-gitignore]: https://github.com/iyowei/latest-gitignore\n[@iyowei/cli-latest-gitignore]: #\n[@iyowei/fast-gitignore]: https://github.com/iyowei/fast-gitignore\n[node version badge]: https://img.shields.io/badge/node.js-%3E%3D12.20.0-brightgreen?style=flat\u0026logo=Node.js\n[download node.js]: https://nodejs.org/en/download/\n[prs welcome badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat\n[esm]: https://img.shields.io/badge/ESM-brightgreen?style=flat\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiyowei%2Fcli-fast-gitignore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiyowei%2Fcli-fast-gitignore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiyowei%2Fcli-fast-gitignore/lists"}