From 7a17260afeb48052706a0ff8ebb67bce205c2b3e Mon Sep 17 00:00:00 2001 From: Denis Davydov <88322488+dendavidov-affinidi@users.noreply.github.com> Date: Fri, 3 Feb 2023 17:41:38 +0100 Subject: [PATCH] chore: fix semantic-release config (#98) --- .releaserc.json | 16 +++++++++++++++- commitlint.config.js | 8 ++++++++ package.json | 4 +++- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 commitlint.config.js diff --git a/.releaserc.json b/.releaserc.json index 50c264b1..8bb40ae2 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -1,7 +1,21 @@ { "branches": ["main"], "plugins": [ - "@semantic-release/commit-analyzer", + ["@semantic-release/commit-analyzer", { + "preset": "angular", + "releaseRules": [ + {"type": "feat", "release": "minor"}, + {"type": "fix", "release": "patch"}, + {"type": "test", "release": "patch"}, + {"type": "build", "release": "patch"}, + {"type": "chore", "release": "patch"}, + {"type": "docs", "release": "patch"}, + {"type": "perf", "release": "patch"} + ], + "parserOpts": { + "noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"] + } + }], "@semantic-release/release-notes-generator", [ "@semantic-release/changelog", diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 00000000..5b9e8d0f --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,8 @@ +module.exports = { + extends: ['@commitlint/config-conventional'], + // more rules: https://commitlint.js.org/#/reference-rules + rules: { + 'type-enum': [2, 'always', ['feat', 'fix', 'perf', 'chore', 'docs', "test", "build"]], + 'subject-empty': [2, 'never'], + }, +}; diff --git a/package.json b/package.json index 95bdf5d8..64dfe825 100644 --- a/package.json +++ b/package.json @@ -537,7 +537,9 @@ "dev": "nodemon -x 'npm run compile'", "generate-translation": "npx @vscode/l10n-dev export -o ./l10n ./src", "update-toolkit": "cp ./node_modules/@vscode/webview-ui-toolkit/dist/toolkit.js ./media/vendor", - "prepare": "husky install" + "prepare-commit-hooks": "npm install --global commitizen@4.2.4 cz-conventional-changelog@3.3.0 @commitlint/config-conventional@16.2.1 @commitlint/cli@16.2.3", + "prepare:dev": "is-ci || (husky install && npm run prepare-commit-hooks)", + "prepare": "node -e \"process.exit(process.env.NODE_ENV === 'production' ? 0 : 1)\" || npm run prepare:dev" }, "devDependencies": { "@affinidi/eslint-config": "^2.0.0-beta.0",