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

@shixinde/guoguo-cz

v6.0.0

Published

袁果锅生态 - 用于git cz 提交规范

Downloads

153

Readme

袁果锅生态

用于 git cz 提交规范

TIP

全局安装 commitizen,如此一来可以快速使用 czgit cz 命令进行启动。

npm install -g commitizen

格式化工具 --- pnpm lint

安装
  npm install -D prettier pretty-quick

 
执行
  "scripts": {
    "lint": "pretty-quick --staged",
  },

使用
  npm run lint | pnpm lint

提交规范工具 --- pnpm gitcz

安装

npm install -g commitizen  //全局安装  安装过可以不用安装

npm install -D cz-git
npm install @shixinde/guoguo-cz --save-dev
  1. 配置 ----> 在 package.json 中添加 config.commitizen 配置
  "scripts": {
     "gitcz": "git-cz"
    },
    
  "config": {
    "commitizen": {
      "path": "node_modules/cz-git",
      "czConfig": "node_modules/@shixinde/guoguo-cz/commitlint.config.js"
    },
    "commitlint": {
      "extends": [
        "@shixinde/guoguo-cz"
      ]
    }
  },
  1. 新增 ----> 在 根目录 中添加 commitlint.config.cjs 文件

"@commitlint/config-conventional" : 代码提交时的名称校验

"@shixinde/guoguo-cz":pnpm gitcz 文字格式化提示

module.exports = {
  extends: ["@commitlint/config-conventional", "@shixinde/guoguo-cz"],
};

安装 commitlint 工具和规则集

npm install --save-dev @commitlint/cli @commitlint/config-conventional

项目根目录新建文件 --> commitlint.config.cjs

Tip : 此处仅为技巧 , 使用袁果锅生态可省略此步骤

module.exports = {
  extends: ["@commitlint/config-conventional", "@shixinde/guoguo-cz"],
};

安装 husky (用于git 拦截)

npm install husky --save-dev   // 安装依赖

npx husky-init   // 安装初始化内容

pre-commit 中修改代码

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

 npm run lint

以下为全文件配置 -- 成功可忽略

image-20241119150321900

.gitignore

*

husky.sh

#!/usr/bin/env sh
if [ -z "$husky_skip_init" ]; then
  debug () {
    if [ "$HUSKY_DEBUG" = "1" ]; then
      echo "husky (debug) - $1"
    fi
  }

  readonly hook_name="$(basename -- "$0")"
  debug "starting $hook_name..."

  if [ "$HUSKY" = "0" ]; then
    debug "HUSKY env variable is set to 0, skipping hook"
    exit 0
  fi

  if [ -f ~/.huskyrc ]; then
    debug "sourcing ~/.huskyrc"
    . ~/.huskyrc
  fi

  readonly husky_skip_init=1
  export husky_skip_init
  sh -e "$0" "$@"
  exitCode="$?"

  if [ $exitCode != 0 ]; then
    echo "husky - $hook_name hook exited with code $exitCode (error)"
  fi

  if [ $exitCode = 127 ]; then
    echo "husky - command not found in PATH=$PATH"
  fi

  exit $exitCode
fi

commit-msg 校验是否报错 并不会校验提交的名称

#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit $1

pre-commit

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint

生成日志

conventional-changelog 可以根据项目的 commit 和 metadata 信息自动生成 changelogs 和 release notes 的系列工具。

安装

npm i -D conventional-changelog-cli conventional-changelog-gitmoji-config

将新脚本添加到您的 package.json

"scripts" : {
  ...
  "changelog": "conventional-changelog -p gitmoji-config -i CHANGELOG.md -s"
}

运行 npm run changelog 生成日志