<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>fr.gouv.vitam</groupId>
        <artifactId>ihm-recette</artifactId>
        <version>8.0.3</version>
    </parent>

    <artifactId>ihm-recette-front</artifactId>
    <name>ihm-recette-front</name>
    <packaging>pom</packaging>

    <url>http://maven.apache.org</url>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <unix.name>ihm-recette-front</unix.name>
        <ihm-recette.name>ihm-recette</ihm-recette.name>
        <unix.user>vitam</unix.user>
        <unix.group>vitam</unix.group>
    </properties>

    <build>
        <sourceDirectory>src/app</sourceDirectory>
        <plugins>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>dist</directory>
                            <includes>
                                <include>*</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <configuration>
                    <installDirectory>target</installDirectory>
                </configuration>

                <executions>
                    <execution>
                        <id>install node and npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <configuration>
                            <nodeVersion>v8.6.0</nodeVersion>
                            <npmVersion>5.4.2</npmVersion>
                            <serverId>vitam</serverId>
                            <!-- This is not a mirror of node, if you update the version, please contact integration team -->
                            <downloadRoot>${nodeDownloadRoot}</downloadRoot>
                        </configuration>
                    </execution>

                    <execution>
                        <id>npm install</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>install --no-save</arguments>
                        </configuration>
                    </execution>

                    <execution>
                        <id>test</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>run-script inttest</arguments>
                        </configuration>
                        <phase>test</phase>
                    </execution>

                    <execution>
                        <id>prod</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>run-script prod</arguments>
                        </configuration>
                        <phase>generate-resources</phase>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptors>
                        <descriptor>zip-conf.xml</descriptor>
                    </descriptors>
                    <finalName>${ihm-recette.name}-${project.version}</finalName>
                    <tarLongFileMode>posix</tarLongFileMode>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <header>../../licenses/cecill21.txt</header>
                    <excludes>
                        <exclude>node_modules/**</exclude>
                        <exclude>dist/**</exclude>
                        <exclude>themes/**</exclude>
                        <exclude>e2e/**</exclude>
                        <exclude>src/deb/**</exclude>
                        <exclude>src/asserts/**</exclude>
                        <exclude>pom.xml</exclude>
                        <exclude>**/*.rst</exclude>
                        <exclude>**/*.html</exclude>
                        <exclude>**/*.ts</exclude>
                        <exclude>**/*.js</exclude>
                        <exclude>**/*.py</exclude>
                        <exclude>**/*.css</exclude>
                        <exclude>**/*.sh</exclude>
                        <exclude>**/*.xml</exclude>
                        <exclude>**/README</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
