@zanminkian/tsconfig
v0.9.0
Published
Strict shared tsconfig out-of-box.
Maintainers
Readme
@zanminkian/tsconfig
Strict shared tsconfig out-of-box
Feature
- Strictest configs with best practices.
- One-line of tsconfig.
- Support
ESMandCommonJSbytypefield inpackage.json. - Support FE (eg: React) & BE (eg: Nest) project.
Requirement
- Typescript 5.0+.
- Node 16+.
Usage
Install
npm i @zanminkian/tsconfig -DFor node project, you may need to install @types/node additionally.
npm i @types/node -DFor frontend project (like React), you may need to install @types/web additionally.
npm i @types/web -DConfig tsconfig.json
{
"extends": "@zanminkian/tsconfig"
}Best Practices
Here are the best practices if you are using this package.
For polyrepo
├── src
│ └── index.ts
├── test
│ └── index.spec.ts
├── package.json
├── tsconfig.build.json
└── tsconfig.jsontsconfig.json
{
"extends": "@zanminkian/tsconfig"
}tsconfig.build.json
{
"extends": "./tsconfig",
"include": ["src"],
"exclude": ["**/*.spec.ts"],
"compilerOptions": {
"outDir": "dist"
}
}For monorepo
├── apps
│ ├── app1
│ │ ├── src
│ │ │ └── main.ts
│ │ ├── test
│ │ │ └── main.spec.ts
│ │ ├── package.json
│ │ └── tsconfig.build.json
│ └── app2
│ ├── src
│ │ └── main.ts
│ ├── test
│ │ └── main.spec.ts
│ ├── package.json
│ └── tsconfig.build.json
├── package.json
└── tsconfig.jsontsconfig.json in the root of project
{
"extends": "@zanminkian/tsconfig"
}tsconfig.build.json in each app
{
"extends": "../../tsconfig",
"include": ["src"],
"exclude": ["**/*.spec.ts"],
"compilerOptions": {
"outDir": "dist"
}
}Commands
After installing @zanminkian/tsconfig, you can run npx tsconfig init command to generate a tsconfig.json file. Run npx tsconfig init -h for more detail of the command:
Usage: tsconfig init [options]
init a tsconfig file
Options:
-t, --to <path> directory that generating to (default: ".")
-n, --name <filename> tsconfig file name (default: "tsconfig.json")
-h, --help display help for commandLicense
MIT
