<?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.8.4</version>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <artifactId>jooby-graphql-playground</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>${node.version}</nodeVersion>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase>generate-resources</phase>
            <configuration>
              <target>
                <property name="output"
                          value="${project.build.outputDirectory}${file.separator}graphql-playground${file.separator}"/>

                <copy failonerror="true"
                      file="node_modules${file.separator}graphql-playground-react${file.separator}build${file.separator}static${file.separator}css${file.separator}index.css"
                      tofile="${output}index.css"/>
                <copy failonerror="true"
                      file="node_modules${file.separator}graphql-playground-react${file.separator}build${file.separator}favicon.png"
                      tofile="${output}favicon.png"/>
                <copy failonerror="true"
                      file="node_modules${file.separator}graphql-playground-react${file.separator}build${file.separator}static${file.separator}js${file.separator}middleware.js"
                      tofile="${output}middleware.js"/>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
