@laozhu/tsconfig

1.3.1 • Public • Published

@laozhu/tsconfig

Version Weekly Downloads

Shareable tsconfig.json file and generator of @laozhu

Installation

# Install with npx
$ npx install-peerdeps --dev @laozhu/tsconfig

# Install with NPM
$ npm i -D @laozhu/tsconfig typescript

# Install with yarn
$ yarn add --dev @laozhu/tsconfig typescript

Usage

After installation, create your own tsconfig.json file, then extends from this package.

{
  "extends": "@laozhu/tsconfig",
  "compilerOptions": {
    "baseUrl": ".",
    "rootDir": ".",
    "outDir": "dist",
    "paths": {
      "@/*": ["src/*"]
    }
  }
}

There are four shareable configs in the package, the default export of this package is modern react project.

  • node: Node backend or CLI project
  • react: React modern (esnext) project
  • react-legacy: React legacy (es5) project
  • react-native: React native project

You can extends them as below, then overwirte properties with your own prefers.

{
  "extends": "@laozhu/tsconfig/node",
  "compilerOptions": {
    "allowJs": true,
    "baseUrl": ".",
    "rootDir": ".",
    "outDir": "dist",
    "module": "commonjs",
    "paths": {
      "@/*": ["src/*"]
    }
  },
  "exclude": ["some-excluded-folder"]
}

CLI

If you want to generate your own tsconfig.json file, just run npx tsconfig in your project root.

$ npx @laozhu/tsconfig
? Pick up type of your typescript project: (Use arrow keys)
  Node backend or CLI project
❯ React modern (esnext) project
  React legacy (es5) project
  React native project

Notes

  • Check node.green for node.js es2015 support infomation.
  • node_modules and outDir will be excluded by default, you don't need to exclude them manually.
  • Remove outDir from shareable config because of this issue.

License

MIT

Package Sidebar

Install

npm i @laozhu/tsconfig

Weekly Downloads

0

Version

1.3.1

License

MIT

Unpacked Size

10.5 kB

Total Files

11

Last publish

Collaborators

  • shiaohoo