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


    <groupId>au.gov.qld.ssq</groupId>
    <version>1.0.0-SNAPSHOT</version>
    <artifactId>qgds-qol-bootstrap</artifactId>
    <packaging>pom</packaging>

    <properties>
        <frontend-maven-plugin.version>1.15.0</frontend-maven-plugin.version>
        <node.version>v22.19.0</node.version>
        <npm.version>10.9.3</npm.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.3.2</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>${basedir}/dist</directory>
                            <followSymlinks>true</followSymlinks>
                            <includes>
                                <include>**/*</include>
                            </includes>
                        </fileset>
                        <fileset>
                            <directory>${basedir}/storybook-static</directory>
                            <followSymlinks>true</followSymlinks>
                            <includes>
                                <include>**/*</include>
                            </includes>
                        </fileset>
                        <fileset>
                            <directory>${basedir}/docs</directory>
                            <followSymlinks>true</followSymlinks>
                            <includes>
                                <include>**/*</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>${frontend-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>install node and npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <configuration>
                            <nodeVersion>${node.version}</nodeVersion>
                            <npmVersion>${npm.version}</npmVersion>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm install</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <arguments>install</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm lint</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <arguments>run lint</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm package on compile stage</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <arguments>run build</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm test</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <phase>test</phase>
                        <configuration>
                            <arguments>run test</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>storybook</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <phase>package</phase>
                        <configuration>
                            <arguments>run build-storybook</arguments>
                        </configuration>
                    </execution>

<!--                    <execution>-->
<!--                        <id>npm integration</id>-->
<!--                        <goals>-->
<!--                            <goal>npm</goal>-->
<!--                        </goals>-->
<!--                        <phase>integration-test</phase>-->
<!--                        <configuration>-->
<!--                            <arguments>run test:e2e</arguments>-->
<!--                        </configuration>-->
<!--                    </execution>-->
                    <execution>
                        <id>npm package</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <phase>package</phase>
                        <configuration>
                            <arguments>run build</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
