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

@brickjs-fe/commit-config

v0.0.3

Published

BrickJs 提交规范配置包 - 包含 Commitlint、Commitizen 和 Husky 配置

Downloads

13

Readme

@brickjs-fe/commit-config

BrickJs Logo

BrickJs 提交规范配置包 - 包含 Commitlint、Commitizen 和 Husky 配置

npm version npm downloads License: MIT

📖 介绍

BrickJs 提交规范配置包提供了一套完整的 Git 提交规范解决方案,基于 Conventional Commits 规范,集成了:

  • Commitlint - 提交信息格式检查
  • Commitizen - 交互式提交信息生成
  • Husky - Git 钩子配置
  • Lint-staged - 暂存文件检查配置

✨ 特性

  • 🎯 严格的提交规范 - 基于 Conventional Commits 标准
  • 🎨 友好的交互界面 - 使用 Emoji 和中文提示
  • 🔧 开箱即用 - 预配置所有必要的工具
  • 📝 自动化检查 - 集成 Git 钩子和暂存文件检查
  • 🚀 易于扩展 - 可自定义规则和配置

🚀 一键安装,自动配置

超简单安装

只需要一行命令,所有配置自动完成:

# 使用 pnpm(推荐)
pnpm add -D @brickjs-fe/commit-config

# 使用 npm
npm install --save-dev @brickjs-fe/commit-config

# 使用 yarn
yarn add -D @brickjs-fe/commit-config

就是这么简单! 🎉

安装完成后,包会自动:

  • ✅ 智能创建配置文件(ESM 项目生成 .mjs,CommonJS 项目生成 .js
  • ✅ 在 package.json 中添加 commitizen 配置
  • ✅ 添加 pnpm commit 脚本
  • ✅ 如果检测到 husky,自动配置 Git 钩子

可选依赖

如果你想要完整的提交检查功能,可以额外安装:

# 基础依赖(commitlint 检查)
pnpm add -D @commitlint/cli @commitlint/config-conventional

# Git 钩子支持
pnpm add -D husky

# 暂存文件检查
pnpm add -D lint-staged

# 全局 commitizen(可选)
npm install -g commitizen

手动配置(高级用户)

如果你需要自定义配置或者自动配置失败,可以手动设置:

1. Commitlint 配置

创建 commitlint.config.js 文件:

export default {
  extends: ['@brickjs-fe/commit-config']
};

2. Commitizen 配置

package.json 中添加:

{
  "config": {
    "commitizen": {
      "path": "@brickjs-fe/commit-config/cz-config.js"
    }
  },
  "scripts": {
    "commit": "cz"
  }
}

3. Husky 配置(可选)

# 初始化 Husky
npx husky init

# 添加 commit-msg 钩子
echo 'npx --no -- commitlint --edit $1' > .husky/commit-msg

📝 使用方法

交互式提交

安装完成后,使用以下命令进行交互式提交:

# 推荐方式(自动配置的脚本)
pnpm commit

# 或者直接使用 commitizen
npx cz

# 完整流程
git add .
pnpm commit

提交类型说明

| 类型 | 描述 | Emoji | |------------|-----------------------------------|-------| | feat | 新功能 | ✨ | | fix | 修复 Bug | 🐛 | | docs | 文档修改 | 📝 | | style | 代码格式调整(不影响功能) | 💄 | | refactor | 代码重构 | ♻️ | | perf | 性能优化 | ⚡️ | | test | 测试相关 | ✅ | | chore | 构建过程或辅助工具的变动 | 🔧 | | ci | CI/CD 相关 | 🤖 | | build | 构建系统或外部依赖的变动 | 📦 | | revert | 回滚提交 | ⏪ | | release | 发布版本 | 🚀 |

提交信息格式

<type>(<scope>): <emoji> <subject>

<body>

<footer>

示例:

feat(auth): ✨ 添加用户登录功能

实现了基于 JWT 的用户认证系统
支持用户名和邮箱登录

Closes #123

🔧 高级配置

自定义 Commitlint 规则

import { getCommitlintConfig } from '@brickjs-fe/commit-config';

const config = getCommitlintConfig();

export default {
  ...config,
  rules: {
    ...config.rules,
    // 自定义规则
    'header-max-length': [2, 'always', 120],
    'scope-enum': [2, 'always', ['auth', 'core', 'ui']]
  }
};

自定义 Commitizen 配置

import { getCzConfig } from '@brickjs-fe/commit-config';

const config = getCzConfig();

export default {
  ...config,
  scopes: ['auth', 'core', 'ui'], // 自定义作用域
  types: {
    ...config.types,
    // 添加自定义类型
    wip: { description: '开发中', emoji: '🚧', value: 'wip' }
  }
};

自定义 Husky 钩子

import { getHuskyHooks } from '@brickjs-fe/commit-config';

const hooks = getHuskyHooks();

// 在 .husky/ 目录下创建对应的钩子文件
// 例如 .husky/pre-commit
console.log(hooks['pre-commit']); // npx lint-staged

📁 项目结构

@brickjs-fe/commit-config/
├── index.js              # 主入口文件
├── commitlint.config.js  # Commitlint 配置
├── cz-config.js          # Commitizen 配置
├── package.json          # 包配置
├── README.md             # 说明文档
└── LICENSE               # 许可证

🔍 API 文档

getCommitlintConfig()

获取 Commitlint 配置对象。

import { getCommitlintConfig } from '@brickjs-fe/commit-config';

const config = getCommitlintConfig();

getCzConfig()

获取 Commitizen 配置对象。

import { getCzConfig } from '@brickjs-fe/commit-config';

const config = getCzConfig();

getHuskyHooks()

获取推荐的 Husky 钩子配置。

import { getHuskyHooks } from '@brickjs-fe/commit-config';

const hooks = getHuskyHooks();
// {
//   'commit-msg': 'npx --no -- commitlint --edit $1',
//   'pre-commit': 'npx lint-staged',
//   'pre-push': 'npm run test'
// }

getLintStagedConfig()

获取推荐的 lint-staged 配置。

import { getLintStagedConfig } from '@brickjs-fe/commit-config';

const config = getLintStagedConfig();

🤝 贡献指南

  1. Fork 本仓库
  2. 创建特性分支 (git checkout -b feature/AmazingFeature)
  3. 提交更改 (git commit -m 'feat: ✨ add some AmazingFeature')
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 打开 Pull Request

📄 许可证

本项目基于 MIT 许可证开源。

🔗 相关链接


如果这个包对你有帮助,请给它一个 ⭐️

报告问题 · 提出建议