<?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>
        <artifactId>keycloak-parent</artifactId>
        <groupId>org.keycloak</groupId>
        <version>24.0.4</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>keycloak-js-parent</artifactId>
    <packaging>pom</packaging>

    <name>Keycloak JavaScript Parent</name>
    <description>Parent of all JavaScript related code.</description>

    <modules>
        <module>apps/account-ui</module>
        <module>apps/admin-ui</module>
        <module>libs/keycloak-admin-client</module>
        <module>libs/keycloak-js</module>
    </modules>

    <properties>
        <!-- The JavaScript projects use the non-standard 'src' folder for their sources, therefore, name it here explicitly -->
        <maven.build.cache.input.1>src</maven.build.cache.input.1>
        <!-- The child projects will package from the 'dist' folder, which is listed as a resource, but isn't a source folder -->
        <maven.build.cache.exclude.value.1>${project.basedir}/dist</maven.build.cache.exclude.value.1>
        <!-- The clean step is skipped on Windows -->
        <js.skip.clean>false</js.skip.clean>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>install-node-and-pnpm</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>pnpm-install</id>
                        <goals>
                            <goal>pnpm</goal>
                        </goals>
                        <configuration>
                            <arguments>${pnpm.args.install}</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <configuration>
                    <followSymLinks>false</followSymLinks>
                    <!-- Skip this step if on windows -->
                    <skip>${js.skip.clean}</skip>
                    <filesets>
                        <fileset>
                            <directory>${basedir}</directory>
                            <includes>
                                <include>**/.wireit/**</include>
                                <include>**/node_modules/**</include>
                            </includes>
                        </fileset>
                        <!-- include all non-maven projects here as well -->
                        <fileset>
                            <directory>apps/keycloak-server</directory>
                            <includes>
                                <include>server/**</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>clean-when-not-on-windows</id>
            <activation>
                <os>
                    <family>windows</family>
                </os>
            </activation>
            <properties>
                <js.skip.clean>true</js.skip.clean>
            </properties>
        </profile>
    </profiles>
</project>
