Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes to the default ReactJS template. #2541

Merged
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
2 changes: 1 addition & 1 deletion gradle/templates.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ spring-boot-gradle-plugin = "3.3.0"
spring-dependency-management-plugin = "1.1.4"
micronaut-starter-aws-cdk = "4.3.7"
spring-boot-starter-parent="3.3.0"
graaljs = "24.0.1" # Once this is bumped past 24.1, you should be able to remove the disabling of Loom in the config properties in the React feature.
graaljs = "24.0.2" # Once this is bumped past 24.1, you should be able to remove the disabling of Loom in the config properties in the React feature.
frontend-maven-plugin = "1.15.0"

[libraries]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,14 @@ protobuf {


@if (features.contains("views-react")) {
java {
// GraalJS for React server side rendering requires GraalVM.
toolchain {
vendor = JvmVendorSpec.GRAAL_VM
languageVersion = JavaLanguageVersion.of(21)
}
}

// region JavaScript compilation
@if(gradleBuild.getDsl() == GradleDsl.KOTLIN) {
node {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import io.micronaut.starter.application.generator.GeneratorContext;
import io.micronaut.starter.build.dependencies.*;
import io.micronaut.starter.build.gradle.GradleFile;
import io.micronaut.starter.build.gradle.GradlePlugin;
import io.micronaut.starter.build.maven.MavenPlugin;
import io.micronaut.starter.feature.server.MicronautServerDependent;
Expand Down Expand Up @@ -86,17 +87,27 @@ public void apply(GeneratorContext generatorContext) {
.groupId(StarterCoordinates.JS_COMMUNITY.getGroupId())
.artifactId(StarterCoordinates.JS_COMMUNITY.getArtifactId())
.version(StarterCoordinates.JS_COMMUNITY.getVersion())
.pom()
.build()
);

// This plugin teaches Gradle to download NodeJS and use it to run JS programs.
generatorContext.addBuildPlugin(
GradlePlugin.builder()
.id("com.github.node-gradle.node")
.version(NODE_GRADLE_PLUGIN_VERSION)
.buildImports("import com.github.gradle.node.npm.task.NpxTask")
.build()
);

// This teaches Gradle to download the right GraalVM automatically (community edition).
// For some reason Gradle won't do it out of the box :(
generatorContext.addBuildPlugin(
GradlePlugin.builder()
.id("org.gradle.toolchains.foojay-resolver-convention")
.version("0.8.0")
.gradleFile(GradleFile.SETTINGS)
.build()
);
} else if (generatorContext.getBuildTool() == BuildTool.MAVEN) {
// We spell out the individual dependencies here because the Starter dependency management code for
// Maven builds can't express the direct pom dependency needed by Truffle.
Expand Down
Loading