fix(ngc): work with typescript@next

This is required due to breaking change in TS, see
https://github.com/Microsoft/TypeScript/pull/8841#issuecomment-227300348
This commit is contained in:
Alex Eagle 2016-06-23 14:26:54 -07:00
parent 42a5b6cbda
commit f463e09b9f
2 changed files with 9 additions and 2 deletions

View File

@ -31,6 +31,7 @@ cp -v package.json $TMP
# TODO(alexeagle): allow this to be npm link instead
npm install ${LINKABLE_PKGS[*]}
./node_modules/.bin/tsc --version
# Compile the compiler-cli integration tests
./node_modules/.bin/ngc
./node_modules/.bin/ng-xi18n
@ -38,4 +39,8 @@ cp -v package.json $TMP
./node_modules/.bin/jasmine init
# Run compiler-cli integration tests in node
./node_modules/.bin/jasmine test/*_spec.js
# Compile again with a differently named tsconfig file
mv tsconfig.json othername.json
./node_modules/.bin/ngc -p othername.json
)

View File

@ -54,9 +54,11 @@ export class Tsc implements CompilerInterface {
this.basePath = basePath;
// Allow a directory containing tsconfig.json as the project value
// Note, TS@next returns an empty array, while earlier versions throw
try {
this.readDirectory(project);
project = path.join(project, 'tsconfig.json');
if (this.readDirectory(project).length > 0) {
project = path.join(project, 'tsconfig.json');
}
} catch (e) {
// Was not a directory, continue on assuming it's a file
}