<?xml version="1.0" encoding="UTF-8"?>
<!--
  The contents of this file are subject to the terms of the Common Development and
  Distribution License (the License). You may not use this file except in compliance with the
  License.

  You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
  specific language governing permission and limitations under the License.

  When distributing Covered Software, include this CDDL Header Notice in each file and include
  the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
  Header, with the fields enclosed by brackets [] replaced by your own identifying
  information: "Portions copyright [year] [name of copyright owner]".

  Copyright 2014-2016 ForgeRock AS.
  -->
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <parent>
    <artifactId>openig-project</artifactId>
    <groupId>org.openidentityplatform.openig</groupId>
    <version>6.1.1</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>

  <artifactId>openig-ui</artifactId>
  <name>OpenIG User Interface</name>

  <properties>
    <node.install.directory>${project.basedir}</node.install.directory>
    <codemirror.version>4.10</codemirror.version>
  </properties>

  <build>
    <resources>
      <resource>
        <directory>${basedir}/src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
      <resource>
        <directory>${basedir}/src/main/js</directory>
        <filtering>true</filtering>
      </resource>
      <resource>
        <directory>${basedir}/..</directory>
        <filtering>true</filtering>
        <includes>
        		<include>logo.png</include>
        	</includes>
        	<targetPath>${project.build.directory}/www/images</targetPath>
      </resource>
    </resources>

    <outputDirectory>${project.build.directory}/www</outputDirectory>

    <plugins>
      <plugin>
        <groupId>com.github.eirslett</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <version>1.6</version>
        <configuration>
          <installDirectory>${node.install.directory}</installDirectory>
        </configuration>
        <executions>
          <execution>
            <id>install-node-and-npm</id>
            <goals>
              <goal>install-node-and-npm</goal>
            </goals>
            <phase>initialize</phase>
            <configuration>
              <nodeVersion>v20.12.2</nodeVersion>
              <npmVersion>10.5.2</npmVersion>
            </configuration>
          </execution>
          <execution>
            <id>npm-install</id>
            <goals>
              <goal>npm</goal>
            </goals>
            <phase>initialize</phase>
            <configuration>
              <arguments>install --legacy-peer-deps</arguments>
            </configuration>
          </execution>
          <execution>
            <id>grunt</id>
            <goals>
              <goal>grunt</goal>
            </goals>
            <phase>compile</phase>
            <configuration>
              <arguments>build</arguments>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack</id>
            <phase>process-resources</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.openidentityplatform.commons.ui</groupId>
                  <artifactId>commons</artifactId>
                  <type>zip</type>
                  <classifier>www</classifier>
                </artifactItem>
              </artifactItems>
              <outputDirectory>${project.build.directory}/compose</outputDirectory>
            </configuration>
          </execution>
          <execution>
            <id>copy-dependencies-js</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <includeGroupIds>org.openidentityplatform.commons.ui.libs</includeGroupIds>
              <excludeArtifactIds>less,qunit,r</excludeArtifactIds>
              <includeTypes>js</includeTypes>
              <outputDirectory>${project.build.directory}/compose/libs</outputDirectory>
              <overWriteReleases>false</overWriteReleases>
              <overWriteSnapshots>false</overWriteSnapshots>
              <overWriteIfNewer>true</overWriteIfNewer>
            </configuration>
          </execution>
          <execution>
            <id>copy-dependencies-css</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <includeGroupIds>org.openidentityplatform.commons.ui.libs</includeGroupIds>
              <excludeArtifactIds>qunit</excludeArtifactIds>
              <includeTypes>css</includeTypes>
              <outputDirectory>${project.build.directory}/compose/css</outputDirectory>
              <overWriteReleases>false</overWriteReleases>
              <overWriteSnapshots>false</overWriteSnapshots>
              <overWriteIfNewer>true</overWriteIfNewer>
            </configuration>
          </execution>
          <execution>
            <id>copy-dependencies-less</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <includeArtifactIds>less</includeArtifactIds>
              <includeTypes>js</includeTypes>
              <outputDirectory>${project.build.directory}/less</outputDirectory>
              <overWriteReleases>false</overWriteReleases>
              <overWriteSnapshots>false</overWriteSnapshots>
              <overWriteIfNewer>true</overWriteIfNewer>
            </configuration>
          </execution>
          <execution>
            <id>copy-dependencies-r</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <includeArtifactIds>r</includeArtifactIds>
              <includeTypes>js</includeTypes>
              <outputDirectory>${project.build.directory}/optimization</outputDirectory>
              <overWriteReleases>false</overWriteReleases>
              <overWriteSnapshots>false</overWriteSnapshots>
              <overWriteIfNewer>true</overWriteIfNewer>
            </configuration>
          </execution>
          <execution>
            <id>copy-dependencies-qunit</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <includeArtifactIds>qunit</includeArtifactIds>
              <outputDirectory>${basedir}/target/test/libs</outputDirectory>
              <overWriteReleases>false</overWriteReleases>
              <overWriteSnapshots>false</overWriteSnapshots>
              <overWriteIfNewer>true</overWriteIfNewer>
            </configuration>
          </execution>
          <execution>
            <id>unpack-codemirror</id>
            <phase>process-resources</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/compose/libs</outputDirectory>
              <artifactItems>
                <artifactItem>
                  <groupId>org.openidentityplatform.commons.ui.libs</groupId>
                  <artifactId>CodeMirror</artifactId>
                  <version>${codemirror.version}</version>
                  <type>zip</type>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>org.openidentityplatform.commons.ui</groupId>
      <artifactId>commons</artifactId>
      <type>zip</type>
      <classifier>www</classifier>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.ui.libs</groupId>
      <artifactId>CodeMirror</artifactId>
      <version>${codemirror.version}</version>
      <type>zip</type>
    </dependency>

    <dependency>
      <groupId>org.openidentityplatform.commons.ui.libs</groupId>
      <artifactId>sinon</artifactId>
      <version>1.15.4</version>
      <type>js</type>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.commons.ui.libs</groupId>
      <artifactId>qunit</artifactId>
      <version>1.15.0</version>
      <type>js</type>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.commons.ui.libs</groupId>
      <artifactId>qunit</artifactId>
      <version>1.15.0</version>
      <type>css</type>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.commons.ui.libs</groupId>
      <artifactId>d3</artifactId>
      <version>3.5.5</version>
      <classifier>min</classifier>
      <type>js</type>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.commons.ui.libs</groupId>
      <artifactId>dimple</artifactId>
      <version>2.1.2</version>
      <classifier>min</classifier>
      <type>js</type>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.commons.ui.libs</groupId>
      <artifactId>dragula</artifactId>
      <version>3.6.7</version>
      <classifier>min</classifier>
      <type>css</type>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.commons.ui.libs</groupId>
      <artifactId>sifter</artifactId>
      <version>0.4.1</version>
      <classifier>min</classifier>
      <type>js</type>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.commons.ui.libs</groupId>
      <artifactId>microplugin</artifactId>
      <version>0.0.3</version>
      <type>js</type>
    </dependency>
  </dependencies>

  <dependencyManagement>
    <dependencies>
    </dependencies>
  </dependencyManagement>
</project>
