mirror of
https://github.com/github/codeql.git
synced 2026-04-19 14:04:09 +02:00
catch when the main: path is invalid on Windows
This commit is contained in:
@@ -892,10 +892,15 @@ protected DependencyInstallationResult preparePackagesAndDependencies(Set<Path>
|
||||
// For named packages, find the main file.
|
||||
String name = packageJson.getName();
|
||||
if (name != null) {
|
||||
Path entryPoint = guessPackageMainFile(path, packageJson, FileType.TYPESCRIPT.getExtensions());
|
||||
if (entryPoint == null) {
|
||||
// Try a TypeScript-recognized JS extension instead
|
||||
entryPoint = guessPackageMainFile(path, packageJson, Arrays.asList(".js", ".jsx"));
|
||||
Path entryPoint = null;
|
||||
try {
|
||||
entryPoint = guessPackageMainFile(path, packageJson, FileType.TYPESCRIPT.getExtensions());
|
||||
if (entryPoint == null) {
|
||||
// Try a TypeScript-recognized JS extension instead
|
||||
entryPoint = guessPackageMainFile(path, packageJson, Arrays.asList(".js", ".jsx"));
|
||||
}
|
||||
} catch (InvalidPathException ignore) {
|
||||
// can happen if the `main:` field is invalid. E.g. on Windows a path like `dist/*.js` will crash.
|
||||
}
|
||||
if (entryPoint != null) {
|
||||
System.out.println(relativePath + ": Main file set to " + sourceRoot.relativize(entryPoint));
|
||||
|
||||
Reference in New Issue
Block a user