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.
Issue/master/dca11 y 1145 node version manager support windows (#21)
* add fnm test for windows * add windows fnm support
- Loading branch information
Showing
10 changed files
with
152 additions
and
14 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
frontend-maven-plugin/src/it/node-version-manager/windows/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 @@ | ||
20.15.1 |
25 changes: 25 additions & 0 deletions
25
frontend-maven-plugin/src/it/node-version-manager/windows/fnm/install-fnm.ps1
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,25 @@ | ||
# Set the HOME directory to the directory of the script | ||
$WORKING_DIR = Split-Path -Parent $MyInvocation.MyCommand.Definition | ||
|
||
Write-Output $WORKING_DIR | ||
|
||
# Set the FNM_DIR variable | ||
$FNM_DIR = Join-Path -Path $WORKING_DIR -ChildPath ".fnm" | ||
|
||
# Create the directory if it does not exist | ||
if (-Not (Test-Path -Path $FNM_DIR)) { | ||
New-Item -ItemType Directory -Path $FNM_DIR | Out-Null | ||
} | ||
|
||
# Download and execute the FNM install script | ||
$zipUrl = "https://github.com/Schniz/fnm/releases/download/v1.38.1/fnm-windows.zip" | ||
$zipFilePath = "$FNM_DIR\installer.zip" | ||
Invoke-WebRequest -Uri $zipUrl -OutFile $zipFilePath | ||
|
||
$destinationPath = $FNM_DIR | ||
Expand-Archive -Path $zipFilePath -DestinationPath $destinationPath -Force | ||
|
||
# Load the FNM environment and install Node.js version 20.15.1 | ||
Invoke-Expression "$FNM_DIR\fnm.exe install 20.15.1 --fnm-dir $FNM_DIR" | ||
|
||
Write-Output "Finished FNM installation" |
3 changes: 3 additions & 0 deletions
3
frontend-maven-plugin/src/it/node-version-manager/windows/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,3 @@ | ||
invoker.environmentVariables.HOME=${basedir}/target/it/node-version-manager/windows/fnm | ||
invoker.environmentVariables.FNM_DIR=${basedir}/target/it/node-version-manager/windows/fnm/.fnm | ||
invoker.environmentVariables.XDG_DATA_HOME=${basedir}/target/it/node-version-manager/windows/fnm |
27 changes: 27 additions & 0 deletions
27
frontend-maven-plugin/src/it/node-version-manager/windows/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/windows/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" | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
frontend-maven-plugin/src/it/node-version-manager/windows/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,43 @@ | ||
<?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>fnm-with-npm</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> | ||
<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> |
2 changes: 2 additions & 0 deletions
2
frontend-maven-plugin/src/it/node-version-manager/windows/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,2 @@ | ||
def p = "powershell $basedir\\install-fnm.ps1".execute() | ||
p.waitForProcessOutput(System.out, System.err) |
7 changes: 7 additions & 0 deletions
7
frontend-maven-plugin/src/it/node-version-manager/windows/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,7 @@ | ||
import org.codehaus.plexus.util.FileUtils | ||
|
||
String buildLog = FileUtils.fileRead(new File(basedir, 'build.log')) | ||
assert buildLog.contains('Using FNM version manager') : 'Node has been installed with a different version manager' | ||
|
||
assert !new File(basedir, 'node/node').exists() : "Node was installed bypassing version manager" | ||
assert new File(basedir, 'node_modules').exists() : "Node modules were not installed in the base directory" |
2 changes: 2 additions & 0 deletions
2
frontend-maven-plugin/src/it/node-version-manager/windows/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,2 @@ | ||
# ignoring windows for now | ||
invoker.os.family=windows |
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