Skip to content

Commit 1295ff5

Browse files
author
jonatansalas
committed
feat: add support for prettierrc, commitlint, and general refactor
1 parent 5c6b1a9 commit 1295ff5

28 files changed

+9453
-583
lines changed

.prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"endOfLine": "lf",
3+
"semi": true,
4+
"singleQuote": true,
5+
"tabWidth": 2,
6+
"trailingComma": "es5"
7+
}

README.md

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,31 @@
22

33
This is a super simple starter kit to develop APIs with HapiJS + TypeScript
44

5-
## What currently supports?
5+
## What currently supports?
66

7-
This starter kit comes with the following features:
7+
This starter kit comes with the following features:
88

9-
- **Swagger-UI**
9+
- **Swagger-UI**
1010
- **Status Monitor**
1111
- **.env files support**
1212
- **nodemon for hot-reload**
13-
- **Pretty Console Logger with Winston**
13+
- **Pretty Console Logger with Winston**
1414
- **Work with Yarn or NPM 6 as dependency resolvers**
1515
- **Code formatting with Prettier as hook for Pre-commit**
1616
- **Dockerfile + docker-compose for development**
1717
- **Basic Test Suite with Tape**
1818
- **Coverage Report**
1919
- **Supports Heroku Deployment**
20+
- **Supports Prettier for code formating**
21+
- **Supports commitlint via husky to have standarized commit messages**
2022

2123
## Requirements
2224

23-
* NodeJS 10.x
24-
* Yarn 1.x
25+
- NodeJS > 10.x
26+
- Yarn > 1.x
27+
- NPM > 5.x
2528

26-
## How to use it?
29+
## How to use it?
2730

2831
1. Download this project as a zip.
2932
2. Run `yarn install`
@@ -32,15 +35,14 @@ This starter kit comes with the following features:
3235
5. Visit [http://localhost:8080/api/users](http://localhost:8080/api/users) to test the REST API.
3336
6. Visit [http://localhost:8080/status](http://localhost:8080/status) to view the status monitor.
3437

35-
OUTDATED: Now there's a CLI that currently support creating a new project from this repo: [create-typescript-api](https://github.com/BlackBoxVision/create-typescript-api)
36-
38+
UPDATED: Now there's a CLI that currently support creating a new project from this repo: [create-typescript-api](https://github.com/BlackBoxVision/create-typescript-api)
3739

3840
## TODO
3941

4042
This is not finished, there's still a lot of things to improve. Here you got some:
4143

42-
- [X] Simple test suite - added by the help of [@jcloutz](https://github.com/jcloutz)
43-
- [X] Add support for test coverage - added by the help of [@jcloutz](https://github.com/jcloutz)
44+
- [x] Simple test suite - added by the help of [@jcloutz](https://github.com/jcloutz)
45+
- [x] Add support for test coverage - added by the help of [@jcloutz](https://github.com/jcloutz)
4446
- [ ] Add GraphQL support
4547
- [ ] Add support for Auth with JWT or Sessions
4648
- [ ] Add support for TypeORM/Mongoose
@@ -50,18 +52,18 @@ This is not finished, there's still a lot of things to improve. Here you got som
5052

5153
### What are the package.json scripts for?
5254

53-
* `build-ts`: Compiles typescript based on config set in tsconfig.json.
54-
* `start`: Starts node with the compiled typescript. Used by eg. Heroku.
55-
* `docker:logs`: View Docker logs
56-
* `docker:ps`: List Docker containers
57-
* `docker:start`: Start Docker container based on docker-compose.yml file.
58-
* `docker:stop`: Stop Docker container
59-
* `nodemon:build`: Starts the Nodemon using ts-node. No need to compile beforehand.
60-
* `nodemon:start`: Same as nodemon:build
61-
* `format:lint`: Runs tslint on the typescipt files, based on tslint.js settings.
62-
* `format:prettier`: Runs prettier on all ts-files.
63-
* `postinstall`: Runs build-ts script. This is used by eg. Heroku automatically.
64-
* `test`: Runs tests using nyc, and creates coverage report.
55+
- `build-ts`: Compiles typescript based on config set in tsconfig.json.
56+
- `start`: Starts node with the compiled typescript. Used by eg. Heroku.
57+
- `docker:logs`: View Docker logs
58+
- `docker:ps`: List Docker containers
59+
- `docker:start`: Start Docker container based on docker-compose.yml file.
60+
- `docker:stop`: Stop Docker container
61+
- `nodemon:build`: Starts the Nodemon using ts-node. No need to compile beforehand.
62+
- `nodemon:start`: Same as nodemon:build
63+
- `format:lint`: Runs tslint on the typescipt files, based on tslint.js settings.
64+
- `format:prettier`: Runs prettier on all ts-files.
65+
- `postinstall`: Runs build-ts script. This is used by eg. Heroku automatically.
66+
- `test`: Runs tests using nyc, and creates coverage report.
6567

6668
## Issues
6769

@@ -72,4 +74,5 @@ If you found a bug, or you have an answer, or whatever. Please, raise an [issue]
7274
Of course, if you see something that you want to upgrade from this library, or a bug that needs to be solved, PRs are welcome!
7375

7476
## License
77+
7578
Distributed under the **MIT license**. See [LICENSE](https://github.com/BlackBoxVision/typescript-hapi-starter/blob/master/LICENSE) for more information.

commitlint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = { extends: ['@commitlint/config-conventional'] };

data/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
export default [
2-
3-
]
1+
export default [];

logs/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)