tscompilr
This is a utility for transpiling TypeScript files to equivalent JavaScript files.
Prerequisite
Installation
With npm
:
npm install tscompilr --save
With yarn
:
yarn add tscompilr
Usage
In order to use tscompilr
, do the following:
CommonJS
const compile = ; /* Array of files */const files = 'src/file-a.ts' 'src/file-b.ts' ...; /* Every valid TypeScript compiler options is allowed. */const compilerOptions = module: "commonjs" outDir: "dist" noEmitOnError: true rootDir: "src" ; /* transpile */
ES6
; /* Array of files */const files = 'src/file-a.ts' 'src/file-b.ts' ...; /* Every valid TypeScript compiler options is allowed. */const compilerOptions = module: "commonjs" outDir: "dist" noEmitOnError: true rootDir: "src" ; /* transpile */
TypeScript
;; /* Array of files */const files:string = 'src/file-a.ts' 'src/file-b.ts' ...; /* Every valid TypeScript compiler options is allowed. */const compilerOptions:ts.CompilerOptions = module: tsModuleKindCommonJS outDir: "dist" noEmitOnError: true rootDir: "src" ; /* transpile */
Running Tests
$ npm run test or $ yarn test
Check the scripts key in package.json
for the complete list of targets.