Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cli-style commit hooks #520

Merged
merged 4 commits into from
Dec 12, 2019
Merged
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
10 changes: 10 additions & 0 deletions .huskyrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { config } = require('@dhis2/cli-style');
const husky = require(config.husky);

module.exports = {
hooks: {
...husky.hooks,
'pre-commit': 'yarn validate-commit',
'pre-push': 'yarn validate-push',
},
};
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules/*
/i18n/*
/public/*
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"analyze": "source-map-explorer 'build/static/js/*.js'",
"prestart": "npm run extract-pot && npm run localize && npm run manifest",
"start": "react-scripts start",
"lint": "eslint -c .eslintrc.js src",
"lint": "d2-style js check || d2-style text check",
"format": "d2-style js apply || d2-style text apply",
"coverage": "npm test -- --coverage",
"prebuild": "rm -rf build && mkdir build && npm run manifest && npm run localize",
"build": "PUBLIC_URL=. react-scripts build",
Expand All @@ -52,12 +53,9 @@
"eject": "react-scripts eject",
"manifest": "d2-manifest package.json ./public/manifest.webapp --manifest.activities.dhis.href=${REACT_APP_DHIS2_BASE_URL:=..}",
"extract-pot": "d2-i18n-extract -p src/ -o i18n/",
"localize": "d2-i18n-generate -n dashboards-app -p ./i18n/ -o ./src/locales/"
},
"husky": {
"hooks": {
"pre-commit": "yarn extract-pot && CI=true yarn test && git add ./i18n/"
}
"localize": "d2-i18n-generate -n dashboards-app -p ./i18n/ -o ./src/locales/",
"validate-commit": "d2-style js check --staged && d2-style text check --staged && yarn extract-pot && git add ./i18n/",
"validate-push": "CI=true yarn test"
},
"manifest.webapp": {
"name": "Dashboards app",
Expand Down