fix: put all ngc files into a single directory (#10486)

Prior to this change `ngc` would place generated files which refer
to components in the node_modules into the node_module. This is an
issue. Now all of the files are forced into a single directory
as specified in `tsconfig.json` by the `genDir` option.

see: https://docs.google.com/document/d/1OgP1RIpZ-lWUc4113J3w13HTDcW-1-0o7TuGz0tGx0g
This commit is contained in:
Miško Hevery
2016-08-03 21:34:03 -07:00
committed by GitHub
parent 2eda7a5293
commit 790362e243
4 changed files with 180 additions and 47 deletions

View File

@ -80,7 +80,14 @@ export class CodeGenerator {
}
}
return path.join(this.options.genDir, path.relative(root, filePath));
// transplant the codegen path to be inside the `genDir`
var relativePath: string = path.relative(root, filePath);
while (relativePath.startsWith('..' + path.sep)) {
// Strip out any `..` path such as: `../node_modules/@foo` as we want to put everything
// into `genDir`.
relativePath = relativePath.substr(3);
}
return path.join(this.options.genDir, relativePath);
}
codegen(): Promise<any> {