0.9.0 • Published 8 months ago

@zanminkian/tsconfig v0.9.0

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

@zanminkian/tsconfig

Strict shared tsconfig out-of-box

npm.io npm.io npm.io npm.io npm.io

Feature

  • Strictest configs with best practices.
  • One-line of tsconfig.
  • Support ESM and CommonJS by type field in package.json.
  • Support FE (eg: React) & BE (eg: Nest) project.

Requirement

  • Typescript 5.0+.
  • Node 16+.

Usage

Install

npm i @zanminkian/tsconfig -D

For node project, you may need to install @types/node additionally.

npm i @types/node -D

For frontend project (like React), you may need to install @types/web additionally.

npm i @types/web -D

Config 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.json

tsconfig.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.json

tsconfig.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 command

License

MIT

0.9.0

8 months ago

0.8.1

9 months ago

0.8.0

9 months ago

0.7.1

9 months ago

0.5.0

10 months ago

0.7.0

9 months ago

0.6.0

9 months ago

0.5.1

10 months ago

0.4.2

1 year ago

0.3.0

1 year ago

0.2.1

1 year ago

0.4.1

1 year ago

0.3.2

1 year ago

0.2.3

1 year ago

0.4.0

1 year ago

0.3.1

1 year ago

0.2.2

1 year ago

0.2.0

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago