generated from abriginets/nest-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a1e48ea
Showing
22 changed files
with
10,933 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SERVICE_NAME= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
extends: [ | ||
'airbnb-base', | ||
'plugin:@typescript-eslint/recommended', | ||
'prettier', | ||
'plugin:import/errors', | ||
'plugin:import/warnings', | ||
'plugin:import/typescript', | ||
'plugin:jest/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
plugins: ['@typescript-eslint', 'jest', 'prettier'], | ||
parserOptions: { | ||
ecmaVersion: 15, | ||
sourceType: 'module', | ||
}, | ||
env: { | ||
node: true, | ||
es6: true, | ||
jest: true, | ||
}, | ||
rules: { | ||
'eol-last': ['error', 'always'], | ||
'newline-before-return': 'warn', | ||
'import/extensions': 0, | ||
'import/no-extraneous-dependencies': [ | ||
'error', | ||
{ | ||
devDependencies: false, | ||
optionalDependencies: false, | ||
peerDependencies: false, | ||
}, | ||
], | ||
'semi': 'warn', | ||
// comma-dangle controlled by @typescript-eslint below | ||
'comma-dangle': 'off', | ||
'@typescript-eslint/comma-dangle': ['error', 'always-multiline'], | ||
// quotes controlled by @typescript-eslint below | ||
'quotes': 'off', | ||
'@typescript-eslint/quotes': [ | ||
'warn', | ||
'single', | ||
{ | ||
allowTemplateLiterals: true, | ||
}, | ||
], | ||
'no-shadow': 'off', // no-shadow controlled by @typescript-eslint below | ||
'@typescript-eslint/no-shadow': ['error'], | ||
'arrow-parens': ['warn', 'always'], | ||
// indent controlled by prettier, no linters must be involved here | ||
'indent': 'off', | ||
'@typescript-eslint/indent': 'off', | ||
// do not trust anybody, even yourself | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
// unused vars are only allowed using preceeding underscore | ||
'@typescript-eslint/no-unused-vars': [ | ||
'warn', | ||
{ | ||
argsIgnorePattern: '^_', | ||
}, | ||
], | ||
// single whitespace before comment. Readability 📈📈📈 | ||
'spaced-comment': ['warn', 'always'], | ||
// empty lines don't do anything, man | ||
'no-multiple-empty-lines': [ | ||
'warn', | ||
{ | ||
max: 2, | ||
maxEOF: 0, | ||
}, | ||
], | ||
// no default export because why would you want to have one thing names differently across the app? | ||
'import/prefer-default-export': 'off', | ||
'import/export': 'off', | ||
'import/order': [ | ||
'error', | ||
{ | ||
'groups': [['external', 'internal', 'builtin'], ['sibling', 'parent'], 'index', 'object'], | ||
'pathGroups': [ | ||
{ | ||
pattern: '@nestjs/**', | ||
group: 'external', | ||
position: 'after', | ||
}, | ||
], | ||
'pathGroupsExcludedImportTypes': ['builtin'], | ||
'newlines-between': 'always', | ||
'alphabetize': { | ||
order: 'asc', | ||
caseInsensitive: true, | ||
}, | ||
}, | ||
], | ||
// NestJS tends to have empty constructors | ||
'no-useless-constructor': 'off', | ||
// empty function = empty constructor as well | ||
'no-empty-function': 'off', | ||
// make sure to always have return type specified! | ||
'@typescript-eslint/explicit-function-return-type': 'error', | ||
// useless in NestJS | ||
'class-methods-use-this': 'off', | ||
// up to developer, feel free to disable | ||
'consistent-return': 'off', | ||
// NestJS tends to have circular dependencies | ||
'import/no-cycle': 'off', | ||
}, | ||
settings: { | ||
'import/resolver': { | ||
node: { | ||
extensions: ['.js', '.ts'], | ||
}, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Build | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: .tool-versions | ||
- name: install | ||
run: npm install | ||
- name: typecheck | ||
run: npx tsc --noEmit | ||
- name: lint | ||
run: npm run lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# compiled output | ||
/dist | ||
/node_modules | ||
/build | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
pnpm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# OS | ||
.DS_Store | ||
|
||
# Tests | ||
/coverage | ||
/.nyc_output | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
|
||
# dotenv environment variable files | ||
.env | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.local | ||
|
||
# temp directory | ||
.temp | ||
.tmp | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
printWidth: 120 | ||
tabWidth: 2 | ||
useTabs: false | ||
semi: true | ||
singleQuote: true | ||
trailingComma: all | ||
bracketSpacing: true | ||
bracketSameLine: false | ||
arrowParens: always | ||
quoteProps: consistent | ||
endOfLine: lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodejs 20.11.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "attach", | ||
"name": "Attach NestJS WS", | ||
"port": 9229, | ||
"restart": true | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Launch", | ||
"program": "${workspaceFolder}/src/main.ts", | ||
"preLaunchTask": "tsc: watch - tsconfig.json", | ||
"outFiles": [ | ||
"${workspaceFolder}/dist/**/*.js" | ||
], | ||
"skipFiles": [ | ||
"${workspaceFolder}/node_modules/**/*.js", | ||
"<node_internals>/**/*.js" | ||
] | ||
} | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"editor.tabSize": 2, | ||
"editor.insertSpaces": true, | ||
"editor.formatOnSave": true, | ||
"editor.trimAutoWhitespace": true, | ||
"files.insertFinalNewline": true, | ||
"files.encoding": "utf8", | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "explicit" | ||
}, | ||
"[typescript]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
"typescript.preferences.importModuleSpecifier": "relative", | ||
"prettier.prettierPath": "./node_modules/prettier" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Andrey Briginets | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<p align="center"> | ||
I've been starting so many NestJS projects lately. Now it's time to create a template and share it with the world. | ||
</p> | ||
|
||
## Features | ||
|
||
- Automatic NodeJS version control through [asdf](https://asdf-vm.com/) 😎 | ||
- Prettier for making it pretty 👦 | ||
- [Airbnb](https://www.npmjs.com/package/eslint-config-airbnb)-based ESLint for keeping it consistent ⚡ | ||
- `.editorconfig` for making it cross-IDE ✅ | ||
- Automatic import sorting and grouping 💪 | ||
- VSCode config to kickstart all the linters and prettiers using `formatOnSave` 🤤 | ||
- Winston powered logging. Formatted and colored for devs, forced JSON for machines 😏 | ||
- Strictly typed handcrafted config service 👽 | ||
|
||
## Getting Started | ||
|
||
Make sure you have [asdf](https://asdf-vm.com/guide/getting-started.html) installed along with [asdf-nodejs plugin](https://github.com/asdf-vm/asdf-nodejs/) before you get started | ||
|
||
After checking out the repository execute the following command | ||
|
||
```sh | ||
$ asdf install | ||
``` | ||
|
||
Check currently installed NodeJS version. It should match the one specified in `.tool-versions` file: | ||
|
||
```sh | ||
$ node -v | ||
> v20.11.0 | ||
``` | ||
|
||
And that's it! You are good to go 🎆 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/nest-cli", | ||
"collection": "@nestjs/schematics", | ||
"sourceRoot": "src", | ||
"compilerOptions": { | ||
"deleteOutDir": true | ||
} | ||
} |
Oops, something went wrong.