-
Notifications
You must be signed in to change notification settings - Fork 873
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support installing npm version from package.json engines
fixes #798
- Loading branch information
Showing
4 changed files
with
130 additions
and
1 deletion.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
frontend-maven-plugin/src/it/npm-version-from-engines/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "example", | ||
"version": "0.0.1", | ||
"engines": { | ||
"npm": ">=7 <8" | ||
}, | ||
"dependencies": { | ||
"less": "~3.0.2" | ||
}, | ||
"scripts": { | ||
"prebuild": "npm install" | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
frontend-maven-plugin/src/it/npm-version-from-engines/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?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> | ||
|
||
<groupId>com.github.eirslett</groupId> | ||
<artifactId>example</artifactId> | ||
<version>0</version> | ||
<packaging>pom</packaging> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>com.github.eirslett</groupId> | ||
<artifactId>frontend-maven-plugin</artifactId> | ||
<!-- NB! Set <version> to the latest released version of frontend-maven-plugin, like in README.md --> | ||
<version>@project.version@</version> | ||
|
||
<configuration> | ||
<installDirectory>target</installDirectory> | ||
</configuration> | ||
|
||
<executions> | ||
|
||
<execution> | ||
<id>install node and npm</id> | ||
<goals> | ||
<goal>install-node-and-npm</goal> | ||
</goals> | ||
<configuration> | ||
<nodeVersion>v16.0.0</nodeVersion> | ||
<npmVersion>engines</npmVersion> | ||
</configuration> | ||
</execution> | ||
|
||
<execution> | ||
<id>npm install</id> | ||
<goals> | ||
<goal>npm</goal> | ||
</goals> | ||
<!-- Optional configuration which provides for running any npm command --> | ||
<configuration> | ||
<arguments>install</arguments> | ||
</configuration> | ||
</execution> | ||
|
||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
9 changes: 9 additions & 0 deletions
9
frontend-maven-plugin/src/it/npm-version-from-engines/verify.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
assert new File(basedir, 'target/node').exists() : "Node was not installed in the custom install directory"; | ||
assert new File(basedir, 'node_modules').exists() : "Node modules were not installed in the base directory"; | ||
assert new File(basedir, 'target/node/npm').exists() : "npm was not copied to the node directory"; | ||
|
||
import org.codehaus.plexus.util.FileUtils; | ||
|
||
String buildLog = FileUtils.fileRead(new File(basedir, 'build.log')); | ||
|
||
assert buildLog.contains('BUILD SUCCESS') : 'build was not successful' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters