Skip to content
Closed
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 .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ before_script:
- psql -c 'GRANT ALL PRIVILEGES ON DATABASE spoke_test TO spoke_test;' -U postgres
- chmod +x ./travis-run-e2e-tests
script:
- commitlint-travis
- yarn test
- ./travis-run-e2e-tests
52 changes: 52 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,58 @@ Generally, the first steps are:
* Please try adding a test, at least for backend changes (We have an [open issue to wire up frontend React testing](https://github.com/MoveOnOrg/Spoke/issues/292))
* Before committing changes, please run `npm run lint` to standardize formatting

### Commit Message Guidelines

We follow the [conventional commits](https://www.conventionalcommits.org) specification for formatting commit messages. This allows us to automatically generate informative release notes and document breaking changes as they happen.

<details>
<summary>Examples</summary>
<hr>

Add a feature:
```
feat(pencil): add 'graphiteWidth' option
```

Fix a bug:
```
fix(graphite): stop graphite breaking when width < 0.1

Closes #28
```

Improve performance with a breaking change:
```
perf(pencil): remove graphiteWidth option

BREAKING CHANGE:
The graphiteWidth option has been removed. The default
graphite width of 10mm is always used for performance
reasons.
```

<hr>
</details>

While commit messages can still be written by hand, a package script is also available for generating commit messages. To use it, stage the changes you wish to commit as you normally would, eg:

```cli
git add .
```

Then run [commitizen](https://github.com/commitizen/cz-cli):

```cli
yarn commit
Comment thread
jlegrone marked this conversation as resolved.
Outdated
```

Follow the instructions from there and you should end up with a valid commit message!

> **Hint**: If you just want to make a bunch of "work in progress" changes and clean up your commit history later, you can do that too!
>
> ```cli
> git commit -m WIP --no-verify
> ```

### Submitting your Pull Request

Expand Down
65 changes: 65 additions & 0 deletions commitizen.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/* eslint-env node */

const { lstatSync, readdirSync } = require('fs')
const { join } = require('path')

function getDirectories(source) {
return readdirSync(source).filter(
name => lstatSync(join(source, name)).isDirectory()
)
}

const types = [
{
value: 'feat',
name: 'feat: A new feature'
},
{
value: 'fix',
name: 'fix: A bug fix'
},
{
value: 'docs',
name: 'docs: Documentation only changes'
},
{
value: 'style',
name: `style: Changes that do not affect the meaning of the code
(white-space, formatting, missing semi-colons, etc)`
},
{
value: 'refactor',
name: 'refactor: A code change that neither fixes a bug nor adds a feature'
},
{
value: 'perf',
name: 'perf: A code change that improves performance'
},
{
value: 'test',
name: 'test: Adding missing tests'
},
{
value: 'chore',
name: `chore: Changes to the build process or auxiliary tools
and libraries such as documentation generation`
},
{
value: 'revert',
name: 'revert: Revert to a commit'
}
]

const scopes = getDirectories('./src').map(name => ({ name }))

module.exports = {
types,
scopes,
allowCustomScopes: true,
allowBreakingChanges: [
'feat',
'fix',
'perf',
'refactor'
]
}
18 changes: 18 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* eslint-env node */

const { types, scopes, allowCustomScopes } = require('./commitizen.config')

const validTypes = types.map((type) => type.value)
const validScopes = scopes.map((scope) => scope.name)
const scopeValidationLevel = allowCustomScopes ? 1 : 2

module.exports = {
extends: ['@commitlint/config-conventional'],

// Add your own rules. See http://marionebl.github.io/commitlint
rules: {
// Apply valid scopes and types
'scope-enum': [scopeValidationLevel, 'always', validScopes],
'type-enum': [2, 'always', validTypes]
}
}
19 changes: 18 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@
"jest-test": "jest __test__/backend.test.js",
"dev": "nf start -w --procfile ./dev-tools/Procfile.dev",
"dev-nowrap": "nf start --trim 500 --procfile ./dev-tools/Procfile.dev --env ./__test__/e2e/.env.e2e",
"debug-server": "nf start -w --procfile ./dev-tools/Procfile-debug-server.dev"
"debug-server": "nf start -w --procfile ./dev-tools/Procfile-debug-server.dev",
"commit": "git-cz",
"commit:retry": "git-cz --retry",
"commitmsg": "commitlint -e"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -147,10 +150,15 @@
"yup": "^0.19.0"
},
"devDependencies": {
"@commitlint/cli": "^7.5.0",
"@commitlint/config-conventional": "^7.5.0",
"@commitlint/travis-cli": "^7.5.2",
"babel-eslint": "^6.1.2",
"babel-jest": "^22.1.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2017": "^6.24.1",
"commitizen": "^3.0.5",
"cz-customizable": "^5.3.0",
"enzyme": "^3.3.0",
"enzyme-adapter-react-15": "^1.0.5",
"eslint": "2.13.1",
Expand All @@ -160,6 +168,7 @@
"eslint-plugin-react": "^5.2.2",
"fakeredis": "^2.0.0",
"foreman": "^1.4.1",
"husky": "^1.3.1",
"json2csv": "^3.6.2",
"mockdate": "^2.0.2",
"nodemon": "^1.9.2",
Expand All @@ -173,5 +182,13 @@
"sqlite3": "^3.1.9",
"wait-on": "^2.1.0",
"webpack-dev-server": "^2.9.4"
},
"config": {
"commitizen": {
"path": "node_modules/cz-customizable"
},
"cz-customizable": {
"config": "commitizen.config.js"
}
}
}
Loading