Skip to content

Commit

Permalink
chore: 🔧switched to standard-version (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
Can-Sahin committed May 4, 2020
1 parent 0eb0434 commit bef8ea9
Show file tree
Hide file tree
Showing 9 changed files with 1,686 additions and 1,594 deletions.
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## React Boilerplate CRA Template

### ⚠️ Clear this template before you submit (after you read the things below)

Thank you for contributing! Please take a moment to review our [**contributing guidelines**](https://github.com/react-boilerplate/react-boilerplate/blob/master/CONTRIBUTING.md)
to make the process easy and effective for everyone involved.

Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Run commitlint on Pull Requests and commits
name: commitlint
on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']
push:
branches:
- master
- dev

jobs:
lint-pull-request-name:
# Only on pull requests
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: npm i @commitlint/config-conventional
- uses: JulienKode/pull-request-name-linter-action@v0.1.2
lint-commits:
# Only if we are pushing or merging PR to the master
if: (github.event_name == 'pull_request' && github.base_ref == 'refs/heads/master') || github.event_name == 'push'
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 30 # Its fine to lint last 30 commits only
- run: npm i @commitlint/config-conventional
- uses: wagoid/commitlint-github-action@v1
9 changes: 0 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,3 @@ jobs:
- uses: actions/checkout@v2
- run: npm i # There is a bug with npm ci -> https://github.com/npm/cli/issues/558
- run: npm run lint
commitlint:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v1
6 changes: 0 additions & 6 deletions .np-config.js

This file was deleted.

34 changes: 34 additions & 0 deletions .versionrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const internalSection = `_Internals (This section should NOT concern the template users)_`;
/*
* Used for creating CHANGELOG.md automatically.
* Anything under the internalSection should be boilerplate internals
* and shouldn't interest the end users, meaning that the template shouldn't be effected.
*/

// Check the descriptions of the types -> https://github.com/commitizen/conventional-commit-types/blob/master/index.json
module.exports = {
types: [
{ type: 'feat', section: 'Features', hidden: false },
{ type: 'fix', section: 'Bug Fixes', hidden: false },
{ type: 'docs', section: 'Documentation', hidden: false },
{ type: 'perf', section: 'Performance Updates', hidden: false },

// Other changes that don't modify src or test files
{ type: 'chore', section: internalSection, hidden: false },

// Adding missing tests or correcting existing tests
{ type: 'test', section: internalSection, hidden: false },

// Changes to our CI configuration files and scripts
{ type: 'ci', section: internalSection, hidden: false },

// A code change that neither fixes a bug nor adds a feature
{ type: 'refactor', section: internalSection, hidden: false },

// Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
{ type: 'style', section: internalSection, hidden: false },
],
skip: {
commit: true,
},
};
18 changes: 15 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,23 @@ Since the `master` branch is what people actually use in production, we have a
consider that stable we merge it into the `master` branch and release the
changes for real.

⚠️ **WARNING**
## Commit Messages

This project uses [commitlint](https://github.com/conventional-changelog/commitlint) for formating the commit messages. Check [here](https://www.conventionalcommits.org/en/v1.0.0/) for understanding the commit message format.
This project uses [commitlint](https://github.com/conventional-changelog/commitlint) for formating the commit messages. Check [here](https://www.conventionalcommits.org/en/v1.0.0/) for understanding the commit message format (or take a look at our commit history).

> List of available [commit types](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional#type-enum)
Pull Requests are squashed merged, so you don't have to use this format for your commits. Git hook is only running if you are commit to the `dev` branch directly. However, your PR title will be checked and you can see the results in the status checks for your PR

In short PR title must follow the format

```
<type>[optional scope]: <description>
```

where `type` can be one of the followings in [.versionrc.js](./.versionrc.js)

Those commits will be used to generate [CHANGELOG.md](./CHANGELOG.md) automatically before the releases.

> More info: [standard-version](https://github.com/conventional-changelog/standard-version)
**IMPORTANT**: By submitting a patch, you agree to allow the project
owners to license your work under the terms of the [MIT License](https://github.com/react-boilerplate/react-boilerplate/blob/master/LICENSE.md).
Expand Down
11 changes: 10 additions & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
// Use types from .versionrc.js so that when generating CHANGELOG there are no inconsistencies
const standardVersionTypes = require('./.versionrc').types;
const typeEnums = standardVersionTypes.map(t => t.type);

module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [2, 'always', typeEnums],
},
};
Loading

0 comments on commit bef8ea9

Please sign in to comment.