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

vue-cli-plugin-commitlint

v1.0.12

Published

基于vue-cli3的代码提交检查规范

Downloads

221

Readme

Git commit 规范

结合 commitizen commitlint conventional-changelog-cli husky,进行封装,一键安装,开箱即用的 git commit 规范。

功能

  1. 自动检测 commit 是否规范,不规范不允许提交
  2. 自动提示 commit 填写格式。不怕忘记规范怎么写
  3. 集成 git add . && git commit 不需要在执行两个命令
  4. 自动生成 changelog

配置

  1. 如果您是 vue-cli3 的项目可以直接使用即可
vue add commitlint
  1. 如果您不是 vue-cli3 的项目
npm i vue-cli-plugin-commitlint commitizen commitlint conventional-changelog-cli husky -D
  • 在 package.json 中添加
{
  "scripts": {
    "log": "conventional-changelog --config ./node_modules/vue-cli-plugin-commitlint/lib/log -i CHANGELOG.md -s -r 0",
    "cz": "npm run log && git add . && git cz"
  },
  "husky": {
    "hooks": {
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
    }
  },
  "config": {
    "commitizen": {
      "path": "./node_modules/vue-cli-plugin-commitlint/lib/cz"
    }
  }
}

增加 commitlint.config.js 文件

module.exports = {
  extends: ['./node_modules/vue-cli-plugin-commitlint/lib/lint']
};

使用

npm run cz  # git add . && git commit -m 'feat:(xxx): xxx'
npm run log # 生成 CHANGELOG
  1. 代码提交 npm run cz

commander

  1. 选择一个类型会自动询问

    1. (非必填)本次提交的改变所影响的范围
    2. (必填)写一个简短的变化描述
    3. (非必填)提供更详细的变更描述
    4. (非必填)是否存在不兼容变更?
    5. (非必填)此次变更是否影响某些打开的 issue

prompt

changelog 演示

changelog

规则

| 规范名 | 描述 | | -------- | ------------------------------------------------------- | | docs | 仅仅修改了文档,比如 README, CHANGELOG, CONTRIBUTE 等等 | | chore | 改变构建流程、或者增加依赖库、工具等 | | feat | 新增 feature | | fix | 修复 bug | | merge | 合并分之 | | perf | 优化相关,比如提升性能、体验 | | refactor | 代码重构,没有加新功能或者修复 bug | | revert | 回滚到上一个版本 | | style | 仅仅修改了空格、格式缩进、都好等等,不改变代码逻辑 | | test | 测试用例,包括单元测试、集成测试等 |