Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change project option resolution #3102

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,10 @@ module ts {
* Read tsconfig.json file
* @param fileName The path to the config file
*/
export function readConfigFile(fileName: string): { config?: any; error?: Diagnostic } {
export function readConfigFile(fileName: string): { config?: any; error?: Diagnostic } {
if (!sys.fileExists(fileName)) {
return { error: createCompilerDiagnostic(Diagnostics.Unable_to_open_file_0, fileName) };
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what regression are you referring to?

this line.

$ tsc -v
message TS6029: Version 1.5.0-beta
$ tsc --project ./not-exists/
error TS6050: Unable to open file 'not-exists/tsconfig.json'.

$ node ~/work/TypeScript/bin/tsc.js --project ./not-exists/
error TS5014: Failed to parse file 'not-exists/tsconfig.json': Unexpected token u.
# I think this is regression. error message is not easy to understanding.

$ node ~/work/TypeScript/built/local/tsc.js --project ./not-exists/
error TS6050: Unable to open file 'not-exists'.
# fixed by this change

}
try {
var text = sys.readFile(fileName);
}
Expand Down
8 changes: 7 additions & 1 deletion src/compiler/tsc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,13 @@ module ts {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--project"));
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
}
configFileName = normalizePath(combinePaths(commandLine.options.project, "tsconfig.json"));
if (sys.directoryExists(commandLine.options.project)) {
configFileName = normalizePath(combinePaths(commandLine.options.project, "tsconfig.json"));
}
else {
configFileName = normalizePath(commandLine.options.project);
}

if (commandLine.fileNames.length !== 0) {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line));
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
Expand Down