@fenge/tsconfig
v0.11.2
Published
A strict sharable tsconfig preset.
Maintainers
Readme
@fenge/tsconfig
A strict sharable tsconfig preset.
Feature
- The best practice about
tsconfig.json. - Strictest.
- One-line of tsconfig.
- Support
ESMandCommonJS. - Support FE (eg: React) & BE (eg: Nest) project.
Usage
Install
npm i @fenge/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": "@fenge/tsconfig"
}Best Practices
Here are the best practices if you are using this package.
For polyrepo
├── src
│ └── index.ts
├── test
│ └── index.test.ts
├── package.json
├── tsconfig.build.json
└── tsconfig.jsontsconfig.json
{
// If the project is for web, you may need to change `@fenge/tsconfig/node` to `@fenge/tsconfig/web`.
"extends": ["@fenge/tsconfig", "@fenge/tsconfig/node"]
}tsconfig.build.json
{
"extends": ["./tsconfig.json"],
"include": ["src"],
"exclude": ["**/*.test.ts"]
}For monorepo
├── packages
│ ├── pkg1
│ │ ├── src
│ │ │ └── index.ts
│ │ ├── test
│ │ │ └── index.test.ts
│ │ ├── package.json
│ │ ├── tsconfig.build.json
│ │ └── tsconfig.json
│ └── pkg2
│ ├── src
│ │ └── index.ts
│ ├── test
│ │ └── index.test.ts
│ ├── package.json
│ ├── tsconfig.build.json
│ └── tsconfig.json
└── package.jsontsconfig.json in each package
{
// If the package is for web, you may need to change `@fenge/tsconfig/node` to `@fenge/tsconfig/web`.
"extends": ["@fenge/tsconfig", "@fenge/tsconfig/node"]
}tsconfig.build.json in each package
{
"extends": ["./tsconfig.json"],
"include": ["src"],
"exclude": ["**/*.test.ts"]
}Commands
After installing @fenge/tsconfig, you can run npx tsconfig init command to generate a tsconfig.json file. Run npx tsconfig -h for all commands details:
Usage: tsconfig [options] [command]
Options:
-h, --help display help for command
Commands:
init [options] init a tsconfig file
diff [options] show differences between recommended tsconfig and current project tsconfig
help [command] display help for commandLicense
MIT
