Skip to content

Commit 849bde7

Browse files
authored
chore: Add commit hooks for testing and linting (#149)
chore: Add commit hooks for testing and linting
1 parent 773e066 commit 849bde7

File tree

5 files changed

+55
-16
lines changed

5 files changed

+55
-16
lines changed

Diff for: .husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npm run lerna-lint

Diff for: .husky/pre-push

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npm run test

Diff for: CONTRIBUTING.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,24 @@ Contributions via pull requests are much appreciated. Before sending us a pull r
2828
1. You are working against the latest source on the **main** branch.
2929
2. You check existing open, and recently merged pull requests to make sure someone else hasn't addressed the problem already.
3030
3. You open an [RFC issue](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/new?assignees=&labels=RFC%2C+triage&template=rfc.md&title=RFC%3A+) to discuss any significant work - we would hate for your time to be wasted.
31+
4. You lint and test the code. When you've setup the repository with `npm run init-environment`, pre-commit and push-hooks will automatically lint and test the code. Pull request builds will run the same checks as well.
3132

3233
### Dev setup
3334

3435
To send us a pull request, please follow these steps:
3536

3637
1. Fork the repository.
3738
2. Install dependencies: `npm install`
38-
3. Create a new branch to focus on the specific change you are contributing e.g. `git checkout -b improv/logger-debug-sampling`
39-
4. Run all tests, and code baseline checks: `npm run test`
40-
5. Commit to your fork using clear commit messages.
41-
6. Send us a pull request with a [conventional semantic title](https://github.com/awslabs/aws-lambda-powertools-typescript/pull/67), and answering any default questions in the pull request interface.
42-
7. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
43-
44-
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
39+
3. Prepare utilities like commit hooks: `npm run init-environment`
40+
4. Create a new branch to focus on the specific change you are contributing e.g. `git checkout -b improv/logger-debug-sampling`
41+
5. Run all tests, and code baseline checks: `npm run test`
42+
6. Commit to your fork using clear commit messages.
43+
7. Send us a pull request with a [conventional semantic title](https://github.com/awslabs/aws-lambda-powertools-typescript/blob/main/.github/semantic.yml), and answering any default questions in the pull request interface. [Here's an example](https://github.com/awslabs/aws-lambda-powertools-python/pull/67).
44+
8. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
45+
46+
GitHub provides an additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
4547
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
4648

47-
4849
### Conventions
4950

5051
Category | Convention

Diff for: npm-shrinkwrap.json

+35-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"main": "lib/index.js",
66
"types": "lib/",
77
"scripts": {
8+
"init-environment": "husky install",
9+
"test": "npm run lerna-test",
810
"commit": "commit",
911
"lerna-ci": "lerna exec -- npm ci",
1012
"lerna-test": "lerna exec -- npm run test",
@@ -39,6 +41,7 @@
3941
"@typescript-eslint/eslint-plugin": "^4.11.1",
4042
"@typescript-eslint/parser": "^4.11.1",
4143
"eslint": "^7.16.0",
44+
"husky": "^7.0.1",
4245
"jest": "^27.0.4",
4346
"lerna": "^4.0.0",
4447
"ts-jest": "^27.0.3",

0 commit comments

Comments
 (0)