The purpose of this command is to add support for file globbing to Typescript compiler tsc
.
Globs can be provided by:
- Reading
filesGlob
property of tsconfig.json - Providing it through command line arguments
All options not supported by this package will be passed to tsc compiler command
based on: tsc-glob
version 1.1.0
Install the package
npm install --save-dev glob-tsc
glob-tsc [options]
Options
alias | command | description |
---|---|---|
-h | --help | output usage information |
-V | --version | output the version number |
-f | --tsconfig-file | tsconfig.json file location. Default ./tsconfig.json |
-g | --files-glob | File globs (ignores filesGlob in tsconfig file) |
Using command globs with -g
alias (easiest):
glob-tsc --outDir dist --declaration -g src/**/ts/*.ts
for JavaScript type linting (see JavaScript type linting on Medium):
glob-tsc --allowJs --checkJs --noEmit --resolveJsonModule --target es5 -g bin/**/*.js,lib/**/*.js,test/**/*.js
Using alternative tsconfig JSON file:
glob-tsc --tsconfig-file config/tsconfig.json --outDir dist --declaration
Using command globs with --files-globs
:
glob-tsc --files-globs src/**/ts/*.ts --outDir dist --declaration
- package "main" script should export some kind of a library API
- cleaner & clearer log output
- cleaner error reporting in the following cases:
- no file globs or tsconfig.json file present
- no valid tsc (TypeScript compiler) is found