Skip to content

Commit

Permalink
feat(DEV-22): add setup script to set up project
Browse files Browse the repository at this point in the history
- override test coverage using npm script
  • Loading branch information
hhimanshu committed Jun 30, 2021
1 parent 68bb2cf commit 1ea7034
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

. "$(dirname "$0")/_/husky.sh"

npm run lint && npm run format
npm run format && npm run lint
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
- Support for Storybook

### Commands
- `yarn install` to install dependencies.
- `./setup.sh` to install dependencies.
- `yarn start` to develop locally.
- `yarn test` to test and see the code coverage.
- `yarn test:watch` to test in the watch mode.
- `yarn build` to create a production build.
- `yarn lint` to lint your code using `eslint`.
- `yarn start-prod` to serve production build on port `5000`.
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
"private": true,
"scripts": {
"test": "jest --config jest.config.ts",
"test:watch": "jest --watchAll --config jest.config.ts",
"test:watch": "jest --watchAll --config jest.config.ts --collectCoverage=false",
"start": "webpack serve --config webpack.dev.js ",
"start-prod": "rm -rf dist && yarn build && npx -y serve dist",
"build": "webpack --config webpack.prod.js",
"lint": "eslint -c .eslintrc.js --ext .ts src",
"format": "prettier --write .",
"postinstall": "husky install",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
"start-prod-storybook": "yarn build-storybook && npx -y serve storybook-static -l 5858"
Expand Down
19 changes: 19 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

echo "Making sure all dependencies are met"

if ! command -v yarn &> /dev/null; then
echo "Yarn is not installed"
echo "See yarn install docs: https://yarnpkg.com/getting-started/install"
exit 1
fi

echo "Installing dependencies ..."
yarn

echo "Setting up git hooks ..."
yarn husky install


echo "Done, run \"yarn start\" and start developing"
exit 0

0 comments on commit 1ea7034

Please sign in to comment.