forked from eirslett/frontend-maven-plugin
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DCA11Y-1145: add tests for nvm and fnm
- Loading branch information
Showing
20 changed files
with
265 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
frontend-maven-plugin/src/it/node-version-manager-install-with-fnm/.bash_profile
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,3 @@ | ||
FNM_DIR=$HOME/.fnm | ||
PATH=$FNM_DIR:$PATH | ||
eval "$(fnm env --use-on-cd --shell bash)" |
1 change: 1 addition & 0 deletions
1
frontend-maven-plugin/src/it/node-version-manager-install-with-fnm/.gitignore
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 @@ | ||
node_modules |
1 change: 1 addition & 0 deletions
1
frontend-maven-plugin/src/it/node-version-manager-install-with-fnm/.nvmrc
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 @@ | ||
v20.15.1 |
9 changes: 9 additions & 0 deletions
9
frontend-maven-plugin/src/it/node-version-manager-install-with-fnm/install-fnm.sh
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 @@ | ||
#!/bin/bash | ||
|
||
# invoker env variables are not loaded yet | ||
export HOME="$(dirname "$0")" | ||
|
||
export FNM_DIR="$HOME/.fnm"; | ||
mkdir "$FNM_DIR" | ||
|
||
curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir "$FNM_DIR" --skip-shell --force-install |
4 changes: 4 additions & 0 deletions
4
frontend-maven-plugin/src/it/node-version-manager-install-with-fnm/invoker.properties
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,4 @@ | ||
invoker.environmentVariables.HOME=${basedir}/target/its/node-version-manager-install-with-fnm | ||
invoker.environmentVariables.FNM_DIR=${basedir}/target/its/node-version-manager-install-with-fnm/.fnm | ||
invoker.environmentVariables.XDG_DATA_HOME=${basedir}/target/its/node-version-manager-install-with-fnm | ||
invoker.environmentVariables.SHELL=bash |
27 changes: 27 additions & 0 deletions
27
frontend-maven-plugin/src/it/node-version-manager-install-with-fnm/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
frontend-maven-plugin/src/it/node-version-manager-install-with-fnm/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,10 @@ | ||
{ | ||
"name": "example", | ||
"version": "0.0.1", | ||
"dependencies": { | ||
"classnames": "^2.3.2" | ||
}, | ||
"scripts": { | ||
"prebuild": "npm install" | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
frontend-maven-plugin/src/it/node-version-manager-install-with-fnm/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,61 @@ | ||
<?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>org.codehaus.mojo</groupId>--> | ||
<!-- <artifactId>exec-maven-plugin</artifactId>--> | ||
<!-- <executions>--> | ||
<!-- <execution>--> | ||
<!-- <id>Install nvm</id>--> | ||
<!-- <phase>generate-sources</phase>--> | ||
<!-- <goals>--> | ||
<!-- <goal>exec</goal>--> | ||
<!-- </goals>--> | ||
<!-- <configuration>--> | ||
<!-- <executable>${basedir}/install-nvm.sh</executable>--> | ||
<!-- </configuration>--> | ||
<!-- </execution>--> | ||
<!-- </executions>--> | ||
<!-- </plugin>--> | ||
<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> | ||
<nodeVersion>v20.15.1</nodeVersion> | ||
<workingDirectory>${basedir}</workingDirectory> | ||
</configuration> | ||
|
||
<executions> | ||
<execution> | ||
<id>install node</id> | ||
<goals> | ||
<goal>install-node-and-npm</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>npm ci</id> | ||
<goals> | ||
<goal>npm</goal> | ||
</goals> | ||
<!-- Optional configuration which provides for running any npm command --> | ||
<configuration> | ||
<arguments>ci</arguments> | ||
</configuration> | ||
</execution> | ||
|
||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
3 changes: 3 additions & 0 deletions
3
frontend-maven-plugin/src/it/node-version-manager-install-with-fnm/prebuild.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,3 @@ | ||
def p = "sh $basedir/install-fnm.sh".execute() | ||
p.waitFor() | ||
println p.text |
8 changes: 8 additions & 0 deletions
8
frontend-maven-plugin/src/it/node-version-manager-install-with-fnm/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,8 @@ | ||
import org.codehaus.plexus.util.FileUtils | ||
|
||
// assert | ||
assert !new File(basedir, 'node').exists() : "Node was installed in the custom install directory" | ||
assert new File(basedir, 'node_modules').exists() : "Node modules were not installed in the base directory" | ||
|
||
String buildLog = FileUtils.fileRead(new File(basedir, 'build.log')) | ||
assert buildLog.contains('BUILD SUCCESS') : 'build was not successful' |
7 changes: 7 additions & 0 deletions
7
frontend-maven-plugin/src/it/node-version-manager-install-with-nvm/.bash_profile
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,7 @@ | ||
export NVM_DIR="$HOME/.nvm" | ||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm into the shell | ||
|
||
# disable global fnm if installed | ||
fnm() { | ||
exit 1; | ||
} |
1 change: 1 addition & 0 deletions
1
frontend-maven-plugin/src/it/node-version-manager-install-with-nvm/.gitignore
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 @@ | ||
node_modules |
1 change: 1 addition & 0 deletions
1
frontend-maven-plugin/src/it/node-version-manager-install-with-nvm/.nvmrc
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 @@ | ||
v20.15.1 |
17 changes: 17 additions & 0 deletions
17
frontend-maven-plugin/src/it/node-version-manager-install-with-nvm/install-nvm.sh
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,17 @@ | ||
#!/bin/bash | ||
|
||
# invoker env variables are not loaded yet | ||
export HOME="$(dirname "$0")" | ||
|
||
export NVM_DIR="$HOME/.nvm"; | ||
mkdir "$NVM_DIR" | ||
echo "NVM_DIR set"; | ||
|
||
( | ||
git clone https://github.com/nvm-sh/nvm.git "$NVM_DIR" && | ||
cd "$NVM_DIR" && | ||
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)` | ||
); | ||
echo "NVM checked out"; | ||
|
||
|
3 changes: 3 additions & 0 deletions
3
frontend-maven-plugin/src/it/node-version-manager-install-with-nvm/invoker.properties
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,3 @@ | ||
invoker.environmentVariables.HOME=${basedir}/target/its/node-version-manager-install-with-nvm | ||
invoker.environmentVariables.NVM_DIR=${basedir}/target/its/node-version-manager-install-with-nvm/.nvm | ||
invoker.environmentVariables.SHELL=bash |
27 changes: 27 additions & 0 deletions
27
frontend-maven-plugin/src/it/node-version-manager-install-with-nvm/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
frontend-maven-plugin/src/it/node-version-manager-install-with-nvm/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,10 @@ | ||
{ | ||
"name": "example", | ||
"version": "0.0.1", | ||
"dependencies": { | ||
"classnames": "^2.3.2" | ||
}, | ||
"scripts": { | ||
"prebuild": "npm install" | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
frontend-maven-plugin/src/it/node-version-manager-install-with-nvm/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,61 @@ | ||
<?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>org.codehaus.mojo</groupId>--> | ||
<!-- <artifactId>exec-maven-plugin</artifactId>--> | ||
<!-- <executions>--> | ||
<!-- <execution>--> | ||
<!-- <id>Install nvm</id>--> | ||
<!-- <phase>generate-sources</phase>--> | ||
<!-- <goals>--> | ||
<!-- <goal>exec</goal>--> | ||
<!-- </goals>--> | ||
<!-- <configuration>--> | ||
<!-- <executable>${basedir}/install-nvm.sh</executable>--> | ||
<!-- </configuration>--> | ||
<!-- </execution>--> | ||
<!-- </executions>--> | ||
<!-- </plugin>--> | ||
<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> | ||
<nodeVersion>v20.15.1</nodeVersion> | ||
<workingDirectory>${basedir}</workingDirectory> | ||
</configuration> | ||
|
||
<executions> | ||
<execution> | ||
<id>install node</id> | ||
<goals> | ||
<goal>install-node-and-npm</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>npm ci</id> | ||
<goals> | ||
<goal>npm</goal> | ||
</goals> | ||
<!-- Optional configuration which provides for running any npm command --> | ||
<configuration> | ||
<arguments>ci</arguments> | ||
</configuration> | ||
</execution> | ||
|
||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
3 changes: 3 additions & 0 deletions
3
frontend-maven-plugin/src/it/node-version-manager-install-with-nvm/prebuild.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,3 @@ | ||
def p = "sh $basedir/install-nvm.sh".execute() | ||
p.waitFor() | ||
println p.text |
8 changes: 8 additions & 0 deletions
8
frontend-maven-plugin/src/it/node-version-manager-install-with-nvm/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,8 @@ | ||
import org.codehaus.plexus.util.FileUtils | ||
|
||
// assert | ||
assert !new File(basedir, 'node').exists() : "Node was installed in the custom install directory" | ||
assert new File(basedir, 'node_modules').exists() : "Node modules were not installed in the base directory" | ||
|
||
String buildLog = FileUtils.fileRead(new File(basedir, 'build.log')) | ||
assert buildLog.contains('BUILD SUCCESS') : 'build was not successful' |