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

Add React SSR feature #2524

Merged
merged 4 commits into from
Jul 23, 2024
Merged

Conversation

mikehearn
Copy link
Contributor

Re-opened on 4.5.x

This PR adds support for creating a sample project that uses React server side rendering (SSR).

@graemerocher graemerocher requested a review from melix June 19, 2024 16:08
@graemerocher
Copy link
Contributor

@melix could you look at the generated Gradle config, not sure if it represents best practise

@melix
Copy link
Contributor

melix commented Jun 19, 2024

I will. At first glance there are improvements which can be made to avoid dependsOn but it depends on (ah ah!) the plugins. I need to try this to figure out.

@mikehearn
Copy link
Contributor Author

OK. What's wrong with dependsOn? Do you have a link to the current Gradle best practices?

@melix
Copy link
Contributor

melix commented Jun 24, 2024

I wrote a blog post about this a while back : https://melix.github.io/blog/2021/10/gradle-quickie-dependson.html

In general you should have a task which produces an output, then the tasks which consume this output must define it as an input : dependsOn should be limited to lifecycle tasks. However, as I said, sometimes because the plugins we use are not using say the Provider API, it's not always possible.

@mikehearn
Copy link
Contributor Author

I think in this case it wouldn't make a difference. The custom build{Client,Server}JS tasks that produce files do declare inputs and outputs. The other tasks are just for grouping and CLI usage purposes, they don't consume the inputs of the tasks they depend on. The NPM install task, I don't know what outputs it has indeed. Probably processResources should be depending on the JS tasks via their outputs but I don't know how to do that either without something overkill like creating a whole custom plugin. Gave up trying to understand Gradle years ago, honestly ...

@melix
Copy link
Contributor

melix commented Jun 24, 2024

processResources is precisely the task I was referring to. Lifecycle tasks are ok. The thing if you don't wire properly is that builds work accidentally. For Maven it's often not a problem because folks run clean install all the time so they often don't notice. Anyway, I'll take a look soon.

@mikehearn
Copy link
Contributor Author

This PR depends on micronaut-projects/micronaut-views#833 as otherwise the config needed is excessively complicated.

@mikehearn
Copy link
Contributor Author

@melix Thanks for your review, I've force pushed a new version of the commit that uses builtBy. Once there's a new Micronaut Views release I'll update the versions in this PR to make sure it's being used and then we can merge it.

@graemerocher
Copy link
Contributor

can you correct the check style failures?

@graemerocher graemerocher added the type: enhancement New feature or request label Jul 23, 2024
@graemerocher graemerocher merged commit 28257bd into micronaut-projects:4.5.x Jul 23, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants