This package is only necessary for TypeScript < 2.0 and will not be supported for TypeScript >= 2.0 until further notice.
A lightweight npm package + cli that allows you to specify glob patterns for tsconfig files. Most of the credit is due to glob/minimatch, this is a very thin layer on top of those libraries.
Use npm
to install this package.
Locally:
npm install tsconfig-glob --save-dev
or, Globally:
npm install -g tsconfig-glob --save-dev
You can use this library as either a CLI or in a node script. It follows a similar format to the atom-typescript plugin:
- You provide a path to a directory containing a tsconfig.json
- You specify a
filesGlob
pattern in your tsconfig.json - The library will find the files matching the
filesGlob
patterns and put them in thefiles
property
tsconfig .
```shell
-i, --indent <number> The number of spaces to indent the tsconfig.json file (defaults to 4)
--empty Output an empty files array (ignoring the specified globs)
```
import * as tsconfig from 'tsconfig-glob';
tsconfig(null, (err) => {
...
});
{
/**
* A relative path from cwd to the directory containing a tsconfig.json. If not specified, the '.' is used.
*/
configPath?: string;
/**
* Typescript configuration file name in `configPath` directory
*/
configFileName?: string;
/**
* The current working directory, defaults to `process.cwd()`
*/
cwd?: string;
/**
* The number of spaces to indent the tsconfig.json
*/
indent?: number;
/**
* Output an empty files array (ignoring the specified globs)
*/
empty?: boolean;
/**
* Asynchronous callback (default: true)
*/
async?: boolean;
}
import * as tsconfig from 'tsconfig-glob';
tsconfig({
configPath: '.',
cwd: process.cwd(),
indent: 2
}, function(err) {
...
});