This commit is contained in:
2024-04-06 12:54:12 +02:00
commit 07f6abb1f5
18 changed files with 4458 additions and 0 deletions

6
.eslintignore Normal file
View File

@@ -0,0 +1,6 @@
dist/
scripts/
cmd/
tools/
*.d.ts

19
.eslintrc.cjs Normal file
View File

@@ -0,0 +1,19 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint/eslint-plugin', 'import', 'eslint-plugin-tsdoc'],
extends: ['plugin:@typescript-eslint/recommended'],
env: {
jest: true,
node: true,
},
rules: {
'no-console': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-dupe-class-members': ['error'],
'@typescript-eslint/no-useless-constructor': ['error'],
'@typescript-eslint/no-inferrable-types': ['off'],
'import/extensions': ['error', 'ignorePackages', { js: 'always', jsx: 'never', ts: 'never', tsx: 'never' }],
},
}

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
* text=auto

116
.gitignore vendored Normal file
View File

@@ -0,0 +1,116 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Yarn
**/.yarn/*
!**/.yarn/releases
!**/.yarn/plugins
!**/.yarn/sdks
!**/.yarn/versions
**/.pnp.*
# Project
.vscode/
tools/dev

5
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/

1
.idea/.name generated Normal file
View File

@@ -0,0 +1 @@
node-ts-boilerplate

View File

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

6
.idea/jsLinters/eslint.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EslintConfiguration">
<option name="fix-on-save" value="true" />
</component>
</project>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/node-ts-boilerplate.iml" filepath="$PROJECT_DIR$/.idea/node-ts-boilerplate.iml" />
</modules>
</component>
</project>

12
.idea/node-ts-boilerplate.iml generated Normal file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/prettier.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PrettierConfiguration">
<option name="myConfigurationMode" value="AUTOMATIC" />
<option name="myRunOnSave" value="true" />
<option name="myFilesPattern" value="**/*.{js,ts,jsx,tsx,vue,astro,cjs,mjs,mts}" />
</component>
</project>

14
.prettierignore Normal file
View File

@@ -0,0 +1,14 @@
.github
.yarn
coverage
build
docs
dist
out
temp
*.yml
*.html
*.md
*.json
*.d.ts

12
README.md Normal file
View File

@@ -0,0 +1,12 @@
# NodeJS Typescript Boilerplate
Includes the bare minimum to get started with a Node.js Typescript project.
- ESM
- Typescript
- Prettier
- ESLint
```bash
npx degit -y ershsian99/node-ts-boilerplate project-name
```

36
package.json Normal file
View File

@@ -0,0 +1,36 @@
{
"name": "my-app",
"type": "module",
"main": "dist/main.js",
"types": "dist/main.d.ts",
"scripts": {
"start": "node dist/main.js",
"start:dev": "nodemon --ext js,ts,json,env --exec 'node --experimental-specifier-resolution=node --loader ts-node/esm' src/main.ts",
"build": "tsc --project tsconfig.build.json",
"build:clean": "rm -rf tsconfig.build.tsbuildinfo && rm -rf ./dist && pnpm run build",
"lint": "eslint --ext .ts,.js .",
"lint:fix": "eslint --fix --ext .ts,.js .",
"format": "prettier \"./**\" --write --ignore-unknown",
"format:check": "prettier \"./**\" --ignore-unknown --check"
},
"dependencies": {
"dotenv": "^16.0.0",
"tslib": "^2.3.1"
},
"devDependencies": {
"@types/node": "^20.12.5",
"@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^7.5.0",
"cross-env": "^7.0.3",
"eslint": "8.57.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-tsdoc": "^0.2.14",
"nodemon": "^3.1.0",
"prettier": "^3.2.5",
"supertest": "^6.2.2",
"ts-jest": "^29.1.2",
"ts-node": "^10.7.0",
"typescript": "^5.4.4"
}
}

4151
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

5
src/main.ts Normal file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env node
import "dotenv/config";
export default function main() {}
main();

12
tsconfig.build.json Normal file
View File

@@ -0,0 +1,12 @@
{
"extends": "./tsconfig.json",
"exclude": [
"dist",
"node_modules",
"__test",
"**/*.spec.ts",
"**/*.spec.js",
"*.spec.ts",
"**/spec.ts"
]
}

40
tsconfig.json Normal file
View File

@@ -0,0 +1,40 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"importHelpers": true,
"resolveJsonModule": true,
"sourceMap": true,
"declaration": true,
"alwaysStrict": true,
"forceConsistentCasingInFileNames": true,
"removeComments": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": true,
"strict": true,
"noFallthroughCasesInSwitch": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"composite": true,
"skipLibCheck": true,
"noEmitHelpers": false,
"outDir": "dist",
"rootDir": "src",
"baseUrl": "."
},
"exclude": [
"dist",
"node_modules"
],
"include": ["src"]
}