TaskCopyFrontendFiles implements FallibleCommand { @Override public void execute() { long start = System.nanoTime(); log().info("Copying frontend resources from jar files ..."); TaskCopyLocalFrontendFiles.createTargetFolder(targetDirectory); JarContentsManager jarContentsManager = new JarContentsManager(); for (File location : resourceLocations) { if (location.isDirectory()) { TaskCopyLocalFrontendFiles.copyLocalResources( new File(location, RESOURCES_FRONTEND_DEFAULT), targetDirectory); TaskCopyLocalFrontendFiles.copyLocalResources( new File(location, COMPATIBILITY_RESOURCES_FRONTEND_DEFAULT), targetDirectory); } else { jarContentsManager.copyIncludedFilesFromJarTrimmingBasePath( location, RESOURCES_FRONTEND_DEFAULT, targetDirectory, WILDCARD_INCLUSIONS); jarContentsManager.copyIncludedFilesFromJarTrimmingBasePath( location, COMPATIBILITY_RESOURCES_FRONTEND_DEFAULT, targetDirectory, WILDCARD_INCLUSIONS); } } long ms = (System.nanoTime() - start) / 1000000; log().info("Visited {} resources. Took {} ms.", resourceLocations.size(), ms); } TaskCopyFrontendFiles(File targetDirectory, Set<File> resourcesToScan); @Override void execute();  }
@Test public void should_createPackageJson() throws IOException { TaskGeneratePackageJson task = new TaskGeneratePackageJson(npmFolder, generatedFolder, frontendDepsFolder); task.execute(); Assert.assertTrue(new File(npmFolder, PACKAGE_JSON).exists()); Assert.assertFalse(new File(generatedFolder, PACKAGE_JSON).exists()); Assert.assertTrue(new File(frontendDepsFolder, PACKAGE_JSON).exists()); JsonObject deps = task.getPackageJson().getObject("dependencies"); Assert.assertFalse(deps.hasKey("@vaadin/flow-deps")); }