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

    <parent>
        <groupId>net.n2oapp.framework</groupId>
        <artifactId>framework</artifactId>
        <version>7.16.0</version>
        <relativePath>../..</relativePath>
    </parent>

    <artifactId>docusaurus</artifactId>
    <name>docusaurus</name>
    <packaging>jar</packaging>

    <properties>
        <maven.deploy.skip>true</maven.deploy.skip>
        <sandboxUrl>https://n2oapp.net/sandbox</sandboxUrl>
        <docusaurusUrl>/next/docusaurus</docusaurusUrl>
    </properties>


    <build>
        <plugins>

            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <echo file="${basedir}/src/ci-config.json">{
    "docusaurusUrl": "${docusaurusUrl}",
    "sandboxUrl": "${sandboxUrl}"
}
                                </echo>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

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

                <executions>

                    <execution>
                        <id>install-node-and-yarn</id>
                        <goals>
                            <goal>install-node-and-yarn</goal>
                        </goals>
                        <configuration>
                            <nodeVersion>v12.13.0</nodeVersion>
                            <yarnVersion>v1.6.0</yarnVersion>
                        </configuration>
                    </execution>

                    <execution>
                        <id>yarn install</id>
                        <goals>
                            <goal>yarn</goal>
                        </goals>
                        <configuration>
                            <environmentVariables>
                                <max_old_space_size>4096</max_old_space_size>
                            </environmentVariables>
                            <arguments>install</arguments>
                        </configuration>
                    </execution>

                    <execution>
                        <id>yarn build</id>
                        <goals>
                            <goal>yarn</goal>
                        </goals>
                        <configuration>
                            <environmentVariables>
                                <max_old_space_size>4096</max_old_space_size>
                            </environmentVariables>
                            <arguments>build</arguments>
                        </configuration>
                    </execution>

                </executions>
            </plugin>
        </plugins>
    </build>

</project>
