Skip to content

Commit

Permalink
Add support for rootDir option in tsconfig
Browse files Browse the repository at this point in the history
Closes #48
  • Loading branch information
Rich Tebb authored and kitsonk committed Mar 1, 2016
1 parent 90e0e54 commit 34491c2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface Options {
name: string;
out: string;
outDir?: string;
rootDir?: string;
target?: ts.ScriptTarget;
sendMessage?: (message: any, ...optionalParams: any[]) => void;
verbose?: boolean;
Expand Down Expand Up @@ -127,6 +128,9 @@ function getTSConfig(options: Options, fileName: string): Options {
if (configParseResult.options.moduleResolution) {
options.moduleResolution = configParseResult.options.moduleResolution;
}
if (configParseResult.options.rootDir) {
options.rootDir = configParseResult.options.rootDir;
}
options.files = configParseResult.fileNames;
return options;
}
Expand Down Expand Up @@ -170,7 +174,7 @@ export default function generate(options: Options): Promise<void> {
}
}

const baseDir = pathUtil.resolve(options.project || options.baseDir);
const baseDir = pathUtil.resolve(options.rootDir || options.project || options.baseDir);
verboseMessage(`baseDir = "${baseDir}"`);
const eol = options.eol || os.EOL;
const nonEmptyLineStart = new RegExp(eol + '(?!' + eol + '|$)', 'g');
Expand Down

0 comments on commit 34491c2

Please sign in to comment.