Skip to content

Commit

Permalink
Pack NPM libraries behind production build profile
Browse files Browse the repository at this point in the history
Closes keycloak#35595

Signed-off-by: Jon Koops <[email protected]>
  • Loading branch information
jonkoops committed Dec 4, 2024
1 parent faf36dd commit 52c9b02
Show file tree
Hide file tree
Showing 5 changed files with 194 additions and 181 deletions.
59 changes: 25 additions & 34 deletions js/apps/account-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,31 @@
<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<id>lib-build</id>
<goals>
<goal>pnpm</goal>
</goals>
<configuration>
<arguments>build</arguments>
<environmentVariables>
<LIB>true</LIB>
</environmentVariables>
</configuration>
</execution>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<id>pnpm-build-lib</id>
<goals>
<goal>pnpm</goal>
</goals>
<configuration>
<arguments>build</arguments>
<environmentVariables>
<LIB>true</LIB>
</environmentVariables>
</configuration>
</execution>
<execution>
<id>pnpm-pack</id>
<phase>package</phase>
<goals>
<goal>pnpm</goal>
</goals>
<configuration>
<arguments>pack --pack-destination=target</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand All @@ -82,24 +92,5 @@
<directory>maven-resources</directory>
</resource>
</resources>

<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<id>pack</id>
<phase>package</phase>
<goals>
<goal>pnpm</goal>
</goals>
<configuration>
<arguments>pack --pack-destination=target</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
30 changes: 11 additions & 19 deletions js/apps/admin-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<id>lib-build</id>
<id>pnpm-build-lib</id>
<goals>
<goal>pnpm</goal>
</goals>
Expand All @@ -69,6 +69,16 @@
</environmentVariables>
</configuration>
</execution>
<execution>
<id>pnpm-pack</id>
<phase>package</phase>
<goals>
<goal>pnpm</goal>
</goals>
<configuration>
<arguments>pack --pack-destination=target</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand All @@ -82,23 +92,5 @@
<directory>maven-resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<id>pack</id>
<phase>package</phase>
<goals>
<goal>pnpm</goal>
</goals>
<configuration>
<arguments>pack --pack-destination=target</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
78 changes: 44 additions & 34 deletions js/libs/keycloak-admin-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,50 @@
<description>A JavaScript client to interact with Keycloak's Administration API.</description>
<packaging>pom</packaging>

<profiles>
<profile>
<id>jboss-release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>create-target-dir</id>
<phase>prepare-package</phase>
<configuration>
<target>
<mkdir dir="./target" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<id>pnpm-pack</id>
<phase>package</phase>
<goals>
<goal>pnpm</goal>
</goals>
<configuration>
<arguments>pack --pack-destination=target</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<plugins>
<plugin>
Expand All @@ -24,40 +68,6 @@
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>create-target-dir</id>
<phase>prepare-package</phase>
<configuration>
<target>
<mkdir dir="./target"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<id>pack</id>
<phase>package</phase>
<goals>
<goal>pnpm</goal>
</goals>
<configuration>
<arguments>pack --pack-destination=target</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
130 changes: 70 additions & 60 deletions js/libs/keycloak-js/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,76 @@
<description>A client-side JavaScript OpenID Connect library that can be used to secure web applications.</description>
<packaging>pom</packaging>

<profiles>
<profile>
<id>jboss-release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>create-target-dir</id>
<phase>prepare-package</phase>
<configuration>
<target>
<mkdir dir="./target" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<!-- Skip execution of build with an empty phase. -->
<id>pnpm-build</id>
<phase/>
</execution>
<execution>
<id>pnpm-pack</id>
<phase>package</phase>
<goals>
<goal>pnpm</goal>
</goals>
<configuration>
<arguments>pack --pack-destination=target</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>target/keycloak-js-${project.version.npm}.tgz</file>
<type>tar.gz</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<plugins>
<plugin>
Expand All @@ -24,66 +94,6 @@
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>create-target-dir</id>
<phase>prepare-package</phase>
<configuration>
<target>
<mkdir dir="./target"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<executions>
<execution>
<!-- Skip execution of build with an empty phase. -->
<id>pnpm-build</id>
<phase/>
</execution>
<execution>
<id>pack</id>
<phase>package</phase>
<goals>
<goal>pnpm</goal>
</goals>
<configuration>
<arguments>pack --pack-destination=target</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>target/keycloak-js-${project.version.npm}.tgz</file>
<type>tar.gz</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit 52c9b02

Please sign in to comment.