build: resolve review comments on flat modules PR and fix more bugs (#14660)
This commit is contained in:
@ -30,7 +30,7 @@ export type CodegenExtension =
|
||||
|
||||
export function main(
|
||||
project: string | VinylFile, cliOptions: CliOptions, codegen?: CodegenExtension,
|
||||
options?: ts.CompilerOptions, skipImportRename?: boolean): Promise<any> {
|
||||
options?: ts.CompilerOptions): Promise<any> {
|
||||
try {
|
||||
let projectDir = project;
|
||||
// project is vinyl like file object
|
||||
@ -117,7 +117,7 @@ export function main(
|
||||
const tsickleCompilerHostOptions: tsickle.Options = {
|
||||
googmodule: false,
|
||||
untyped: true,
|
||||
convertIndexImportShorthand: !skipImportRename &&
|
||||
convertIndexImportShorthand:
|
||||
ngOptions.target === ts.ScriptTarget.ES2015, // This covers ES6 too
|
||||
};
|
||||
|
||||
@ -172,19 +172,13 @@ export function main(
|
||||
|
||||
// CLI entry point
|
||||
if (require.main === module) {
|
||||
let args = process.argv.slice(2);
|
||||
let idx = args.indexOf('--skipImportRename');
|
||||
let skipImportRename = false;
|
||||
if (idx !== -1) {
|
||||
args.splice(idx, 1);
|
||||
skipImportRename = true;
|
||||
}
|
||||
const args = process.argv.slice(2);
|
||||
let {options, fileNames, errors} = (ts as any).parseCommandLine(args);
|
||||
check(errors);
|
||||
const project = options.project || '.';
|
||||
// TODO(alexeagle): command line should be TSC-compatible, remove "CliOptions" here
|
||||
const cliOptions = new CliOptions(require('minimist')(args));
|
||||
main(project, cliOptions, null, options, skipImportRename)
|
||||
main(project, cliOptions, null, options)
|
||||
.then((exitCode: any) => process.exit(exitCode))
|
||||
.catch((e: any) => {
|
||||
console.error(e.stack);
|
||||
|
Reference in New Issue
Block a user