4.0.0 • Published 4 months ago

@jjangga0214/tsconfig v4.0.0

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

@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 use swc 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";
4.0.0

4 months ago

3.4.0

5 months ago

3.5.0

5 months ago

3.3.2

5 months ago

3.3.1

5 months ago

3.3.0

2 years ago

3.2.1

2 years ago

3.2.0

2 years ago

3.1.0

2 years ago

3.0.0

2 years ago

2.2.0

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.0

2 years ago