Skip to content

Commit 0078065

Browse files
hirikaratedylans
authored andcommitted
Fixed a bug about excluded paths as reported in #112. Added more description for option baseDir in README.md so that readers can understand the phase "relative to baseDir" in exclude description. (#113)
1 parent 273b168 commit 0078065

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ import Foo = require('package-name/Foo');
7070
## Options
7171

7272
* `baseDir?: string`: The base directory for the package being bundled. Any dependencies discovered outside this
73-
directory will be excluded from the bundle. *Note* this is no longer the preferred way to configure `dts-generator`, please see `project`.
73+
directory will be excluded from the bundle. *Note* this is no longer the preferred way to configure `dts-generator`,
74+
it automatically gets its value from compiler option `rootDir` if specified in `tsconfig.json`, otherwise it gets value from `project`. Please see option `project`.
7475
* `exclude?: string[]`: A list of glob patterns, relative to `baseDir`, that should be excluded from the bundle. Use
7576
the `--exclude` flag one or more times on the command-line. Defaults to `[ "node_modules/**/*.d.ts" ]`.
7677
* `externs?: string[]`: A list of external module reference paths that should be inserted as reference comments. Use

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ export default function generate(options: Options): Promise<void> {
273273
options.exclude = options.exclude || [ 'node_modules/**/*.d.ts' ];
274274

275275
options.exclude && options.exclude.forEach(function (filename) {
276-
glob.sync(filename).forEach(function(globFileName) {
276+
glob.sync(filename, { cwd: baseDir }).forEach(function(globFileName) {
277277
excludesMap[filenameToMid(pathUtil.resolve(baseDir, globFileName))] = true;
278278
});
279279
});

0 commit comments

Comments
 (0)