Skip to content

Commit

Permalink
JNG-4463 fix generator add tests fix readme (#12)
Browse files Browse the repository at this point in the history
* JNG-4463: fix generator bugs, redundant helpers

* JNG-4463: fix generator bugs, redundant helpers, test project

* JNG-4463: gix generator, add tests, fix readme
  • Loading branch information
noherczeg authored Feb 27, 2023
1 parent a6270e0 commit 769b304
Show file tree
Hide file tree
Showing 53 changed files with 6,784 additions and 296 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ target/
**/*.iml
transaction-logs/
.flattened-pom.xml
.nodejs
178 changes: 142 additions & 36 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,65 +1,171 @@
# judo-ui-react
# judo-ui-react-template

UI based JUDO React Frontend Java generator
UI based JUDO React Frontend TypeScript generator

It can be used as:
## Dependencies

The source code which this template can generate depends on the generated services of https://github.com/BlackBeltTechnology/judo-ui-typescript-rest-template[judo-ui-typescript-rest-template].

The following example will showcase both plugins working together to generate a fully functional application.

## Usage

[code, xml]
----
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>hu.blackbelt.judo.archetype</groupId>
<artifactId>judo-ui-react-example</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
<name>JUDO UI Generator React Frontend test</name>
<description>JUDO UI React Frontend Generator Example.</description>
<groupId>com.example</groupId>
<artifactId>actiongrouptest-frontend-react-action_group_test__god</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>ActionGroupTest - God</name>
<description>ActionGroupTest - God react frontend</description>
<packaging>bundle</packaging>
<properties>
<revision>1.0.0-SNAPSHOT</revision>
<maven>3.8.3</maven>
<!-- dependencies -->
<judo-meta-ui-version>1.0.1.20230213_193724_b9e98a1c_develop</judo-meta-ui-version>
<judo-generator-commons-version>1.0.0.20230120_203628_b0fbaa8e_develop</judo-generator-commons-version>
<judo-ui-typescript-rest-version>1.0.0.20230227_135344_7ab7117b_develop</judo-ui-typescript-rest-version>
<judo-ui-react-version>1.0.0.20230222_040743_a6270e05_develop</judo-ui-react-version>
<!-- model properties -->
<model-name>ActionGroupTest</model-name>
<actor>actiongrouptest__god</actor>
<actor-shortname>god</actor-shortname>
<actor-name>God</actor-name>
<actor-fq-name>ActionGroupTest::God</actor-fq-name>
<judo-ui-archetype-version>1.0.0</judo-ui-archetype-version>
<judo-ui-react>1.0.0</judo-ui-react>
<judo-meta-ui-version>1.1.0</judo-meta-ui-version>
<!-- generator properties -->
<ui-model>${project.basedir}/model/${model-name}-ui.model</ui-model>
<override-dir>${project.basedir}/generator-overrides</override-dir>
<generation-target>${project.basedir}/target/frontend-react</generation-target>
<!-- npm package properties -->
<appScope>@example</appScope>
<appVersion>1.0.0</appVersion>
<tablePageLimit>10</tablePageLimit>
</properties>
<build>
<plugins>
<plugin>
<groupId>hu.blackbelt.judo.archetype</groupId>
<artifactId>judo-ui-archetype-maven-plugin</artifactId>
<version>${judo-ui-archetype-version}</version>
<groupId>hu.blackbelt.judo.meta</groupId>
<artifactId>judo-ui-generator-maven-plugin</artifactId>
<version>${judo-meta-ui-version}</version>
<executions>
<execution>
<id>execute-ui-test-model-from-artifact</id>
<phase>test</phase>
<id>execute-ui-services-generation</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<uris>
<uri>${basedir}/src/main/resources</uri>
<uri>mvn:hu.blackbelt.judo.generator:judo-ui-typescript-rest-api:${judo-ui-typescript-rest-version}</uri>
<uri>mvn:hu.blackbelt.judo.generator:judo-ui-typescript-rest-service:${judo-ui-typescript-rest-version}</uri>
<uri>mvn:hu.blackbelt.judo.generator:judo-ui-typescript-rest-axios:${judo-ui-typescript-rest-version}</uri>
</uris>
<helpers>
<helper>hu.blackbelt.judo.ui.generator.sdk.core.PsmModelHelper</helper>
</helpers>
<type>ui-sdk-core</type>
<ui>
mvn:your.ui.model.group.id:your.ui.model.artifact.id:your.ui.model.version!model-name-in-jar.model
</ui>
<destination>${basedir}/target/generated-test-classes/ui/sdk-core</destination>
<type>ui-typescript-rest</type>
<applications>
${actor-fq-name}
</applications>
<ui>${ui-model}</ui>
<destination>${generation-target}/src/generated</destination>
</configuration>
</execution>
<execution>
<id>execute-ui-generation</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<uris>
<uri>mvn:hu.blackbelt.judo.generator:judo-ui-react:${judo-ui-react-version}</uri>
</uris>
<type>ui-react</type>
<applications>
${actor-fq-name}
</applications>
<ui>${ui-model}</ui>
<destination>${generation-target}</destination>
<templateParameters>
<appModelName>${model-name}</appModelName>
<appScope>${appScope}</appScope>
<appVersion>${appVersion}</appVersion>
<tablePageLimit>10</tablePageLimit>
</templateParameters>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>hu.blackbelt.judo.generator</groupId>
<artifactId>judo-ui-typescript-rest-commons</artifactId>
<version>${judo-ui-typescript-rest-version}</version>
</dependency>
<dependency>
<groupId>hu.blackbelt.judo.generator</groupId>
<artifactId>judo-ui-typescript-rest-api</artifactId>
<version>${judo-ui-typescript-rest-version}</version>
</dependency>
<dependency>
<groupId>hu.blackbelt.judo.generator</groupId>
<artifactId>judo-ui-typescript-rest-service</artifactId>
<version>${judo-ui-typescript-rest-version}</version>
</dependency>
<dependency>
<groupId>hu.blackbelt.judo.generator</groupId>
<artifactId>judo-ui-typescript-rest-axios</artifactId>
<version>${judo-ui-typescript-rest-version}</version>
</dependency>
<dependency>
<groupId>hu.blackbelt.judo.generator</groupId>
<artifactId>judo-ui-react</artifactId>
<version>${judo-ui-react-version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>external-packages</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>hu.blackbelt.judo.generator</groupId>
<artifactId>judo-ui-react-external-packages</artifactId>
<version>${judo-ui-react-version}</version>
<type>jar</type>
<overWrite>true</overWrite>
</artifactItem>
</artifactItems>
<includes>externals/**</includes>
<outputDirectory>${generation-target}</outputDirectory>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>hu.blackbelt.judo.meta</groupId>
<artifactId>hu.blackbelt.judo.meta.ui.model.northwind</artifactId>
<version>${judo-meta-ui-version}</version>
<groupId>hu.blackbelt.judo.generator</groupId>
<artifactId>judo-ui-react-external-packages</artifactId>
<version>${judo-ui-react-version}</version>
</dependency>
</dependencies>
</plugin>
Expand All @@ -68,11 +174,11 @@ It can be used as:
</project>
----

This example generates a complete project setup into `target/classes` directory.
In a project this generation can be placed in the model project as a
profile.
This example generates a complete application into the `target/frontend-react` directory.

The `judo-ui-archetype-maven-plugin` documentation is placed inside
the plugin documentation itself. https://github.com/BlackBeltTechnology/judo-ui-archetype
The `judo-ui-generator-maven-plugin` documentation is placed inside
the plugin documentation itself. https://github.com/BlackBeltTechnology/judo-meta-ui/tree/develop/generator-maven-plugin

## Notes

The `maven-dependency-plugin` copies repackaged dependencies from the module `judo-ui-react-external-packages`.
32 changes: 32 additions & 0 deletions judo-ui-react-external-packages/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
24 changes: 24 additions & 0 deletions judo-ui-react-external-packages/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>judo-ui-react-external-packages</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
80 changes: 80 additions & 0 deletions judo-ui-react-external-packages/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>hu.blackbelt.judo.generator</groupId>
<artifactId>judo-ui-react-template</artifactId>
<version>${revision}</version>
</parent>

<artifactId>judo-ui-react-external-packages</artifactId>
<packaging>bundle</packaging>
<name>JUDO UI React Frontend Repackaged External Packages</name>

<properties>
<node-install-dir>${project.parent.basedir}/target/nodejs</node-install-dir>
<build-dir>${basedir}/target/classes</build-dir>
</properties>

<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>${frontend-maven-plugin-version}</version>
<executions>
<execution>
<id>install node and pnpm</id>
<goals>
<goal>install-node-and-pnpm</goal>
</goals>
<phase>generate-resources</phase>
</execution>
<execution>
<id>pnpm install</id>
<goals>
<goal>pnpm</goal>
</goals>
<phase>compile</phase>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>build</id>
<goals>
<goal>pnpm</goal>
</goals>
<phase>compile</phase>
<configuration>
<arguments>build</arguments>
</configuration>
</execution>
</executions>
<configuration>
<nodeVersion>v${node-version}</nodeVersion>
<pnpmVersion>${pnpm-version}</pnpmVersion>
<installDirectory>${node-install-dir}</installDirectory>
<workingDirectory>${build-dir}</workingDirectory>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>4.2.1</version>
<extensions>true</extensions>
<configuration>
<instructions>
<!-- <Web-ContextPath>${model-name}/${actor}</Web-ContextPath>-->
<Include-Resource>
/externals=${build-dir}/dist,
{maven-resources}
</Include-Resource>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
6 changes: 6 additions & 0 deletions judo-ui-react-external-packages/src/main/resources/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.idea
**/*.iml
node_modules
target
dist
**/*.log
1 change: 1 addition & 0 deletions judo-ui-react-external-packages/src/main/resources/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
auto-install-peers=true
25 changes: 25 additions & 0 deletions judo-ui-react-external-packages/src/main/resources/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# judo-tatami-ui-packages

Re-packaged external dependencies which do not provide UMD modules.

## Items
- @mui/x-data-grid
- @mui/x-date-pickers
- @mui/x-date-pickers/AdapterDayjs
- react-dom/client
- react/jsx-runtime

## Setup

```bash
pnpm i
```

## Commands

```bash
pnpm build

pnpm watch
pnpm preview
```
Loading

0 comments on commit 769b304

Please sign in to comment.