TypeScript configuration used on CleevioX projects
npm install @cleeviox/tsconfig``bash`
bun add --dev @cleeviox/tsconfig typescript
In a monorepo, install the package in the root, then create configs in each workspace.
Use one of the following configurations by creating a tsconfig.json file relative to its root based on your need:
Used for workspaces, which contain pieces of code, which are meant to be reusable, for instance packages/utils.
`json`
{
"extends": "@cleeviox/tsconfig/library",
"include": ["/.js", "/.ts", "*/.tsx"],
"exclude": ["dist", "node_modules"]
}
If you intend to distribute your workspace, you should also add a tsconfig.build.json file, which actually emits files:
`json`
{
"compilerOptions": {
"noEmit": false,
"outDir": "./dist",
"rootDir": "./src"
},
"extends": "./tsconfig.json",
"include": ["./src"],
"references": []
}
Then build your package by specifying which config to use:
`bash`package.json
"scripts": {
"build": "tsc --build tsconfig.build.json"
}
Used for react applications.
`json`
{
"extends": "@cleeviox/tsconfig/app",
"include": ["/.js", "/.ts", "*/.tsx"],
"exclude": ["build", "node_modules"]
}
Used for nodejs projects which do not rely on any frameworks. For nestjs use this config
`json`
{
"extends": "@cleeviox/tsconfig/nodejs",
"include": ["/.js", "/.ts", "*/.tsx"],
"exclude": ["build", "node_modules"]
}
Used for nestjs projects:
`json`
{
"extends": "@cleeviox/tsconfig/nextjs",
"include": [".next/types//.ts", "/.js", "/.ts", "/.tsx"],
"exclude": [".next/*/.js", "node_modules"]
}
Used for nextjs projects:
`json`
{
"extends": "@cleeviox/tsconfig/nestjs",
"include": ["/.js", "/.ts"],
"exclude": ["build", "node_modules"]
}
If your project is a monorepo, use this configuration for the project root __only__. Every subsequent workspace then has its own tsconfig.json file, chosen from the above configs based on its purpose.
`json``
{
"extends": "@cleeviox/tsconfig",
"include": ["./.js", "./.ts"],
"exclude": ["node_modules"]
}