From da05d395fbccfebd0dcd496bd14d8196844c3269 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 13 Mar 2022 16:47:22 +0800 Subject: [PATCH 1/3] build(npm): use the global `commitlint` & `husky` --- .husky/commit-msg | 2 +- package.json | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/.husky/commit-msg b/.husky/commit-msg index 7fed485..4037788 100755 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1,4 +1,4 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -npx --no -- commitlint --edit +npx --no -- commitlint -x $(npm root -g)/@commitlint/config-conventional --edit diff --git a/package.json b/package.json index a17cfe9..0df4c73 100644 --- a/package.json +++ b/package.json @@ -12,26 +12,15 @@ "url": "https://github.com/cotes2020/jekyll-theme-chirpy/issues" }, "homepage": "https://github.com/cotes2020/jekyll-theme-chirpy#readme", - "scripts": { - "prepare": "husky install" - }, "devDependencies": { - "@commitlint/cli": "^16.2.1", - "@commitlint/config-conventional": "^16.2.1", "gulp": "^4.0.2", "gulp-concat": "^2.6.1", "gulp-insert": "^0.5.0", "gulp-rename": "^2.0.0", "gulp-uglify": "^3.0.2", - "husky": "^7.0.4", "standard-version": "^9.3.2", "uglify-js": "^3.14.3" }, - "commitlint": { - "extends": [ - "@commitlint/config-conventional" - ] - }, "standard-version": { "skip": { "commit": true, From b58cab1c07b53f928bca1659a50a749f63219503 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 13 Mar 2022 16:50:12 +0800 Subject: [PATCH 2/3] docs: update contributing guidelines --- .github/CONTRIBUTING.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index b35638a..9ac13dc 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -45,6 +45,22 @@ $ npx gulp dev After debugging, run the command `npx gulp` (without any argument) will automatically output the compressed files to the directory `assets/js/dist/`. +## Verify the commit messages + +If you want to make sure your commits pass the CI check, you can refer to the following steps. + +Install `commitlint` & `husky`: + +```console +$ npm i -g @commitlint/{cli,config-conventional} husky +``` + +And then enable `husky`: + +```console +$ husky install +``` + --- :tada: Your volunteering will make the open-source world more beautiful, thanks again! :tada: From 03e4f575ba46b7203156fb36e469f4bab9fd7157 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 13 Mar 2022 16:53:13 +0800 Subject: [PATCH 3/3] build(npm, shell): use the global `standard-version` --- .versionrc.json | 20 ++++++++++++++++++++ package.json | 20 -------------------- tools/release.sh | 8 ++++---- 3 files changed, 24 insertions(+), 24 deletions(-) create mode 100644 .versionrc.json diff --git a/.versionrc.json b/.versionrc.json new file mode 100644 index 0000000..4b880d3 --- /dev/null +++ b/.versionrc.json @@ -0,0 +1,20 @@ +{ + "skip": { + "commit": true, + "tag": true + }, + "types": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "perf", + "section": "Improvements" + } + ] +} diff --git a/package.json b/package.json index 0df4c73..ad98e6a 100644 --- a/package.json +++ b/package.json @@ -18,26 +18,6 @@ "gulp-insert": "^0.5.0", "gulp-rename": "^2.0.0", "gulp-uglify": "^3.0.2", - "standard-version": "^9.3.2", "uglify-js": "^3.14.3" - }, - "standard-version": { - "skip": { - "commit": true, - "tag": true - }, - "types": [{ - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "perf", - "section": "Improvements" - } - ] } } diff --git a/tools/release.sh b/tools/release.sh index 99e462e..2b55218 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -10,7 +10,7 @@ # # Usage: run on main branch or the patch branch # -# Requires: Git, Node.js, NPX and RubyGems +# Requires: Git, NPM and RubyGems set -eu @@ -36,7 +36,7 @@ FILES=( TOOLS=( "git" "npm" - "npx" + "standard-version" "gem" ) @@ -143,9 +143,9 @@ resume_config() { # auto-generate a new version number to the file 'package.json' standard_version() { if $opt_pre; then - npx standard-version --prerelease rc + standard-version --prerelease rc else - npx standard-version + standard-version fi }