standardized tsconfigs

This commit is contained in:
Bojan Kucera 2025-06-03 11:49:45 -04:00
parent 1b71fc87ab
commit 2f5309d80f
17 changed files with 262 additions and 76 deletions

View file

@ -0,0 +1,118 @@
# TypeScript Configuration Structure
This document explains the TypeScript configuration structure used in the Stock Bot trading platform.
## Root Configuration
The root `tsconfig.json` at the project root establishes common settings for all projects in the monorepo:
```json
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitThis": true,
"alwaysStrict": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"sourceMap": true,
"declaration": true,
"baseUrl": ".",
"paths": {
"@stock-bot/*": ["libs/*/src"]
}
},
"exclude": [
"node_modules",
"dist"
]
}
```
## Template Configurations
We provide two template configurations:
1. `tsconfig.lib.json` - For library projects:
```json
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"declaration": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
}
```
2. `tsconfig.app.json` - For application projects:
```json
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"module": "ESNext",
"moduleResolution": "bundler",
"types": ["bun-types"]
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
```
## Project-Specific Configurations
Each project in the monorepo extends from the root configuration and adds its own specific settings:
### Library Projects
Library projects extend the root configuration with a relative path:
```json
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"declaration": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
}
```
### Application Projects
Application projects also extend the root configuration with a relative path:
```json
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"module": "ESNext",
"moduleResolution": "bundler",
"types": ["bun-types"]
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
```
## Special Configurations
Some projects have special needs:
1. **Trading Dashboard (Angular)**: Uses an extended configuration structure with separate files for app and testing.
2. **Projects with TypeScript imports from extensions**: These projects set `"allowImportingTsExtensions": true` and `"noEmit": true`.