U4-10006 - fix npm/node issues

This commit is contained in:
Stephan
2017-07-14 20:21:29 +02:00
parent f24effdf0e
commit f39531216c
3 changed files with 47 additions and 38 deletions

View File

@@ -24,17 +24,22 @@ function Build-UmbracoDocs
Write-Host "Build UI documentation"
push-location "$src\Umbraco.Web.UI.Client"
# get a temp clean path (will be restored)
$p = $env:path
$env:path = $uenv.NpmPath + ";" + $uenv.NodePath + ";" + $env:path
write "cache clean" > $tmp\belle-docs.log
$nodePath = $uenv.NodePath
$gitExe = (get-command git).Source
$gitPath = [System.IO.Path]::GetDirectoryName($gitExe)
$env:path = "$nodePath;$gitPath"
push-location "$src\Umbraco.Web.UI.Client"
write "" > $tmp\belle-docs.log
&npm cache clean --quiet >> $tmp\belle-docs.log 2>&1
&npm install --quiet >> $tmp\belle-docs.log 2>&1
&npm install -g grunt-cli --quiet >> $tmp\belle-docs.log 2>&1
#&npm install -g bower --quiet >> $tmp\belle.log 2>&1
#&grunt build --buildversion=$version.Release >> $tmp\belle.log 2>&1
&grunt --gruntfile "$src/Umbraco.Web.UI.Client/gruntfile.js" docs >> $tmp\belle-docs.log 2>&1
pop-location
# fixme - should we filter the log to find errors?
#get-content .\build.tmp\belle-docs.log | %{ if ($_ -match "build") { write $_}}
@@ -45,7 +50,6 @@ function Build-UmbracoDocs
(Get-Content $indexPath).Replace("location.href.replace(rUrl, indexFile)", "'$baseUrl'") `
| Set-Content $indexPath
pop-location
$env:path = $p
# zip

View File

@@ -104,30 +104,31 @@ function Get-UmbracoBuildEnv
Remove-File "$path\node-v6.9.1-win-x86.7z"
}
# ensure we have npm
$npm = "$path\npm.*"
$getNpm = $true
if (test-path $npm)
{
$getNpm = $false
$tmpNpm = ls "$path\npm.*" | sort -property Name -descending | select -first 1
if ($tmpNpm.CreationTime -lt [DateTime]::Now.AddDays(-$cache))
{
$getNpm = $true
}
else
{
$npm = $tmpNpm.ToString()
}
}
if ($getNpm)
{
Write-Host "Download Npm..."
&$nuget install npm -OutputDirectory $path -Verbosity quiet
$npm = ls "$path\npm.*" | sort -property Name -descending | select -first 1
$npm.CreationTime = [DateTime]::Now
$npm = $npm.ToString()
}
# note: why? node already brings everything we need!
## ensure we have npm
#$npm = "$path\npm.*"
#$getNpm = $true
#if (test-path $npm)
#{
# $getNpm = $false
# $tmpNpm = ls "$path\npm.*" | sort -property Name -descending | select -first 1
# if ($tmpNpm.CreationTime -lt [DateTime]::Now.AddDays(-$cache))
# {
# $getNpm = $true
# }
# else
# {
# $npm = $tmpNpm.ToString()
# }
#}
#if ($getNpm)
#{
# Write-Host "Download Npm..."
# &$nuget install npm -OutputDirectory $path -Verbosity quiet
# $npm = ls "$path\npm.*" | sort -property Name -descending | select -first 1
# $npm.CreationTime = [DateTime]::Now
# $npm = $npm.ToString()
#}
# find visual studio
# will not work on VSO but VSO does not need it
@@ -175,7 +176,7 @@ function Get-UmbracoBuildEnv
$uenv | add-member -memberType NoteProperty -name VsWhere -value $vswhere
$uenv | add-member -memberType NoteProperty -name Semver -value $semver
$uenv | add-member -memberType NoteProperty -name NodePath -value $node
$uenv | add-member -memberType NoteProperty -name NpmPath -value $npm
#$uenv | add-member -memberType NoteProperty -name NpmPath -value $npm
return $uenv
}

View File

@@ -80,24 +80,28 @@ function Compile-Belle
Write-Host ">> Compile Belle"
Write-Host "Logging to $tmp\belle.log"
push-location "$($uenv.SolutionRoot)\src\Umbraco.Web.UI.Client"
$p = $env:path
$env:path = $uenv.NpmPath + ";" + $uenv.NodePath + ";" + $env:path
write "cache clean" > $tmp\belle.log
# get a temp clean path (will be restored)
$p = $env:path
$nodePath = $uenv.NodePath
$gitExe = (get-command git).Source
$gitPath = [System.IO.Path]::GetDirectoryName($gitExe)
$env:path = "$nodePath;$gitPath"
push-location "$($uenv.SolutionRoot)\src\Umbraco.Web.UI.Client"
write "" > $tmp\belle.log
&npm cache clean --quiet >> $tmp\belle.log 2>&1
&npm install --quiet >> $tmp\belle.log 2>&1
&npm install -g grunt-cli --quiet >> $tmp\belle.log 2>&1
&npm install -g bower --quiet >> $tmp\belle.log 2>&1
&grunt build --buildversion=$version.Release >> $tmp\belle.log 2>&1
pop-location
# fixme - should we filter the log to find errors?
#get-content .\build.tmp\belle.log | %{ if ($_ -match "build") { write $_}}
pop-location
$env:path = $p
# restore path
$env:path = $p
# setting node_modules folder to hidden
# used to prevent VS13 from crashing on it while loading the websites project