Skip to content
Open
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
23 changes: 23 additions & 0 deletions .husky/_/husky.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh
if [ -z "$husky_skip_init" ]; then
debug() {
[ "$HUSKY_DEBUG" = "1" ] && echo "husky (debug) - $1"
}
readonly hook_name="$(basename "$0")"
debug "starting $hook_name..."
if [ "$HUSKY" = "0" ]; then
debug "HUSKY env variable is set to 0, skipping hook"
exit 0
fi
if [ -f ~/.huskyrc ]; then
debug "sourcing ~/.huskyrc"
. ~/.huskyrc
fi
export husky_skip_init=1
sh -e "$0" "$@"
exitCode="$?"
if [ "$exitCode" != 0 ]; then
echo "husky - $hook_name hook exited with code $exitCode (error)"
fi
exit "$exitCode"
fi
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint
npm run format-check
20 changes: 20 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Contributing to Shardus Core

Thank you for considering a contribution!

## Getting Started

Install dependencies using `npm install`. This command also sets up the git hooks required for development.

## Commit Workflow

Before each commit the `pre-commit` hook runs `npm run lint` and `npm run format-check`. These checks ensure that the code style and lint rules are satisfied.

You can run them manually at any time with:

```sh
npm run lint
npm run format-check
```

Please also make sure the unit tests pass with `npm test` before submitting a pull request.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,5 @@ This command will guide you through the steps necessary to release the package.
## Contributing

Contributions are very welcome! Everyone interacting in our codebases, issue trackers, and any other form of communication, including chat rooms and mailing lists, is expected to follow our [code of conduct](./CODE_OF_CONDUCT.md) so we can all enjoy the effort we put into this project.

Please see our [contribution guidelines](./CONTRIBUTING.md) for details on the development workflow and available npm scripts.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"release:minor": "npm run prepare && npm version minor && git push --follow-tags && npm publish",
"release:major": "npm run prepare && npm version major && git push --follow-tags && npm publish",
"format-check": "prettier --check \"**/*.{js,jsx,ts,tsx,json}\"",
"format-fix": "prettier --write \"**/*.{js,jsx,ts,tsx,json}\""
"format-fix": "prettier --write \"**/*.{js,jsx,ts,tsx,json}\"",
"postinstall": "husky install"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -107,6 +108,7 @@
"npm-run-all": "4.1.5",
"prettier": "2.8.1",
"replace-in-file": "6.3.5",
"husky": "^9.0.11",
"shx": "0.3.4",
"ts-jest": "27.0.5",
"typescript": "4.9.4",
Expand Down
Loading