Skip to content

Commit 3bbadfb

Browse files
authored
Merge pull request #81 from cham11ng/upgrade
Upgrade packages
2 parents 7c3605c + 5d160bb commit 3bbadfb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2313
-4623
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.editorconfig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ root = true
55

66
# Unix-style newlines with a newline ending every file
77
[*]
8-
end_of_line = lf
98
charset = utf-8
10-
insert_final_newline = true
11-
indent_style = space
9+
end_of_line = lf
1210
indent_size = 2
13-
14-
# Matches the exact files either package.json or .travis.yml
15-
[{package.json,.travis.yml}]
1611
indent_style = space
17-
indent_size = 2
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
15+
[Makefile]
16+
indent_size = 4
17+
indent_style = tab

.eslintrc

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
{
22
"root": true,
33
"parser": "@typescript-eslint/parser",
4-
"plugins": [
5-
"security",
6-
"@typescript-eslint"
7-
],
4+
"plugins": ["sonarjs", "simple-import-sort", "jsdoc"],
85
"parserOptions": {
9-
"ecmaVersion": 2018, // Allows for the parsing of modern ECMAScript features
10-
"sourceType": "module" // Allows for the use of imports
6+
"ecmaVersion": "latest",
7+
"sourceType": "module"
118
},
129
"ignorePatterns": ["./node_modules/*"],
1310
"extends": [
1411
"eslint:recommended",
15-
"plugin:security/recommended",
1612
"plugin:@typescript-eslint/recommended",
17-
"plugin:@typescript-eslint/eslint-recommended"
13+
"plugin:sonarjs/recommended",
14+
"plugin:jsdoc/recommended-typescript"
1815
],
1916
"rules": {
2017
"no-error-on-unmatched-pattern": "off",
21-
"@typescript-eslint/no-explicit-any": "off", // TODO: Remove this.
22-
"no-return-await": "off",
23-
"no-shadow": "off",
24-
"@typescript-eslint/no-shadow": ["error"]
18+
"@typescript-eslint/no-explicit-any": "warn",
19+
"sonarjs/cognitive-complexity": "off",
20+
"@typescript-eslint/no-shadow": ["error"],
21+
"@typescript-eslint/ban-ts-comment": "off",
22+
"simple-import-sort/imports": "warn",
23+
"jsdoc/no-types": "off",
24+
"jsdoc/tag-lines": "off",
25+
"jsdoc/require-returns-description": "off"
2526
}
2627
}

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ name: Starter CI
22

33
on:
44
push:
5-
branches: [dev, master]
5+
branches: [dev, main]
66
pull_request:
7-
branches: [dev, master]
7+
branches: [dev, main]
88

99
jobs:
1010
build:
1111
strategy:
1212
matrix:
13-
node-version: [16.x]
13+
node-version: [20.x]
1414
platform: [ubuntu-latest]
1515

1616
runs-on: ${{ matrix.platform }}

.husky/pre-commit

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
npx sync-dotenv
54
yarn lint-staged
5+
6+
# check if the .env file exist
7+
if [ ! -f .env ]; then
8+
exit 0
9+
fi
10+
11+
npx sync-dotenv

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"semi": true,
33
"trailingComma": "none",
44
"singleQuote": true,
5-
"printWidth": 80,
5+
"printWidth": 120,
66
"parser": "typescript",
77
"tabWidth": 2
88
}

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: help prepare-dev test lint run
1+
.PHONY: help clean
22
.DEFAULT_GOAL := help
33

44
define BROWSER_PYSCRIPT
@@ -22,7 +22,9 @@ endef
2222
export PRINT_HELP_PYSCRIPT
2323

2424
clean: ## Remove log file.
25-
rm -rf logs/**.log logs/**.json build
25+
@rm -rf logs/*.{log,json}
26+
@rm -rf build
27+
@echo "Clean Successful."
2628

27-
help:
29+
help: ## Help
2830
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,19 @@ Starter for Node.js Express API in Typescript with jsonwebtoken, joi, Knex, Obje
1919
Clone the repository, install the dependencies.
2020

2121
```bash
22+
# Clone repository
2223
$ git clone [email protected]:cham11ng/typescript-api-starter.git <application-name>
2324

2425
$ cd <application-name>
2526

26-
$ cp .env.example .env # Update database credentials
27+
# Update database credentials
28+
$ cp .env.example .env
2729

2830
$ yarn migrate
2931
```
3032

31-
Load fake data in database.
32-
3333
```bash
34+
# Load fake data in database.
3435
$ yarn load:fake <FactoryName> <Number>
3536
```
3637

@@ -41,9 +42,11 @@ $ yarn load:fake <FactoryName> <Number>
4142
Start the application.
4243

4344
```bash
44-
$ yarn build # For production
45+
# For production
46+
$ yarn build
4547

46-
$ yarn start # For development
48+
# For development
49+
$ yarn dev
4750
```
4851

4952
<p align="center">

SECURITY.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ services:
1414
POSTGRES_PASSWORD: ${DB_PASSWORD:-secret}
1515

1616
api:
17-
image: "node:16-alpine"
17+
image: "node:latest"
1818
env_file: '.env.docker'
1919
container_name: "starter-api"
2020
volumes:
@@ -24,4 +24,4 @@ services:
2424
- postgres
2525
ports:
2626
- "8000:8000"
27-
command: sh -c "yarn && yarn start"
27+
command: bash -c "yarn && yarn dev"

0 commit comments

Comments
 (0)