0.5.1 • Published 5 months ago

@fenge/tsconfig v0.5.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@fenge/tsconfig

A strict sharable tsconfig preset.

npm.io npm.io npm.io npm.io PRs Welcome

Feature

  • The best practice about tsconfig.json.
  • Strictest.
  • One-line of tsconfig.
  • Support ESM and CommonJS.
  • Support FE (eg: React) & BE (eg: Nest) project.

Usage

Install

npm i @fenge/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": "@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.json

tsconfig.json

{
  "extends": "@fenge/tsconfig"
}

tsconfig.build.json

{
  "extends": "./tsconfig",
  "include": ["src"],
  "exclude": ["**/*.test.ts"]
}

For monorepo

You don't need tsconfig.build.json.

├── apps
│   ├── app1
│   │   ├── src
│   │   │   └── main.ts
│   │   ├── test
│   │   │   └── main.test.ts
│   │   ├── package.json
│   │   └── tsconfig.json
│   └── app2
│       ├── src
│       │   └── main.ts
│       ├── test
│       │   └── main.test.ts
│       ├── package.json
│       └── tsconfig.json
├── package.json
└── tsconfig.json

tsconfig.json in the root of project

{
  "extends": "@fenge/tsconfig"
}

tsconfig.json in each app

{
  "extends": "../../tsconfig",
  "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 command

License

MIT

0.1.1-beta.1

11 months ago

0.1.1-beta.0

11 months ago

0.3.0

10 months ago

0.2.1

10 months ago

0.2.0

10 months ago

0.1.1

11 months ago

0.5.0

7 months ago

0.4.1

7 months ago

0.3.2

8 months ago

0.4.0

8 months ago

0.3.1

9 months ago

0.5.1

5 months ago

0.1.0

1 year ago

0.1.0-beta.0

1 year ago