Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
✨ (devops) Adding Commitizen, Husky and Standard Version
Browse files Browse the repository at this point in the history
Indroduces Org Level Commit Compliance #16
  • Loading branch information
PhearZero committed Sep 8, 2019
1 parent bea5cd3 commit 90cbdfd
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@
path = packages/components
url = [email protected]:HospitalRun/components.git
[submodule "packages/hospitalrun-cli"]
path = packages/hospitalrun-cli
path = packages/cli
url = [email protected]:HospitalRun/hospitalrun-cli.git
[submodule "packages/frontend"]
path = packages/frontend
url = [email protected]:HospitalRun/hospitalrun-frontend.git
branch = next
55 changes: 55 additions & 0 deletions .releaserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// in ".releaserc.js" or "release.config.js"

const {promisify} = require('util')
const dateFormat = require('dateformat')
const readFileAsync = promisify(require('fs').readFile)
const path = require('path')
// Given a `const` variable `TEMPLATE_DIR` which points to "<semantic-release-gitmoji>/lib/assets/templates"
const TEMPLATE_DIR = 'node_modules/semantic-release-gitmoji/lib/assets/templates'
// the *.hbs template and partials should be passed as strings of contents
const template = readFileAsync(path.join(TEMPLATE_DIR, 'default-template.hbs'))
const commitTemplate = readFileAsync(path.join(TEMPLATE_DIR, 'commit-template.hbs'))

module.exports = {
extends: 'semantic-release-monorepo',
branch: "master",
generateNotes: ['semantic-release-gitmoji'],
analyzeCommits: ['semantic-release-gitmoji'],
plugins: [
[
'semantic-release-gitmoji', {
releaseRules: {
major: [':boom:'],
minor: [':sparkles:'],
patch: [
':bug:',
':ambulance:',
':lock:'
]
},
releaseNotes: {
template: template,
partials: {commitTemplate},
helpers: {
datetime: function (format = 'UTC:yyyy-mm-dd') {
return dateFormat(new Date(), format)
}
},
issueResolution: {
template: '{baseUrl}/{owner}/{repo}/issues/{ref}',
baseUrl: 'https://github.com',
source: 'github.com'
}
}
}
],
"@semantic-release/release-notes-generator",
["@semantic-release/changelog", {
"changelogFile": "CHANGELOG.md"
}],
['@semantic-release/git', {
"assets": ["CHANGELOG.md", "package.json", "packages"],
"message": ":bookmark: (release) ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}]
]
}
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,18 @@ Fast, disk space efficient package manager
#### yarn
Fast, reliable, and secure dependency management.
`npm i -g yarn`

## Getting Started

```
git clone https://github.com/HospitalRun/hospitalrun.git
cd hospitalrun
git submodule update --init --recursive
pnpm install -r
```

## Commiting
This repo uses conventional commits. Commitizen is recommended for development. Once you have changes staged
you can run `git cz` from the root directory in order to commit to the proper standards

<hr />

Expand Down
9 changes: 9 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
extends: ["gitmoji"],
parserPreset: {
parserOpts: {
headerPattern: /^(:\w*:)(?:\s)(?:\((.*?)\))?\s((?:.*(?=\())|.*)(?:\(#(\d*)\))?/,
headerCorrespondence: ["type", "scope", "subject", "ticket"]
}
}
};
27 changes: 24 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,28 @@
"author": "Maksim Sink <[email protected]>",
"license": "MIT",
"private": true,
"scripts": {
"preinstall": "node -e '!process.env.npm_config_user_agent.startsWith(\"pnpm/\")&&!console.log(\" ⚠️ This is a mono-repo. Use `npx pnpm recursive install` to install dependencies in this repository ⚠️ \\n\")&&process.exit(1)'"
"devDependencies": {
"@commitlint/cli": "^8.1.0",
"@commitlint/core": "^8.1.0",
"@semantic-release/changelog": "^3.0.4",
"@semantic-release/git": "^7.0.16",
"@semantic-release/release-notes-generator": "^7.3.0",
"commitlint-config-gitmoji": "^1.0.1",
"cz-emoji": "^1.1.2",
"dateformat": "^3.0.3",
"husky": "^3.0.5",
"pnpm": "^3.8.1",
"semantic-release-gitmoji": "^1.3.2"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-commit": "pnpm test -r"
}
},
"config": {
"commitizen": {
"path": "./node_modules/cz-emoji"
}
}
}
}
1 change: 1 addition & 0 deletions packages/frontend
Submodule frontend added at ab508d

0 comments on commit 90cbdfd

Please sign in to comment.