Skip to content

feat: Add template package.json for Hilla components - #2015

Merged
platosha merged 19 commits into
mainfrom
add-package-json-template
Feb 13, 2024
Merged

platosha merged 19 commits into
mainfrom
add-package-json-template

Conversation

@mshabarov

@mshabarov mshabarov commented Feb 1, 2024 •

Copy link
Copy Markdown
Contributor

Adds template files where Hilla components packages are listed.
Replaces AtNpmPackage annotations in hilla and hilla-react, so now Flow can add these packages to package.json automatically depending on whether Hilla is used and React or Lit is used.

Places these templates in hilla and hilla-react.

So basically developers don't need to do manual swaps or exclusions in their projects:

<dependency>
   <groupId>com.vaadin</groupId>
   <artifactId>vaadin-spring-boot-starter</artifactId>
   <version>${vaadin.version}</version>
   <exclusions>
       <exclusion>
            <groupId>com.vaadin.hilla</groupId>
            <artifactId>hilla-react</artifactId>
        </exclusion>
      </exclusions>
</dependency>
<dependency>
      <groupId>com.vaadin.hilla</groupId>
      <artifactId>hilla-lit</artifactId>
      <version>${vaadin.version}</version>
</dependency>

Related-to vaadin/flow#18564

Depends-on vaadin/flow#18597

@codecov

codecov Bot commented Feb 1, 2024 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fe26972) 95.26% compared to head (6e82074) 95.26%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2015   +/-   ##
=======================================
  Coverage   95.26%   95.26%           
=======================================
  Files          57       57           
  Lines        3861     3861           
  Branches      564      564           
=======================================
  Hits         3678     3678           
  Misses        147      147           
  Partials       36       36           
Flag Coverage Δ
unittests 95.26% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

caalador pushed a commit to vaadin/flow that referenced this pull request Feb 6, 2024
Adds Hilla components to package.json automatically in build time, so that developers don't need to swap hilla-react and hilla-lit artifacts in the pom dependencies.

Related-to #18564, vaadin/hilla#2015
@mshabarov
mshabarov marked this pull request as ready for review February 6, 2024 08:31
@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 24.4.0.alpha3 and is also targeting the upcoming stable 24.4.0 version.

rodolforfq pushed a commit to vaadin/flow that referenced this pull request Feb 8, 2024
Adds Hilla components to package.json automatically in build time, so that developers don't need to swap hilla-react and hilla-lit artifacts in the pom dependencies.

Related-to #18564, vaadin/hilla#2015
@mshabarov
mshabarov force-pushed the add-package-json-template branch from 2aaed9f to 4d3c424 Compare February 8, 2024 15:31
caalador pushed a commit to vaadin/flow that referenced this pull request Feb 12, 2024
Uses class finder instead of Class.forName to:

- lookup for Hilla endpoint class at build time,
- load package.json templates

Fixes errors in vaadin/hilla#2015
Fixes vaadin/platform#5013
Fixes vaadin/platform#5023
@mshabarov mshabarov changed the title feat: Add template package.json for Hilla components feat!: Add template package.json for Hilla components Feb 12, 2024
This reverts commit 5e35751.
@mshabarov mshabarov changed the title feat!: Add template package.json for Hilla components feat: Add template package.json for Hilla components Feb 12, 2024
@mshabarov

Copy link
Copy Markdown
Contributor Author

HillaAppInitUtility::detectFramework is still based on hilla and hilla-react artifacts being added into build configurations.
Thus, I cannot remove hilla-react artifact right now without changing this part of functionality.

This is proposed for a separate PR, as it's not directly related to goals in vaadin/flow#18564 and most likely needed for init-app goal that is going to be removed soon.

@mshabarov

Copy link
Copy Markdown
Contributor Author

Fails with the same error as other PRs, so probably not caused by this change:

ProductionBuildFunctionalIT > validateProductionBuildOutput() FAILED

@caalador caalador left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only question I have really is that should we actually have

@@ -0,0 +1,16 @@
{
"name": "hilla-components-dependencies",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel the lit package should not be available in the react module.

@mshabarov mshabarov Feb 13, 2024 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My idea was to have only one module hilla where you have both packages and this module isn't bound to lit or react, it just have Hilla components.

With this change, both hilla and hilla-react have the same content: Hilla's init-app logic depends on what artifact is used, so I cannot just remove hilla-react.

But init-app will be removed from the Hilla plugin and moved to Copilot soon, so I expect hilla-react module to be completely removed (in a separate PR). Also, platform and starters need a change when we remove hilla-react so better to do it synchronously.

So finally we'll have one single module hilla with both packages and Flow decides which package to use based on auto-detection.

@@ -0,0 +1,19 @@
{
"name": "hilla-components-dependencies",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel the react package should not be available in the lit module.

@ZheSun88

Copy link
Copy Markdown
Member

what is wrong with the release lable and comment? ;-P

@mshabarov

Copy link
Copy Markdown
Contributor Author

what is wrong with the release lable and comment?

Referenced issue in Flow has been merged and released, thus this label is there. Maybe.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Hilla 24.4.0.alpha4 and is also targeting the upcoming stable 24.4.0 version.

@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 24.4.0.alpha4 and is also targeting the upcoming stable 24.4.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

5 participants