@jjangga0214/tsconfig
v4.0.0
Published
A sharable config package for Typescript
Downloads
32
Maintainers
Readme
@jjangga0214/tsconfig
A sharable config package for Typescript.
Installation
npm install --save-dev @jjangga0214/tsconfig
# or
yarn add --dev @jjangga0214/tsconfig
# or
pnpm add --save-dev @jjangga0214/tsconfig
And you should also install peerDependencies
manually.
Checkout package.json or npm info
.
# This does not install them all. This just show them on terminal.
npm info "@jjangga0214/tsconfig@latest" peerDependencies
Or install them all by install-peerdeps
.
# For npm
npx install-peerdeps --dev @jjangga0214/tsconfig
# For yarn
npx install-peerdeps --yarn --dev @jjangga0214/tsconfig
# For pnpm
npx install-peerdeps --pnpm --dev @jjangga0214/tsconfig
Note
- Path-related fields, like
outDir
,rootDir
,baseUrl
,paths
,tsBuildInfoFile
, etc, are not set in this config. That's because Typescript resolves paths relative to the configuration file. Thus, you need to configure it manually. REF - This package includes not only tsconfig.json, but also packages needed in typescript development environment, like tsconfig-paths and so on.
ts-node
is configured to useswc
under the hood. REF
Usage for a single-project repo
tsconfig.json:
{
"extends": "@jjangga0214/tsconfig/tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "./",
"baseUrl": "./",
"paths": {
"@your-scope/foo": ["src/foo"],
"#foo": ["src/foo"]
}
}
}
Usage for a monorepo
tsconfig.json:
{
"extends": "@jjangga0214/tsconfig/tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "./",
"baseUrl": "./",
"paths": {
"@your-scope/*": [
"backends/*/src",
"frontends/*/src",
"libs/*/src",
"workflows/*/src"
],
"#foo/*": ["libs/foo/src/*"],
"#bar/*": ["libs/bar/src/*"],
// ... (others are omitted for brevity)
"#*": [
"backends/*/src",
"frontends/*/src",
"libs/*/src",
"workflows/*/src"
]
}
}
}
Usage for import
import tsconfig from "@jjangga0214/tsconfig";