ci(npm): added commitlint and standard-version

This commit is contained in:
Rick van Lieshout 2022-11-05 22:28:41 +01:00
parent 43d63d1064
commit abdbe857e6
5 changed files with 8031 additions and 6855 deletions

View File

@ -1,5 +1,6 @@
#!/bin/sh #!/bin/sh
. "$(dirname "$0")/_/husky.sh" . "$(dirname "$0")/_/husky.sh"
npx --no-install commitlint --edit "$1"
npm run lint:staged npm run lint:staged
npm run test npm run test

42
.versionrc.json Normal file
View File

@ -0,0 +1,42 @@
{
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "content",
"section": "New content"
},
{
"type": "chore",
"hidden": true
},
{
"type": "docs",
"hidden": true
},
{
"type": "style",
"hidden": true
},
{
"type": "refactor",
"hidden": true
},
{
"type": "perf",
"hidden": true
},
{
"type": "test",
"hidden": true
}
],
"commitUrlFormat": "https://github.com/mastermindzh/rickvanlieshout.com/commits/{{hash}}",
"compareUrlFormat": "https://github.com/mastermindzh/rickvanlieshout.com/compare/{{previousTag}}...{{currentTag}}"
}

134
commitlint.config.js Normal file
View File

@ -0,0 +1,134 @@
module.exports = {
rules: {
"body-leading-blank": [1, "always"],
"body-max-line-length": [2, "always", 100],
"footer-leading-blank": [1, "always"],
"footer-max-line-length": [2, "always", 100],
"header-max-length": [2, "always", 100],
"subject-case": [2, "never", ["start-case", "pascal-case", "upper-case"]],
"subject-empty": [2, "never"],
"subject-full-stop": [2, "never", "."],
"type-case": [2, "always", "lower-case"],
"type-empty": [2, "never"],
"type-enum": [
2,
"always",
[
"build",
"chore",
"ci",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"style",
"test",
"content",
"blog",
],
],
},
prompt: {
questions: {
type: {
description: "Select the type of change that you're committing",
enum: {
content: {
description: "A new piece of content",
title: "Content",
emoji: "✨",
},
feat: {
description: "A new feature",
title: "Features",
emoji: "✨",
},
fix: {
description: "A bug fix",
title: "Bug Fixes",
emoji: "🐛",
},
docs: {
description: "Documentation only changes",
title: "Documentation",
emoji: "📚",
},
style: {
description:
"Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)",
title: "Styles",
emoji: "💎",
},
refactor: {
description: "A code change that neither fixes a bug nor adds a feature",
title: "Code Refactoring",
emoji: "📦",
},
perf: {
description: "A code change that improves performance",
title: "Performance Improvements",
emoji: "🚀",
},
test: {
description: "Adding missing tests or correcting existing tests",
title: "Tests",
emoji: "🚨",
},
build: {
description:
"Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)",
title: "Builds",
emoji: "🛠",
},
ci: {
description:
"Changes to our CI configuration files and scripts (example scopes: Docker, Kubernetes, npm, git)",
title: "Continuous Integrations",
emoji: "⚙️",
},
chore: {
description: "Other changes that don't modify src or test files",
title: "Chores",
emoji: "♻️",
},
revert: {
description: "Reverts a previous commit",
title: "Reverts",
emoji: "🗑",
},
},
},
scope: {
description: "What is the scope of this change (e.g. component or file name)",
},
subject: {
description: "Write a short, imperative tense description of the change",
},
body: {
description: "Provide a longer description of the change",
},
isBreaking: {
description: "Are there any breaking changes?",
},
breakingBody: {
description:
"A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself",
},
breaking: {
description: "Describe the breaking changes",
},
isIssueAffected: {
description: "Does this change affect any open issues?",
},
issuesBody: {
description:
"If issues are closed, the commit requires a body. Please enter a longer description of the commit itself",
},
issues: {
description: 'Add issue references (e.g. "fix #123", "re #123".)',
},
},
},
};

14690
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "rickvanlieshout-com", "name": "rickvanlieshout-com",
"version": "0.5.0", "version": "1.0.0",
"description": "My personal blog / website", "description": "My personal blog / website",
"keywords": [ "keywords": [
"gatsby", "gatsby",
@ -18,6 +18,7 @@
"author": "Rick van Lieshout <info@rickvanlieshout.com>", "author": "Rick van Lieshout <info@rickvanlieshout.com>",
"scripts": { "scripts": {
"build": "npm run clean && gatsby build", "build": "npm run clean && gatsby build",
"commit": "git-cz",
"clean": "rimraf .cache public", "clean": "rimraf .cache public",
"format": "npm run format:ts && npm run format:scss", "format": "npm run format:ts && npm run format:scss",
"format:scss": "stylelint \"src/**/*.scss\" --fix", "format:scss": "stylelint \"src/**/*.scss\" --fix",
@ -27,6 +28,10 @@
"lint:staged": "lint-staged", "lint:staged": "lint-staged",
"lint:ts": "eslint \"src\" --ext .tsx,.ts && prettier --check .", "lint:ts": "eslint \"src\" --ext .tsx,.ts && prettier --check .",
"prepare": "husky install", "prepare": "husky install",
"release": "standard-version",
"release:minor": "standard-version --release-as minor",
"release:patch": "standard-version --release-as patch",
"release:major": "standard-version --release-as major",
"reset-snapshots": "find -type f -name '*.snap*' -delete && npm run test", "reset-snapshots": "find -type f -name '*.snap*' -delete && npm run test",
"semantic-release": "semantic-release", "semantic-release": "semantic-release",
"serve": "gatsby serve", "serve": "gatsby serve",
@ -83,6 +88,8 @@
"reading-time": "^1.5.0" "reading-time": "^1.5.0"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/config-conventional": "^17.2.0",
"@commitlint/cz-commitlint": "^17.2.0",
"@jest/globals": "^29.1.2", "@jest/globals": "^29.1.2",
"@mastermindzh/eslint-config": "^1.0.2", "@mastermindzh/eslint-config": "^1.0.2",
"@mastermindzh/prettier-config": "^1.0.0", "@mastermindzh/prettier-config": "^1.0.0",
@ -104,6 +111,8 @@
"autoprefixer": "^10.4.12", "autoprefixer": "^10.4.12",
"browserslist": "^4.21.4", "browserslist": "^4.21.4",
"codecov": "^3.8.3", "codecov": "^3.8.3",
"commitizen": "^4.2.5",
"commitlint": "^17.2.0",
"concurrently": "^7.4.0", "concurrently": "^7.4.0",
"eslint": "^8.25.0", "eslint": "^8.25.0",
"eslint-config-airbnb": "^19.0.4", "eslint-config-airbnb": "^19.0.4",
@ -136,11 +145,17 @@
"rimraf": "3.0.2", "rimraf": "3.0.2",
"sass": "^1.55.0", "sass": "^1.55.0",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
"standard-version": "^9.5.0",
"stylelint": "^14.13.0", "stylelint": "^14.13.0",
"stylelint-config-recommended-scss": "^7.0.0", "stylelint-config-recommended-scss": "^7.0.0",
"stylelint-order": "^5.0.0", "stylelint-order": "^5.0.0",
"stylelint-scss": "^4.3.0", "stylelint-scss": "^4.3.0",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^4.8.4" "typescript": "^4.8.4"
},
"config": {
"commitizen": {
"path": "@commitlint/cz-commitlint"
}
} }
} }