<?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">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.uberfire</groupId>
        <artifactId>uberfire-parent</artifactId>
        <version>7.71.0.Final</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <packaging>jar</packaging>
    <artifactId>appformer-js</artifactId>
    <version>7.71.0.Final</version>
    <name>AppFormer.js :: Core</name>
    <description>AppFormer.js Core</description>

    <build>
        <plugins>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <configuration>
                    <installDirectory>${project.build.directory}</installDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>install yarn</id>
                        <goals>
                            <goal>install-node-and-yarn</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>install node and npm</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>lock-treatment-tool execution</id>
                        <phase>initialize</phase>
                        <goals>
                        <goal>npm</goal>
                        </goals>
                        <configuration>
                        <arguments>exec @kie/lock-treatment-tool --</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>yarn run init</id>
                        <goals>
                            <goal>yarn</goal>
                        </goals>
                        <configuration>
                            <arguments>run init</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>yarn run build</id>
                        <goals>
                            <goal>yarn</goal>
                        </goals>
                        <configuration>
                            <arguments>run build</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>
                                ${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${project.version}/
                            </outputDirectory>
                            <resources>
                                <resource>
                                    <directory>dist/</directory>
                                    <filtering>false</filtering>
                                </resource>
                                <resource>
                                    <directory>.</directory>
                                    <includes>package.json</includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
