Skip to content
This repository has been archived by the owner on Feb 20, 2019. It is now read-only.

[WIP] conventional-commits-and-changelog #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Collection of pre-configured front-end tooling setups for common uses.

## Recipes

* [Conventional commits and changelog](/conventional-commits-and-changelog) - Help commit in standard format and update changelog automatically on version bump.
* [Nightwatch server and browsers](/nightwatch-server-and-browsers/) - Run your project's end-to-end (e2e) tests in Chrome and Firefox using Nightwatch.
* [PostCSS process and watch](/postcss-process-and-watch/) - Compile CSS with support for CSS imports, variables, vendor prefixing and minification using PostCSS.
* [Travis CI: deploy to GitHub Pages](/travis-deploy-to-gh-pages/) - Automatically create distributions and deploy them to GitHub Pages using Travis CI.
1 change: 1 addition & 0 deletions conventional-commits-and-changelog/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
1 change: 1 addition & 0 deletions conventional-commits-and-changelog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Note: this changelog is automatically populated using `npm run changelog` which is used in `npm version`.
46 changes: 46 additions & 0 deletions conventional-commits-and-changelog/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributing

...

## Guidelines

...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be expanded?



### Commit message format

Each commit message must have a *header* and optionally a *body*. The header has a special format that includes a type, a scope and a summary:

```
<type>(<scope>): <summary>
<BLANK LINE>
<body>
```

Note: you can use `npm run commit`, prompting you to fill out the git commit message step-by-step.

#### Type
Must be one of the following:

* **feat**: A new feature
* **fix**: A bug fix
* **docs**: Documentation only changes
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing
semi-colons, etc)
* **refactor**: A code change that neither fixes a bug nor adds a feature
* **test**: Adding missing tests
* **chore**: Changes to the build process or auxiliary tools and libraries such as documentation
generation

#### Scope
The scope could be anything specifying place of the commit change. The scope is optional.

In case of a feature or fix to a demo it would typically be the name of the module, e.g. `fix(todo-app):`.

#### Summary
The summary contains succinct description of the change. Keep it clear, but short. Put the rest in the body.

#### Body
The body should include the motivation for the change and contrast this with previous behavior.

Note: the commit message format guidelines are based on [Angular's Git Commit Guidelines](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#-git-commit-guidelines).
38 changes: 38 additions & 0 deletions conventional-commits-and-changelog/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Conventional commits and changelog

## Functionality

Help commit in a [standard format](CONTRIBUTING.md#commit-message-format)
so the changelog can be updated automatically on every version bump.


## Usage

### Write standard commit messages

Write your commit messages in [standard format](CONTRIBUTING.md#commit-message-format).
You can do this in a step-by-step wizard by running:

```bash
npm run commit
```

### Bump version with updated changelog

When you bump the [version](https://docs.npmjs.com/cli/version) of the project, the [changelog](CHANGELOG.md) will be updated automatically.

```bash
npm version [major | minor | patch]
```

### Scripts

After installing dependencies (run `npm install`) the following scripts are available:

`npm run ...` | Description
---|---
`changelog` | Updates `CHANGELOG.md` based on commits. Done automatically via `version`.
`commit` | Prompts you to fill out your git commit message step-by-step.
`version patch` | Bump version with only backwards-compatible bug fixes.
`version minor` | Bump version with new functionality (and bug fixes).
`version major` | Bump version with breaking changes.
24 changes: 24 additions & 0 deletions conventional-commits-and-changelog/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "conventional-commits-and-changelog",
"version": "1.0.0",
"description": "",
"scripts": {
"build": "echo 'TODO: CREATE BUILD'",
"test": "echo 'TODO: WRITE TESTS'",
"changelog": "conventional-changelog --preset angular --infile CHANGELOG.md --same-file --output-unreleased",
"commit": "git-cz",
"preversion": "npm run build && npm test",
"version": "npm run changelog && git add .",
"postversion": "git commit -m \"chore(version): v$npm_package_version\n$(conventional-changelog --preset angular)\" && git tag -a v$npm_package_version -m \"$(conventional-changelog --preset angular)\""
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"devDependencies": {
"commitizen": "2.8.1",
"conventional-changelog-cli": "1.2.0",
"cz-conventional-changelog": "1.1.6"
}
}