<?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">

    <parent>
        <artifactId>crowdsource-parent</artifactId>
        <groupId>de.asideas.crowdsource</groupId>
        <version>1.0</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>crowdsource-frontend</artifactId>

    <properties>
        <github.global.server>github</github.global.server>
        <deploy.to.git>true</deploy.to.git>
    </properties>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <excludes>
                    <!-- Exclude javascript files as they are minified and copied to target/classes by gulp -->
                    <exclude>**/*.js</exclude>
                </excludes>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>${project.basedir}/src/test/javascript</directory>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>0.0.23</version>
                <executions>
                    <!-- 1. Install node and npm locally -->
                    <execution>
                        <id>install node and npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <configuration>
                            <nodeVersion>v0.10.18</nodeVersion>
                            <npmVersion>1.3.8</npmVersion>
                        </configuration>
                    </execution>

                    <!-- 2. Install karma and karma plugins -->
                    <execution>
                        <id>npm install</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                    </execution>

                    <!-- 3. Build FE -->
                    <execution>
                        <id>npm run package</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>

                        <configuration>
                            <arguments>run package</arguments>
                        </configuration>
                    </execution>

                    <!-- 4. Run karma tests -->
                    <execution>
                        <id>javascript tests</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>run test</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>