<?xml version="1.0" encoding="UTF-8"?>
<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">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>edu.wgu.osmt</groupId>
    <artifactId>osmt-parent</artifactId>
    <version>2.3.0</version>
  </parent>

  <groupId>edu.wgu.osmt</groupId>
  <artifactId>osmt-ui</artifactId>
  <version>2.3.0</version>

  <packaging>jar</packaging>

  <properties>
    <main.basedir>${project.parent.basedir}</main.basedir>
  </properties>

  <build>
    <resources>
      <resource>
        <directory>./dist/ui</directory>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>com.github.eirslett</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <version>1.9.1</version>
        <configuration>
          <workingDirectory>./</workingDirectory>
          <nodeVersion>v16.13.0</nodeVersion>
          <npmVersion>8.1.0</npmVersion>
        </configuration>
        <executions>
          <execution>
            <id>install node and npm</id>
            <goals>
              <goal>install-node-and-npm</goal>
            </goals>
            <phase>generate-resources</phase>
          </execution>
          <execution>
            <id>npm install</id>
            <goals>
              <goal>npm</goal>
            </goals>
            <configuration>
              <npmInheritsProxyConfigFromMaven>false</npmInheritsProxyConfigFromMaven>
              <arguments>install</arguments>
            </configuration>
          </execution>
          <execution>
            <id>test</id>
            <goals>
              <goal>npm</goal>
            </goals>
            <phase>test</phase>
            <configuration>
              <arguments>run ci-test</arguments>
            </configuration>
          </execution>
          <execution>
            <id>npm-build-prod</id>
            <goals>
              <goal>npm</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
              <arguments>run build-prod</arguments>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <!-- This profile skips UI test that require Chrome to run -->
      <id>dockerfile-build</id>
      <build>
        <plugins>
          <plugin>
            <groupId>com.github.eirslett</groupId>
            <artifactId>frontend-maven-plugin</artifactId>
            <version>1.9.1</version>
            <executions>
              <execution>
                <id>test</id>
                <phase>none</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
