Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PNPM Experiment #772

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions xwiki-commons-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<module>xwiki-commons-tool-test</module>
<module>xwiki-commons-tool-verification-resources</module>
<module>xwiki-commons-tool-webjar-handlers</module>
<module>xwiki-commons-tool-webjar-node-handlers</module>
<module>xwiki-commons-tool-xar</module>
</modules>
<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<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.xwiki.commons</groupId>
<artifactId>xwiki-commons-tool-pom</artifactId>
<version>16.1.0-SNAPSHOT</version>
<relativePath>../xwiki-commons-tool-pom</relativePath>
</parent>
<artifactId>xwiki-commons-tool-webjar-node-handlers</artifactId>
<name>XWiki Commons - Tools - WEBJAR Handlers</name>
<packaging>jar</packaging>
<description>XWiki Commons - Tools - WEBJAR Node Handlers (Lifecycle and ArtifactHandler)</description>
<properties>
<xwiki.jacoco.instructionRatio>0.00</xwiki.jacoco.instructionRatio>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
</dependency>
</dependencies>
<profiles>
<!-- Override default check for javadoc JAR since this module doesn't contain any Java file and this doesn't
make the Maven Central Repository check fail (they must check for Java files in the main JAR before deciding
that the Javadoc JAR is missing or not). -->
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-javadoc-exists</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<evaluateBeanshell>
<condition>true</condition>
</evaluateBeanshell>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*
-->

<component-set>
<components>
<component>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>webjar-node</role-hint>
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
<configuration>
<phases>
<process-resources>
<mojos>
<mojo>
<goal>com.github.eirslett:frontend-maven-plugin:install-node-and-pnpm</goal>
<configuration>
<nodeVersion>v20.11.0</nodeVersion>
<pnpmVersion>8.15.1</pnpmVersion>
<installDirectory>${basedir}/target</installDirectory>
</configuration>
</mojo>
<mojo>
<goal>com.github.eirslett:frontend-maven-plugin:pnpm</goal>
<configuration>
<arguments>install --frozen-lockfile</arguments>
<workingDirectory>${basedir}/src/main/node</workingDirectory>
<installDirectory>${basedir}/target</installDirectory>
</configuration>
</mojo>
</mojos>
</process-resources>
<compile>
<mojos>
<mojo>
<goal>com.github.eirslett:frontend-maven-plugin:pnpm</goal>
<configuration>
<arguments>exec tsc --noEmit</arguments>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: It must be possible to skip typescript type checking in case of project without typescript.

<workingDirectory>${basedir}/src/main/node</workingDirectory>
<installDirectory>${basedir}/target</installDirectory>
</configuration>
</mojo>
<mojo>
<goal>com.github.eirslett:frontend-maven-plugin:pnpm</goal>
<configuration>
<arguments>exec vite build</arguments>
<workingDirectory>${basedir}/src/main/node</workingDirectory>
<installDirectory>${basedir}/target</installDirectory>
</configuration>
</mojo>
</mojos>
</compile>
<process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
<package>
<mojos>
<mojo>
<!-- Prepare resources for WebJar packaging. -->
<goal>org.apache.maven.plugins:maven-resources-plugin:copy-resources</goal>
<configuration>
<outputDirectory>${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${project.version}</outputDirectory>
<resources>
<resource>
<directory>src/main/node/dist</directory>
</resource>
</resources>
</configuration>
</mojo>
<mojo>
<goal>org.apache.maven.plugins:maven-jar-plugin:jar</goal>
<configuration>
<archive>
<!-- Cancel custom MANIFEST file (since it's not generated for "webjar" packaging) -->
<manifestFile combine.self="override" />
</archive>
</configuration>
</mojo>
</mojos>
</package>
<install>org.apache.maven.plugins:maven-install-plugin:install</install>
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
</phases>
</configuration>
</component>
<component>
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
<role-hint>webjar-node</role-hint>
<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
<configuration>
<type>webjar-node</type>
<extension>jar</extension>
<packaging>webjar-node</packaging>
<addedToClasspath>true</addedToClasspath>
<includesDependencies>false</includesDependencies>
</configuration>
</component>
</components>
</component-set>