Skip to content

Commit

Permalink
Merge pull request #625 from etn-ccis/feature/blui-6037-husky-pre-com…
Browse files Browse the repository at this point in the history
…mit-hook

Add husky pre-commit hook
  • Loading branch information
JeffGreiner-eaton authored Sep 30, 2024
2 parents 3e615ae + 2799da7 commit e3771e8
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 49 deletions.
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cd ./components && yarn && yarn prettier:check && yarn lint && yarn coverage & cd ..
5 changes: 5 additions & 0 deletions components/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ module.exports = {
'^.+\\.tsx?$': 'ts-jest',
},
collectCoverage: true,
coverageThreshold: {
"global": {
"lines": 75
}
},
coverageReporters: ['text', 'cobertura'],
transformIgnorePatterns: [
'node_modules/(?!(react-native|@react-native/*|react-native-vector-icons|react-native-animatable|react-native-reanimated|react-native-iphone-x-helper|react-native-modal|react-native-collapsible|@react-native/polyfills)/)',
Expand Down
101 changes: 52 additions & 49 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,54 @@
{
"name": "react-native-components",
"version": "0.0.0",
"scripts": {
"initialize": "bash scripts/initializeSubmodule.sh",
"build": "bash ./scripts/buildComponents.sh",
"install:showcase-ios": "yarn initialize && cd demos/showcase && yarn && cd ios && pod install && cd ../../.. && yarn link:components",
"install:showcase-android": "yarn initialize && cd demos/showcase && yarn && cd ../.. && yarn link:components",
"install:storybook-ios": "cd demos/storybook && yarn && cd ios && pod install && cd ../../.. && yarn link:components",
"install:storybook-android": "cd demos/storybook && yarn && cd ../.. && yarn link:components",
"install:storybook-api": "cd demos/api && yarn && cd ../.. && yarn link:components",
"install:all": "yarn && cd components && yarn install && cd .. && yarn install:showcase-ios && yarn install:storybook-ios && yarn install:storybook-api",
"install:all-android": "cd components && yarn install && cd .. && yarn install:showcase-android && yarn install:storybook-android && yarn install:storybook-api",
"link:components": "bash ./scripts/linkComponents.sh",
"publish:package": "cd dist && rm -f *.tgz && set npm_config_yes=true && npx -p @brightlayer-ui/publish blui-publish",
"tag:package": "cd dist && set npm_config_yes=true && npx -p @brightlayer-ui/tag blui-tag -s -blui-react-native-component-library",
"start": "yarn start:showcase",
"start:showcase": "yarn start:showcase-ios",
"start:showcase-ios": "yarn install:showcase-ios && cd demos/showcase && yarn ios",
"start:showcase-android": "yarn install:showcase-android && cd demos/showcase && yarn android",
"start:storybook": "yarn start:storybook-ios",
"start:storybook-ios": "yarn install:storybook-ios && cd demos/storybook && yarn ios",
"start:storybook-android": "yarn install:storybook-android && cd demos/storybook && yarn android",
"start:storybook-api": "yarn install:storybook-api && cd demos/api && yarn start",
"test": "cd components && yarn test",
"test:watch": "cd components && yarn test:watch",
"test:artifacts": "echo \"TODO: TEST ARTIFACTS\"",
"prettier": "prettier \"docs/**.{ts,tsx,js,jsx,json,css,scss,md,html}\" --write && cd components && yarn prettier && cd ../demos/api && yarn prettier && cd ../storybook && yarn prettier",
"prettier:check": "prettier \"docs/**.{ts,tsx,js,jsx,json,css,scss,md,html}\" --check && cd components && yarn prettier:check && cd ../demos/api && yarn prettier:check && cd ../storybook && yarn prettier:check",
"lint": "cd components && yarn lint && cd ../demos/api && yarn lint && cd ../storybook && yarn lint",
"lint:fix": "cd components && yarn lint:fix && cd ../demos/api && yarn lint:fix && cd ../storybook && yarn lint:fix",
"update:submodule": "git submodule update --remote",
"precommit": "yarn install:all && yarn prettier && yarn lint && yarn test && yarn build && yarn test:artifacts && yarn generate:licenses",
"coverage": "cd components && yarn test --coverage --watchAll=false",
"generate:licenses": "cd ./components && npm-license-crawler -onlyDirectDependencies -json LICENSES.json"
},
"directories": {
"doc": "docs"
},
"prettier": "@brightlayer-ui/prettier-config",
"devDependencies": {
"@brightlayer-ui/prettier-config": "^1.0.3",
"eslint-plugin-react-hooks": "^4.6.2",
"npm-license-crawler": "^0.2.1",
"prettier": "^3.3.3"
},
"jest": {
"coverageDirectory": "./components/coverage/",
"collectCoverage": true
}
"name": "react-native-components",
"version": "0.0.0",
"scripts": {
"initialize": "bash scripts/initializeSubmodule.sh",
"build": "bash ./scripts/buildComponents.sh",
"install:showcase-ios": "yarn initialize && cd demos/showcase && yarn && cd ios && pod install && cd ../../.. && yarn link:components",
"install:showcase-android": "yarn initialize && cd demos/showcase && yarn && cd ../.. && yarn link:components",
"install:storybook-ios": "cd demos/storybook && yarn && cd ios && pod install && cd ../../.. && yarn link:components",
"install:storybook-android": "cd demos/storybook && yarn && cd ../.. && yarn link:components",
"install:storybook-api": "cd demos/api && yarn && cd ../.. && yarn link:components",
"install:all": "yarn && cd components && yarn install && cd .. && yarn install:showcase-ios && yarn install:storybook-ios && yarn install:storybook-api",
"install:components": "yarn && cd components && yarn",
"install:all-android": "cd components && yarn install && cd .. && yarn install:showcase-android && yarn install:storybook-android && yarn install:storybook-api",
"link:components": "bash ./scripts/linkComponents.sh",
"publish:package": "cd dist && rm -f *.tgz && set npm_config_yes=true && npx -p @brightlayer-ui/publish blui-publish",
"tag:package": "cd dist && set npm_config_yes=true && npx -p @brightlayer-ui/tag blui-tag -s -blui-react-native-component-library",
"start": "yarn start:showcase",
"start:showcase": "yarn start:showcase-ios",
"start:showcase-ios": "yarn install:showcase-ios && cd demos/showcase && yarn ios",
"start:showcase-android": "yarn install:showcase-android && cd demos/showcase && yarn android",
"start:storybook": "yarn start:storybook-ios",
"start:storybook-ios": "yarn install:storybook-ios && cd demos/storybook && yarn ios",
"start:storybook-android": "yarn install:storybook-android && cd demos/storybook && yarn android",
"start:storybook-api": "yarn install:storybook-api && cd demos/api && yarn start",
"test": "cd components && yarn test",
"test:watch": "cd components && yarn test:watch",
"test:artifacts": "echo \"TODO: TEST ARTIFACTS\"",
"prettier": "prettier \"docs/**.{ts,tsx,js,jsx,json,css,scss,md,html}\" --write && cd components && yarn prettier",
"prettier:check": "prettier \"docs/**.{ts,tsx,js,jsx,json,css,scss,md,html}\" --check && cd components && yarn prettier:check",
"lint": "cd components && yarn lint",
"lint:fix": "cd components && yarn lint:fix",
"update:submodule": "git submodule update --remote",
"precommit": "yarn install:all && yarn prettier && yarn lint && yarn test && yarn build && yarn test:artifacts && yarn generate:licenses",
"coverage": "cd components && yarn test --coverage --watchAll=false",
"generate:licenses": "cd ./components && npm-license-crawler -onlyDirectDependencies -json LICENSES.json",
"prepare": "husky"
},
"directories": {
"doc": "docs"
},
"prettier": "@brightlayer-ui/prettier-config",
"devDependencies": {
"@brightlayer-ui/prettier-config": "^1.0.3",
"eslint-plugin-react-hooks": "^4.6.2",
"husky": "^9.1.6",
"npm-license-crawler": "^0.2.1",
"prettier": "^3.3.3"
},
"jest": {
"coverageDirectory": "./components/coverage/",
"collectCoverage": true
}
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ has-flag@^3.0.0:
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0=

husky@^9.1.6:
version "9.1.6"
resolved "https://registry.yarnpkg.com/husky/-/husky-9.1.6.tgz#e23aa996b6203ab33534bdc82306b0cf2cb07d6c"
integrity sha512-sqbjZKK7kf44hfdE94EoX8MZNk0n7HeW37O4YrVGCF4wzgQjp+akPAkfUK5LZ6KuR/6sqeAVuXHji+RzQgOn5A==

inflight@^1.0.4:
version "1.0.6"
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
Expand Down

0 comments on commit e3771e8

Please sign in to comment.