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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@xjsxj/gitdir

v0.1.1

Published

> 搭建一个 git 提交代码处罚进行 “自动 git-commit 注释规范检查” 、 “自动执行 ESLINT 代码语法检查” 、“自动执行 Prettier 代码规范格式化” 环境

Readme

搭建一个 git 提交代码触发进行 “自动 git-commit 注释规范检查” 、 “自动执行 ESLINT 代码语法检查” 、“自动执行 Prettier 代码规范格式化” 环境

husky 哈士奇

用于配置 git hooks 执行脚本

npm install husky --save-dev

// package.json { "husky": { "hooks": { "pre-commit": "npm test", "...": "..." } } }

添加以上配置后,实现如下:

  1. 安装 husky 会改写 git hooks 脚本 "pre-commit" 文件(在 .git/hooks 目录内)
  2. 再执行 git commit , 对触发执行配置的命令,如 "npm test"。

commitizen

执行 git-cz 脚本,可按照提示写规范的git注释

npm install -D commitizen # 会安装一个 .bin/git-cz 命令 npm i -D cz-conventional-changelog # adapter: Making your repo Commitizen-friendly

// package.json "scripts": { "commit": "git-cz" # 配置脚本 }, "config": { "commitizen": { "path": "cz-conventional-changelog" # 配置 adapter 模块 } }

  1. 执行 npx git-cz, 可根据提示 ( adapter 的作用 ) 一步一步设置 git message

commitlint

独立用法

检查 String 信息是否符合规范,可通过设置 git hook 来检查 git commit 信息是否规范 执行 git commit 脚本,可验证 Msg 注释信息是否符合配置的规范

npm install -D @commitlint/cli # 生成 .bin/commitlint npm install -D @commitlint/config-conventional # 信息规范

// package.json { "commitlint": { "extends": [ "@commitlint/config-conventional" ] } }

=> echo "test: mm" | npx commitlint # 检验 msg 是否规范

与 husky 配合使用

实现检验 git-commit 的日志是否规范

// package.json { "husky": { "hooks": { "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" }
} }

git add . 
git commit -m "doc: 提交日志信息"

检验 msg 是否规范

与 commitizen 配合使用

npm install --save-dev @commitlint/prompt # 安装 commitizen adapter

// package.json { "config": { "commitizen": { "path": "@commitlint/prompt" // 配置 commitizen adapter } } }

=> npx git-cz # 也实现可根据提示 ( adapter 的作用 ) 一步一步设置 git message

故推荐使用 "@commitlint/prompt",确保使用一致 "@commitlint/config-conventional" 规范

lint-staged

用于基于被 git staged 的代码去进行验证代码有效性

npm install --save-dev lint-staged@beta

// package.json { "lint-staged": { "*": [ "your-cmd", "your-cmd1" ] } }

  1. 安装该模块后,该命令 node_modules/.bin/lint-staged 会自动生成。
  2. 上例中 package.json 里配置可执行脚本的目录范围为: *
  3. 可先执行 git add 缓存文件
  4. 再执行 npx lint-staged 会基于本次 缓存文件 与 目录范围 获取交集目录, 再基于该目录先后执行命令 your-cmd、your-cmd1

注意

  1. 实践下来,当配置了两种不同目录的不同命令时,只执行了第一级的命令。

standard-version

基于 semver.org 与 conventionalcommits 规范,自动更新版本及CHANGELOG文件。 注意不会帮忙执行 git push 和 npm publish 动作。

npm i --save-dev standard-version # 会安装一个 .bin/standard-version 命令

// package.json "scripts": { "version": "standard-version -r patch", }, "repository": { "url": "http://github.yqb.pub/xujia624/gitconventionDir" // 命令会基于该repo 做 git push 代码 },

// .npmrc registry=https://registry.npmjs.org/ # 命令会基于该 npm push 代码

且不是使用淘宝源站,因为它只是一个镜像备份库,无 push 代码功能。

运行 npn version 后执行如下:

  1. npm run preversion
  2. npm run version ✔ bumping version in package.json from 0.0.5 to 0.0.6 ✔ outputting changes to CHANGELOG.md ✔ committing package.json and CHANGELOG.md ✔ tagging release v0.0.6 提示ℹ Run git push --follow-tags origin gitdir && npm publish to publish
  3. npm run postversion

预先:npm login ( xujia / xujia30501062 ) -> logged 再运行 git push --follow-tags origin gitdir && npm publish 发布模块