Skip to content

Commit

Permalink
From package scripts to makefiles
Browse files Browse the repository at this point in the history
  • Loading branch information
vovacodes committed Mar 15, 2021
1 parent 2316111 commit fc3af0a
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 4,108 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ jobs:
yarn install
make build
make test
make lint
env:
CI: true
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ dev: build
"make -C packages/react-sunbeam ${@}" \
"make -C packages/demo ${@}"

lint:
make -C packages/react-sunbeam $@
make -C packages/demo $@

type-check:
yarn tsc --noEmit
make -C packages/react-sunbeam $@
make -C packages/demo $@

test:
make -C packages/react-sunbeam $@
Expand Down
52 changes: 4 additions & 48 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,19 @@
"workspaces": [
"packages/*"
],
"scripts": {
"build": "lerna run build",
"commit": "git-cz",
"commit:retry": "git-cz --retry",
"dev": "yarn build && lerna run --parallel --stream dev",
"clean": "lerna run clean",
"lint": "eslint packages/react-sunbeam/src --ext .ts,.tsx && eslint packages/demo/src --ext .ts,.tsx",
"release": "yarn build && lerna publish --conventional-commits",
"test": "lerna run test",
"type-check": "lerna run type-check",
"uninstall": "lerna clean && rimraf ./node_modules"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged && yarn type-check && yarn lint && yarn test",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-push": "yarn type-check && yarn lint && yarn test"
}
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
],
"rules": {
"scope-case": [
0
],
"header-max-length": [
2,
"always",
100
]
}
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"repository": "git+https://github.com/vovaguguiev/react-sunbeam.git",
"author": "Vova Guguiev <[email protected]>",
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@typescript-eslint/eslint-plugin": "^4.7.0",
"@typescript-eslint/parser": "^4.7.0",
"commitizen": "^4.2.2",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^7.13.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"husky": "^4.3.0",
"lerna": "^3.22.1",
"prettier": "^2.1.2",
"pretty-quick": "^3.1.0",
"rimraf": "^3.0.2"
"jest": "^26.6.3",
"jest-ts-webcompat-resolver": "^1.0.0",
"ts-jest": "^26.4.4",
"typescript": "^4.1.2"
}
}
5 changes: 4 additions & 1 deletion packages/demo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ dev:
'tsc --watch --preserveWatchOutput' \
'deno run --allow-net --allow-read https://deno.land/x/[email protected]/mod.ts .. -p 3333 --entry /demo/index.html'

lint:
yarn eslint src --ext .ts,.tsx

type-check:
yarn tsc --noEmit

PHONY: build dev type-check
PHONY: build dev lint type-check
3 changes: 1 addition & 2 deletions packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"concurrently": "^6.0.0",
"framer-motion": "^3.10.3",
"react-router": "^5.2.0",
"@types/react-router-dom": "5.1.6",
"typescript": "^4.1.2"
"@types/react-router-dom": "5.1.6"
}
}
3 changes: 3 additions & 0 deletions packages/demo/src/apps/SettingsMenu/Picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@ export function Picker({
}}
>
{({ focused, path }) => {
// This callback is called during rendering and it never changes so we can safely call hooks inside of it.
/* eslint-disable react-hooks/rules-of-hooks */
const focusManager = useFocusManager()
const prevOpen = usePrevious(open, open)
useEffect(() => {
if (!open || prevOpen === open) return

focusManager.setFocus(path.concat(focusKeyByValue[selectedOption.props.value]))
})
/* eslint-enable react-hooks/rules-of-hooks */

return (
<div
Expand Down
5 changes: 4 additions & 1 deletion packages/react-sunbeam/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ dev:
type-check:
yarn tsc --noEmit

lint:
yarn eslint src --ext .ts,.tsx

test:
yarn jest

PHONY: clean build dev type-check test
PHONY: clean build dev lint type-check test
6 changes: 1 addition & 5 deletions packages/react-sunbeam/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@
"@types/jest": "^26.0.15",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"jest": "^26.6.3",
"jest-ts-webcompat-resolver": "^1.0.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"ts-jest": "^26.4.4",
"typescript": "^4.1.2"
"react-dom": "^17.0.1"
},
"peerDependencies": {
"react": "^16 || ^17",
Expand Down
Loading

0 comments on commit fc3af0a

Please sign in to comment.