Skip to content

Commit

Permalink
fix: enable use of tsx files in add-ons (#13323)
Browse files Browse the repository at this point in the history
Also copy any tsx file resources
form add-on folders.

Fixes #13318
  • Loading branch information
caalador authored and vaadin-bot committed Mar 21, 2022
1 parent fe37c77 commit e4d22a5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
public class TaskCopyFrontendFiles implements FallibleCommand {
private static final String[] WILDCARD_INCLUSIONS = new String[] {
"**/*.js", "**/*.js.map", "**/*.css", "**/*.css.map", "**/*.ts",
"**/*.ts.map" };
"**/*.ts.map", "**/*.tsx", "**/*.tsx.map" };
private static final String WILDCARD_INCLUSION_APP_THEME_JAR = "**/themes/**/*";
private File targetDirectory;
private Set<File> resourceLocations = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ public void setup() throws IOException, ExecutionFailedException {
public void frontendResources_should_beCopiedFromJars_when_TaskUpdatePackagesRemovesThem()
throws IOException, ExecutionFailedException {
copyResources();
assertCopiedFrontendFileAmount(6/* jar files */ + 1/* package.json */);
assertCopiedFrontendFileAmount(8/* jar files */ + 1/* package.json */);

performPackageClean();
// Should keep the `package.json` file
assertCopiedFrontendFileAmount(1);

copyResources();
assertCopiedFrontendFileAmount(6/* jar files */ + 1/* package.json */);
assertCopiedFrontendFileAmount(8/* jar files */ + 1/* package.json */);
}

private void assertCopiedFrontendFileAmount(int fileCount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private void should_collectJsAndCssFilesFromJars(String jarFile,
task.execute();

List<String> files = TestUtils.listFilesRecursively(frontendDepsFolder);
Assert.assertEquals(8, files.size());
Assert.assertEquals(10, files.size());

Assert.assertTrue("TS resource should have been copied from jar file",
files.contains("example.ts"));
Expand Down Expand Up @@ -135,6 +135,13 @@ private void should_collectJsAndCssFilesFromJars(String jarFile,
Assert.assertTrue(
"JS resource source map should have been copied from resource folder",
files.contains("resourceInFolder.js.map"));

Assert.assertTrue("TSX resource should have been copied from jar file",
files.contains("react.tsx"));

Assert.assertTrue(
"TSX resource source map should have been copied from jar file",
files.contains("react.tsx.map"));
}

private static Set<File> jars(File... files) {
Expand Down
Binary file modified flow-server/src/test/resources/jar-with-frontend-resources.jar
Binary file not shown.
Binary file modified flow-server/src/test/resources/jar-with-modern-frontend.jar
Binary file not shown.

0 comments on commit e4d22a5

Please sign in to comment.