2
头图

background

In 19, I posted an article changelog log automatic generation plug-in , which introduced my open source set of [auto changelog, commit-lint] standardized code submission tool plug-in collection.

However, since it is the first time to release some open source projects, it is inevitable that the development plan is not very smooth, and it is not very smooth to use.

So based on these problems, this tool was upgraded with lerna. The general content is as follows:

jimi-web-changelog/cz --> nicecode/commit   // git 格式化 cli 提交插件
jimi-web-changelog/lint  -->  nicecode/commit-lint    // git 提交 lint 校验插件
jimi-web-changelog --> nicecode/changelog   // 日志自动生成插件

CZ module configuration optimization

official document

Original configuration

// 1、安装依赖
cnpm i commitizen jimi-web-changelog --save-dev

// 2、在 package.json 中添加
{
  ...
  "config": {
    "commitizen": {
      "path": "./node_modules/jimi-web-changelog/lib/cz"
    }
  },
  ...
}

New configuration

// 1、安装依赖
cnpm i commitizen @nicecode/commit --save-dev

// 2、在 package.json 中添加
{
  ...
  "config": {
    "commitizen": {
      "path": "@nicecode/commit"
    }
  },
  ...
}

lint module configuration optimization

official document

Original configuration

1. 安装依赖
cnpm i husky commitlint jimi-web-changelog --save-dev

2. 在 package.json 中引入以下配置
{
  ...
  "husky": {
    "hooks": {
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
    }
  },
  ...
}

3、根目录下 .commitlint.js 
modules.exports = Object.assign({}, require('jimi-web-changelog/lib/lint'), {
  rules: {
    'subject-empty': [2, 'never'],
    'type-empty': [2, 'never'],
    'type-enum': [2, 'always',
      [
        '新功能',
        '修复',
        ...
      ]
    ]
  }
}

New configuration

// 1. 安装依赖
cnpm i husky commitlint @nicecode/commit-lint --save-dev

// 2. 在 package.json 中引入以下配置
{
  ...
  "husky": {
    "hooks": {
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
    }
  },
  ...
}

// 3、根目录下 .commitlint.js 
modules.exports = {
  extends: ["@nicecode/commit-lint"]
}

Changelog module configuration optimization

official document

Original configuration

// 1、安装依赖
cnpm i conventional-changelog-cli jimi-web-changelog --save-dev

// 2、在package.json 中添加命令
{
  ...
  "script": {
    "log": "conventional-changelog --config node_modules/jimi-web-changelog/lib/log -i CHANGELOG.md -s -r 0",
  }
  ...
}

New configuration

// 1、安装依赖
cnpm i conventional-changelog-cli @nicecode/changelog --save-dev

// 2、在package.json 中添加命令
{
  ...
  "script": {
    "log": "conventional-changelog --n node_modules/@nicecode/changelog -i CHANGELOG.md -s -r 0",
  }
  ...
}

postscript

nicecoder team currently has 4 people, and is committed to integrating a set of tools to improve work efficiency and code standards. At present, our plans and has completed the following sections:

image.png

Looking forward to your joining: nicecoder

Related Links

@nicecode/tools Common function library

nicecode official website

nicecode github address


devlifestyle
66 声望9 粉丝

一个艺术家 | 自然流动