<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <groupId>be.e-contract</groupId>
        <artifactId>enterprise-jsf</artifactId>
        <version>1.34.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <groupId>be.e-contract.enterprise-jsf</groupId>
    <artifactId>ejsf-taglib-webauthn</artifactId>
    <name>Enterprise JSF Tag Library - WebAuthn</name>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/node</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>prepare-package-copy-resources-webauthn</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/classes/META-INF/resources/ejsf/webauthn</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${basedir}/target/node_modules/@github/webauthn-json/dist/browser-global</directory>
                                    <includes>
                                        <include>webauthn-json.browser-global.js</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>install-node-and-npm</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <configuration>
                            <nodeVersion>${node.version}</nodeVersion>
                            <npmVersion>${npm.version}</npmVersion>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>install</arguments>
                            <workingDirectory>target</workingDirectory>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <installDirectory>target/</installDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
