<?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.28.20</version>
        <relativePath>..</relativePath>
    </parent>

    <artifactId>frontend</artifactId>
    <name>frontend</name>
    <packaging>jar</packaging>

    <properties>
        <maven.deploy.skip>true</maven.deploy.skip>
    </properties>

    <profiles>
        <profile>
            <id>frontend-build</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <execution>
                                <id>yarn install --immutable</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>yarn</executable>
                                    <arguments>
                                        <argument>install</argument>
                                    </arguments>
                                </configuration>
                            </execution>

                            <!-- yarn build -->
                            <execution>
                                <id>yarn run build</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>yarn</executable>
                                    <arguments>
                                        <argument>run</argument>
                                        <argument>build</argument>
                                    </arguments>
                                    <environmentVariables>
                                        <NODE_OPTIONS>--max_old_space_size=4096</NODE_OPTIONS>
                                    </environmentVariables>
                                </configuration>
                            </execution>

                            <!-- yarn lint -->
                            <execution>
                                <id>yarn-lint</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>yarn</executable>
                                    <arguments>
                                        <argument>run</argument>
                                        <argument>lint</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
