0.0.10 • Published 2 months ago

tscd v0.0.10

Weekly downloads
2
License
MIT
Repository
github
Last release
2 months ago

tscd

tsc but for building TypeScript library with dual CJS/ESM output.

Require typescript 4.7 or above.

Installation

npm i tscd

Usage

Call tscd with the same args as tsc, with an addition of entry (defaulted to index.js) arg which is the entrypoint (with extension) with respect to outDir. Every options are passed to tsc.

tscd --entry index.js --outDir dist

The command will build CJS and ESM versions of the library in two directories and also emitting the types. It will also update package.json with fields like below automatically:

{
  "exports": {
    "import": {
      "types": "./dist/types/index.d.ts",
      "default": "./dist/esm/index.js"
    },
    "require": {
      "types": "./dist/types/index.d.ts",
      "default": "./dist/commonjs/index.cjs"
    }
  },
  "main": "dist/commonjs/index.cjs",
  "types": "dist/types/index.d.ts"
}

Go ahead and publish your package. It will be usable in both CJS and ESM context.

License

MIT

0.0.10

2 months ago

0.0.9

2 months ago

0.0.8

2 months ago

0.0.7

2 months ago

0.0.6

2 months ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.1

10 years ago