From f9394a6d8b65cc2513c99793f7248a66d27853e2 Mon Sep 17 00:00:00 2001 From: nravilla Date: Thu, 26 Sep 2024 09:43:23 -0400 Subject: [PATCH] Minor changes to check ModuleInstaller --- .../maven/plugins/utility/ContentHelper.java | 6 +++--- .../maven/plugins/utility/SpaInstaller.java | 17 +++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/maven-plugin/src/main/java/org/openmrs/maven/plugins/utility/ContentHelper.java b/maven-plugin/src/main/java/org/openmrs/maven/plugins/utility/ContentHelper.java index bf073b7e..b99084f1 100644 --- a/maven-plugin/src/main/java/org/openmrs/maven/plugins/utility/ContentHelper.java +++ b/maven-plugin/src/main/java/org/openmrs/maven/plugins/utility/ContentHelper.java @@ -72,9 +72,9 @@ public static List extractAndGetAllContentFrontendConfigs(Artifact content File[] files = frontendConfigFiles.listFiles(); if (files != null) { for (File file : files) { - if (file.isFile()) { - configFiles.add(file); - } + if (file.isFile() && file.length() > 5) { + configFiles.add(file); + } } } } else { diff --git a/maven-plugin/src/main/java/org/openmrs/maven/plugins/utility/SpaInstaller.java b/maven-plugin/src/main/java/org/openmrs/maven/plugins/utility/SpaInstaller.java index d4c93861..1532eb4e 100644 --- a/maven-plugin/src/main/java/org/openmrs/maven/plugins/utility/SpaInstaller.java +++ b/maven-plugin/src/main/java/org/openmrs/maven/plugins/utility/SpaInstaller.java @@ -33,7 +33,7 @@ public class SpaInstaller { static final String NPM_VERSION = "8.5.5"; - static final String BUILD_TARGET_DIR = "frontend"; + static final String BUILD_TARGET_DIR = "frontend"; private final NodeHelper nodeHelper; @@ -65,8 +65,7 @@ public void installFromDistroProperties(File appDataDir, DistroProperties distro // We find all the lines in distro properties beginning with `spa` and convert these // into a JSON structure. This is passed to the frontend build tool. // If no SPA elements are present in the distro properties, the SPA is not installed. - Map spaProperties = distroProperties.getSpaProperties(distroHelper, appDataDir); - + Map spaProperties = distroProperties.getSpaProperties(distroHelper, appDataDir); // Three of these properties are not passed to the build tool, but are used to specify the build execution itself String coreVersion = spaProperties.remove("core"); if (coreVersion == null) { @@ -80,7 +79,7 @@ public void installFromDistroProperties(File appDataDir, DistroProperties distro if (npmVersion == null) { npmVersion = NPM_VERSION; } - + if (!spaProperties.isEmpty()) { Map spaConfigJson = convertPropertiesToJSON(spaProperties); @@ -92,16 +91,18 @@ public void installFromDistroProperties(File appDataDir, DistroProperties distro nodeHelper.installNodeAndNpm(nodeVersion, npmVersion, reuseNodeCache); File buildTargetDir = new File(appDataDir, BUILD_TARGET_DIR); - String program = "openmrs@" + coreVersion; + String program = "openmrs@" + "5.8.0"; String legacyPeerDeps = ignorePeerDependencies ? "--legacy-peer-deps" : ""; // print frontend tool version number nodeHelper.runNpx(String.format("%s --version", program), legacyPeerDeps); - List configFiles = ContentHelper.collectFrontendConfigs(distroProperties); - if (configFiles.isEmpty()) { + List configFiles = ContentHelper.collectFrontendConfigs(distroProperties); + + if (!configFiles.isEmpty()) { + System.out.println("---------------SHOULD NOT SEE THIS-----------------------------" + configFiles.size()); nodeHelper.runNpx( String.format("%s assemble --target %s --mode config --config %s", program, buildTargetDir, spaConfigFile), legacyPeerDeps); - } else { + } else { String assembleCommand = assembleWithFrontendConfig(program, buildTargetDir, configFiles, spaConfigFile); nodeHelper.runNpx(assembleCommand, legacyPeerDeps); }