Skip to content

Commit

Permalink
refactor: add conventional commit, update release-it config
Browse files Browse the repository at this point in the history
  • Loading branch information
nzambello committed Feb 10, 2021
1 parent caf393f commit c61158f
Show file tree
Hide file tree
Showing 7 changed files with 1,075 additions and 124 deletions.
17 changes: 12 additions & 5 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
{
"git": {
"changelog": "npx auto-changelog --stdout --commit-limit false -u --template https://raw.githubusercontent.com/release-it/release-it/master/templates/changelog-compact.hbs",
"tagName": "v${version}"
},
"github": {
"release": true,
"releaseName": "${version}",
"releaseNotes": "npx auto-changelog --stdout --commit-limit false -u --template https://raw.githubusercontent.com/release-it/release-it/master/templates/changelog-compact.hbs"
"releaseName": "${version}"
},
"npm": {
"publish": true,
"skipChecks": true
},
"hooks": {
"before:init": "yarn test",
"after:bump": "npx auto-changelog --commit-limit false -p && yarn build"
"before:init": "yarn test"
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": "angular",
"infile": "CHANGELOG.md"
}
}
}
79 changes: 79 additions & 0 deletions COMMITLINT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Commit Messages Format

This project uses the (conventional commit specification)[https://www.conventionalcommits.org/en/v1.0.0/#specification] for consistent commit messages.

All commit messages should have the following form:

````
<type>: <description>
````

## Fix

A fix (PATCH in semantic versioning) looks like this:

````
fix: correct minor typos in code
````

## Feature

A new feature (MINOR in semantic versioning) looks like this:

````
feat: add catalan language
````

## Breaking Change

Breaking changes can be indicated by either appending a "!" to the type:

````
refactor!: drop support for Node 6
````

Or adding "BREAKING CHANGE" to the commit message body text:

````
refactor!: drop support for Node 6
BREAKING CHANGE: refactor to use JavaScript features not available in Node 6.
````

## Available Types

In addition to "fix" and "feat" the following types are allowed:
build:, chore:, ci:, docs:, style:, refactor:, perf:, test:



Install commitlint:

````
npm install --save-dev @commitlint/{config-conventional,cli}
````

or via yarn:

````
yarn add @commitlint/{config-conventional,cli}
````

Create a commitlint.config.js file:

````
echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js
````

Add husky to package.json:

````
{
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
}
````

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Nicola Zambello
Copyright (c) 2017-2021 Nicola Zambello

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,7 @@ yarn test
```

Automated accessibility tests are run with `jest-axe`.

## Contributions

Please follow our [convention](COMMITLINT.md) on commits format.
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {extends: ['@commitlint/config-conventional']}
29 changes: 19 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,23 @@
"homepage": "https://github.com/nzambello/react-csv-reader#readme",
"license": "MIT",
"types": "./dist/index.d.ts",
"scripts": {
"build": "webpack -p",
"release": "release-it",
"test": "jest --rootDir src",
"watch": "webpack --watch --progress",
"docz:dev": "docz dev",
"docz:build": "docz build",
"docz:serve": "docz build && docz serve"
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/preset-env": "^7.10.3",
"@babel/preset-react": "^7.8.3",
"@babel/preset-typescript": "^7.8.3",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@release-it/conventional-changelog": "^2.0.0",
"@testing-library/react": "^10.0.1",
"@types/jest": "^25.1.4",
"@types/jest-axe": "^3.2.1",
Expand All @@ -30,13 +42,14 @@
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.19.0",
"husky": "^5.0.9",
"jest": "^25.1.0",
"jest-axe": "^3.4.0",
"prettier": "^1.19.1",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-test-renderer": "^16.13.0",
"release-it": "^14.2.2",
"release-it": "^14.3.0",
"source-map-loader": "^0.2.4",
"ts-loader": "^6.2.1",
"typescript": "^3.8.3",
Expand All @@ -48,17 +61,13 @@
"react": "^16.13.0",
"react-dom": "^16.13.0"
},
"scripts": {
"build": "webpack -p",
"release": "release-it",
"test": "jest --rootDir src",
"watch": "webpack --watch --progress",
"docz:dev": "docz dev",
"docz:build": "docz build",
"docz:serve": "docz build && docz serve"
},
"dependencies": {
"@types/papaparse": "^5.2.4",
"papaparse": "^5.3.0"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
}
Loading

0 comments on commit c61158f

Please sign in to comment.