npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@iyowei/cli-fast-gitignore

v1.0.5

Published

命令行工具,用来生成、更新 .gitignore 文件。 ’github/gitignore‘ 模板库已内嵌。

Downloads

82

Readme

$ fast-gitignore | fgi [主题] [选项]

命令行工具,用来生成、更新 .gitignore 文件。 ’github/gitignore‘ 模板库已内嵌。

  • [x] 简单,非跨项目情况,一般而言,只需要运行 fast-gitignore / fgi 指令即可;
  • [x] 可离线 操作,所有模板在安装 @iyowei/cli-fast-gitignore 时就已经下载到本地,生成 .gitignore 文件非常快;
  • [x] 更新当前/指定项目的 .gitignore 文件;
  • [x] 支持 跨项目 创建 .gitignore 文件,并使用当前工作目录的预设;
  • [x] 无预设、无指定的情况下,可从 上次使用的预设 创建;
  • [x] 多入口读取预设,用户输入、用户预设、上次预设;

使用

在命令行里从上百个主题中选择,这并非高效的做法,所以 @iyowei/cli-fast-gitignore 并不提供交互式列表以供选择,推荐翻看 github/gitignore

$ 使用方式
  $ fast-gitignore | fgi [主题] [选项]

  选项
    --out, -o,                                 '.gitignore' 文件存储位置,默认:'process.cwd()'
    --config-from-cwd                          使用从当前工作路径处读取到的配置,跨项目操作时如有需要可使用

    --version, -V,                             查看版本号
    --help, -h                                 查看帮助

  示例
    $ fgi macOS Windows Linux                  在当前工作路径读取配置并生成(更新) .gitignore 文件

为当前项目生成

# 第一次生成
fgi macOS Windows Linux

# 更新
fgi

给非工作目录生成

即:在指定路径里生成生成/更新 .gitignore 文件。前提是指定路径里存在必须配置。如果指定路径没有预设,会读取上次预设,如果上次预设也没有,系统退出。

fgi -o /Users/iyowei/Development/iyowei/wext

# 当前工作路径 /Users/iyowei/Development/iyowei/cli-fast-gitignore
# 为 /Users/iyowei/Development/iyowei/wext 项目生成 .gitignore

使用当前项目的预设跨项目生成

fgi -o /Users/iyowei/Development/iyowei/wext --config-from-cwd

# 当前工作路径 /Users/iyowei/Development/iyowei/cli-fast-gitignore
# 为 /Users/iyowei/Development/iyowei/wext 项目生成 .gitignore

如果同时在配置文件、命令行中都指定了模板,@iyowei/cli-fast-gitignore 会选择在命令行中的声明。 💥

安装

Node Version Badge esm

在全局系统环境下使用的话,需要先全局安装 @iyowei/cli-fast-gitignore

NPM

npm i -g @iyowei/cli-fast-gitignore

PNPM

pnpm add @iyowei/cli-fast-gitignore --global

Yarn

yarn global add @iyowei/cli-fast-gitignore

预设

默认情况下,@iyowei/cli-fast-gitignore 会搜索以下文件中的 gitignore 属性:

  • package.json 属性;
  • JSON 或者 YAML 等无后缀的 rc 文件;
  • 有后缀的 rc 文件,诸如:.json, .yaml, .yml, 或者 .js
  • .config.js CommonJS 模块;

例如:

  • package.json 文件中的 gitignore 属性
  • JSON 或者 YAML 格式的 .gitignorerc 文件
  • .gitignorerc.json 文件
  • .gitignorerc.yaml, .gitignorerc.yml, 或者 .gitignorerc.js 文件
  • 导出一个 JS 对象的 gitignore.config.js 文件

@iyowei/cli-fast-gitignore 从工作目录开始搜索配置,如果在根目录没有找到,会继续搜索子目录,直到找到有效的配置。

预设示例:

{
  "gitignore": {
    "topics": [
      "macOS",
      "Windows",
      "Linux",
      "Node",
      "VisualStudioCode",
      "SublimeText",
      "CVS",
      "Diff",
      "Vim",
      "TortoiseGit"
    ],
    "custom": []
  }
}

相关

参与贡献

PRs Welcome