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

@kvuse/commitlint-config

v1.2.2

Published

代码提交验证

Downloads

16

Readme

commitlint-config 提交验证

安装使用

  • 如果根目录没有package.json ,先添加,如果有请跳过该步骤
pnpm init
  • 安装依赖
pnpm add @kvuse/commitlint-config @commitlint/cli -D
  • 使用

⚠️ 仅第一次安装需要,如果已安装请跳过

使用命令添加配置文件

cd node_modules/@gt/commitlint-config

pnpm run preinstall

执行命令成功提示

添加.commitlintrc.json成功
添加.husky成功

添加提交eslint验证

  • package.json添加lint

    如果有请忽略

      "scripts": {
        "lint": "eslint ."
      },
  • .husky 添加 npm run lint命令

    // .husky/commit-msg
    #!/usr/bin/env sh
    . "$(dirname -- "$0")/_/husky.sh"
    
    npx --no -- commitlint --edit "$1"
    npm run lint

测试

git add .
git commit -m 'Feat更'

如果出现以下报错就成功了

⧗   input: Feat更
✖   subject may not be empty [subject-empty]
✖   type may not be empty [type-empty]

✖   found 2 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

husky - commit-msg hook exited with code 1 (error)

规则

[
  'feat', // 新功能(feature)
  'fix', // 修补bug
  'docs', // 文档
  'style', // 格式
  'refactor', // 重构
  'test', // 增加测试
  'revert', // 回滚
  'config', // 配置
  'chore', // 其他改动
  'debug', // 调试
  'build', // 打包构建
  'release', // 发布
],
  • 提交类型不能为空,必须包含: [feat, fix, docs, style, refactor, test, revert, config, chore, debug]
  • 开头必须有上述字段,例如:feat: 添加xx功能(字段: 冒号后要加空格)
  • 提交内容不能小于三个字符
  • 不能连续的字符或者数字

问题

如果提交出现command not found

.husky/commit-msg: line 4: npx: command not found

需要配置环境变量

这里用nvs举例

export NVS_HOME="$HOME/.nvs"
[ -s "$NVS_HOME/nvs.sh" ] && . "$NVS_HOME/nvs.sh"  # 这里是判断 nvs.sh 文件是否存在并执行

如果不行,请重启vscode或者重启电脑使环境变量生效