安装
bun add --dev @cleeviox/tsconfig typescript
在单列波中,在根中安装包,然后在每个工作空间中创建配置.
使用量
通过创建一个 tsconfig.json 根据您的需要, 文件相对于其根 :
图书馆
用于工作空间,其中包含一些代码,这些代码意在重新使用,例如: packages/utils。 。 。 .
{
"extends": "@cleeviox/tsconfig/library",
"include": ["**/*.js", "**/*.ts", "**/*.tsx"],
"exclude": ["dist", "node_modules"]
}
如果您打算分配工作空间,您还应当添加一个 tsconfig.build.json 文件, 它实际上释放文件 :
{
"compilerOptions": {
"noEmit": false,
"outDir": "./dist",
"rootDir": "./src"
},
"extends": "./tsconfig.json",
"include": ["./src"],
"references": []
}
然后通过指定要使用的配置来构建您的软件包 :
# package.json
"scripts": {
"build": "tsc --build tsconfig.build.json"
}
应用
用于反应应用.
{
"extends": "@cleeviox/tsconfig/app",
"include": ["**/*.js", "**/*.ts", "**/*.tsx"],
"exclude": ["build", "node_modules"]
}
节点.js
用于不依赖任何框架的节点项目。 对于 nestjs 使用这个 配置
{
"extends": "@cleeviox/tsconfig/nodejs",
"include": ["**/*.js", "**/*.ts", "**/*.tsx"],
"exclude": ["build", "node_modules"]
}
下一个.js
用于 nestjs 项目:
{
"extends": "@cleeviox/tsconfig/nextjs",
"include": [".next/types/**/*.ts", "**/*.js", "**/*.ts", "**/*.tsx"],
"exclude": [".next/**/*.js", "node_modules"]
}
(原始内容存档于2019-09-21) (英语). Nest.js
用于 nextjs 项目:
{
"extends": "@cleeviox/tsconfig/nestjs",
"include": ["**/*.js", "**/*.ts"],
"exclude": ["build", "node_modules"]
}
根号
如果您的工程是单列波, 请使用此配置进行工程根 仅限。随后的每一个工作空间都有自己的 tsconfig.json 文件,根据它的目的从上述配置中选择.
{
"extends": "@cleeviox/tsconfig",
"include": ["./*.js", "./*.ts"],
"exclude": ["node_modules"]
}