-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Support full path for -project/-p paramater #4883
Merged
Merged
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
62df49f
support tsconfig full path
saschanaz 2710030
format/existence check
saschanaz 04d73ba
Merge remote-tracking branch 'Microsoft/master' into tsconfigpath
saschanaz 00a373a
update regex for filename
saschanaz c850919
\. instead of .
saschanaz d0a20c7
Merge remote-tracking branch 'Microsoft/master' into tsconfigpath
saschanaz c29501f
Merge remote-tracking branch 'refs/remotes/Microsoft/master' into tsc…
saschanaz 8ca6b31
const
saschanaz 0448eeb
Merge remote-tracking branch 'refs/remotes/Microsoft/master' into tsc…
saschanaz d87fc8b
Merge remote-tracking branch 'refs/remotes/Microsoft/master' into tsc…
saschanaz e5587fb
Merge remote-tracking branch 'refs/remotes/Microsoft/master' into tsc…
saschanaz 880db38
removing filename requirement
saschanaz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -295,11 +295,26 @@ namespace ts { | |
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--project"), /* compilerHost */ undefined); | ||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); | ||
} | ||
configFileName = normalizePath(combinePaths(commandLine.options.project, "tsconfig.json")); | ||
if (commandLine.fileNames.length !== 0) { | ||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line), /* compilerHost */ undefined); | ||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); | ||
} | ||
|
||
const fileOrDirectory = normalizePath(commandLine.options.project); | ||
if (!fileOrDirectory /* current directory */ || sys.directoryExists(fileOrDirectory)) { | ||
configFileName = combinePaths(fileOrDirectory, "tsconfig.json"); | ||
} | ||
else { | ||
if (!/^tsconfig(?:-.*)?\.json$/.test(getBaseFileName(fileOrDirectory))) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not convinced we should limit this to |
||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_project_file_name_is_not_in_tsconfig_Asterisk_json_format_Colon_0, commandLine.options.project), /* compilerHost */ undefined); | ||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); | ||
} | ||
configFileName = fileOrDirectory; | ||
} | ||
if (!sys.fileExists(configFileName)) { | ||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_any_project_file_in_specified_path_Colon_0, commandLine.options.project), /* compilerHost */ undefined); | ||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); | ||
} | ||
} | ||
else if (commandLine.fileNames.length === 0 && isJSONSupported()) { | ||
const searchPath = normalizePath(sys.getCurrentDirectory()); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment doesn't quite seem applicable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because
normalizePath(".")
gives empty string.sys.directoryExists
function returnsfalse
when the input string is empty so I added it.