<?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/maven-v4_0_0.xsd">

  <parent>
    <groupId>io.jooby</groupId>
    <artifactId>modules</artifactId>
    <version>2.7.2</version>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <artifactId>jooby-graphiql</artifactId>

  <dependencies>
    <dependency>
      <groupId>io.jooby</groupId>
      <artifactId>jooby</artifactId>
      <version>${jooby.version}</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>com.github.eirslett</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>install-node-and-npm</goal>
            </goals>
            <phase>generate-resources</phase>
          </execution>

          <execution>
            <id>npm install</id>
            <goals>
              <goal>npm</goal>
            </goals>
            <phase>generate-resources</phase>
          </execution>
        </executions>
        <configuration>
          <nodeVersion>v12.13.1</nodeVersion>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase>generate-resources</phase>
            <configuration>
              <tasks>
                <property name="output" value="${project.build.outputDirectory}${file.separator}graphiql${file.separator}" />

                <copy failonerror="true" file="node_modules${file.separator}es6-promise${file.separator}dist${file.separator}es6-promise.auto.min.js" tofile="${output}es6-promise.auto.min.js"/>
                <copy failonerror="true" file="node_modules${file.separator}fetch-min${file.separator}index.js" tofile="${output}fetch.min.js"/>
                <copy failonerror="true" file="node_modules${file.separator}react${file.separator}umd${file.separator}react.production.min.js" tofile="${output}react.min.js"/>
                <copy failonerror="true" file="node_modules${file.separator}react-dom${file.separator}umd${file.separator}react-dom.production.min.js" tofile="${output}react-dom.min.js"/>

                <copy failonerror="true" file="node_modules${file.separator}graphiql${file.separator}graphiql.css" tofile="${output}graphiql.css"/>
                <copy failonerror="true" file="node_modules${file.separator}graphiql${file.separator}graphiql.js" tofile="${output}graphiql.min.js"/>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
