Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ public static boolean install(Path nodeModulesDir, List<WebDependency> dependenc
final String packageName = nameAndRoot.getKey();
final Path source = nameAndRoot.getValue();
final Path target = nodeModulesDir.resolve(packageName);
if (!Files.isDirectory(source)) {
LOG.debugf("ignored package ''%s'' probably installed through another package.json", packageName);
continue;
}
dirs.add(packageName);
PathUtils.deleteRecursive(target);
Files.createDirectories(target.getParent());
Expand Down
7 changes: 6 additions & 1 deletion core/src/main/java/io/mvnpm/esbuild/util/JarInspector.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ private static Map<String, Path> findPackageNameAndRootWithPackage(Path root, bo
List<Path> foundFiles = searchFiles(root, PACKAGE_JSON, shouldDoMultiple);
for (Path path : foundFiles) {
String packageName = readPackageName(path);
paths.putIfAbsent(packageName, path.getParent());
if (packageName != null) {
paths.putIfAbsent(packageName, path.getParent());
}
}

return paths;
Expand Down Expand Up @@ -187,6 +189,9 @@ private static String readPackageName(Properties properties) {
private static String readPackageName(Path path) {
try {
JsonNode object = objectMapper.readTree(path.toFile());
if (!object.has("name")) {
return null;
}
return object.get("name").asText();
} catch (IOException ex) {
throw new UncheckedIOException(ex);
Expand Down