From bbed2fa8f683947da0072f574bde0dbdf8bdbc15 Mon Sep 17 00:00:00 2001 From: Stephan Date: Fri, 21 Jul 2017 09:08:21 +0200 Subject: [PATCH] U4-10006 - temp debug --- .../Umbraco.Build/Build-UmbracoDocs.ps1 | 11 ++---- .../Modules/Umbraco.Build/Umbraco.Build.psm1 | 38 +++++++++++++++---- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/build/Modules/Umbraco.Build/Build-UmbracoDocs.ps1 b/build/Modules/Umbraco.Build/Build-UmbracoDocs.ps1 index 23041cd3ec..35a109386c 100644 --- a/build/Modules/Umbraco.Build/Build-UmbracoDocs.ps1 +++ b/build/Modules/Umbraco.Build/Build-UmbracoDocs.ps1 @@ -24,12 +24,8 @@ function Build-UmbracoDocs Write-Host "Build UI documentation" - # 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" + # get a temp clean node env (will restore) + Sandbox-Node push-location "$src\Umbraco.Web.UI.Client" write "" > $tmp\belle-docs.log @@ -50,7 +46,8 @@ function Build-UmbracoDocs (Get-Content $indexPath).Replace("location.href.replace(rUrl, indexFile)", "'$baseUrl'") ` | Set-Content $indexPath - $env:path = $p + # restore + Restore-Node # zip &$uenv.Zip a -tzip -r "$out\ui-docs.zip" "$src\Umbraco.Web.UI.Client\docs\api\*.*" ` diff --git a/build/Modules/Umbraco.Build/Umbraco.Build.psm1 b/build/Modules/Umbraco.Build/Umbraco.Build.psm1 index cb41157f43..d1e8bc357b 100644 --- a/build/Modules/Umbraco.Build/Umbraco.Build.psm1 +++ b/build/Modules/Umbraco.Build/Umbraco.Build.psm1 @@ -65,6 +65,32 @@ function Prepare-Build Copy-File "$webUi\web.Template.config" "$webUi\web.config" } +function Sandbox-Node +{ + param ( + $uenv # an Umbraco build environment (see Get-UmbracoBuildEnv) + ) + + $global:node_path = $env:path + $nodePath = $uenv.NodePath + $gitExe = (get-command git).Source + $gitPath = [System.IO.Path]::GetDirectoryName($gitExe) + $env:path = "$nodePath;$gitPath" + + $global:node_npmcache = $env:NPM_CONFIG_CACHE + $global:node_npmprefix = $env:NPM_CONFIG_PREFIX + + rm env:NPM_CONFIG_CACHE + rm env:NPM_CONFIG_PREFIX +} + +function Restore-Node +{ + $env:path = $node_path + $env:NPM_CONFIG_CACHE = $node_npmcache + $env:NPM_CONFIG_PREFIX = $node_npmprefix +} + # # Builds the Belle UI project # @@ -81,12 +107,8 @@ function Compile-Belle Write-Host ">> Compile Belle" Write-Host "Logging to $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" + # get a temp clean node env (will restore) + Sandbox-Node push-location "$($uenv.SolutionRoot)\src\Umbraco.Web.UI.Client" write "" > $tmp\belle.log @@ -109,8 +131,8 @@ function Compile-Belle # fixme - should we filter the log to find errors? #get-content .\build.tmp\belle.log | %{ if ($_ -match "build") { write $_}} - # restore path - $env:path = $p + # restore + Restore-Node # setting node_modules folder to hidden # used to prevent VS13 from crashing on it while loading the websites project