move node install to setup environment script
This commit is contained in:
@@ -34,18 +34,6 @@ function Save-ElxInternals {
|
|||||||
Push-Location -StackName ElxTools $extractElxToolsScriptPath
|
Push-Location -StackName ElxTools $extractElxToolsScriptPath
|
||||||
|
|
||||||
if (-not $Quiet) {
|
if (-not $Quiet) {
|
||||||
Write-Host "Installing Node.js dependencies for the ELX Tools..."
|
|
||||||
}
|
|
||||||
|
|
||||||
# Install Node.js dependencies for the ELX Tools
|
|
||||||
& npm install
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
|
||||||
Write-Error "npm install failed with exit code $LASTEXITCODE."
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not $Quiet) {
|
|
||||||
Write-Host "Node.js dependencies installed successfully!" -ForegroundColor Cyan
|
|
||||||
Write-Host "Executing ELX extraction..."
|
Write-Host "Executing ELX extraction..."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,30 +1,5 @@
|
|||||||
# If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
|
function Initialize-EnvironmentSettings {
|
||||||
# #"No Administrative rights, it will display a popup window asking user for Admin rights"
|
Write-Host "Initializing settings..."
|
||||||
# $arguments = "-NoProfile -ExecutionPolicy Bypass -Command & '" + $myinvocation.mycommand.definition + "'"
|
|
||||||
# Start-Process "$psHome\powershell.exe" -Verb runAs -ArgumentList $arguments #-WindowStyle Hidden
|
|
||||||
# break
|
|
||||||
# }
|
|
||||||
|
|
||||||
# # Set execution policy remotesigned machine wide
|
|
||||||
# try {
|
|
||||||
# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -InformationAction SilentlyContinue
|
|
||||||
# }
|
|
||||||
# catch {
|
|
||||||
# # Suppress
|
|
||||||
# }
|
|
||||||
|
|
||||||
# # Load Environment Setup Module
|
|
||||||
# $envSetupModulePath = $(Join-Path $PSScriptRoot "EnvironmentSetup.psm1")
|
|
||||||
# if (-not (Test-Path $envSetupModulePath)) {
|
|
||||||
# Write-Warning "Environment Setup Module file '$($envSetupModulePath)' not found!"
|
|
||||||
# Write-Host
|
|
||||||
# exit 1
|
|
||||||
# }
|
|
||||||
# Import-Module -Force $envSetupModulePath
|
|
||||||
|
|
||||||
Write-Host "Preparing environment..." -ForegroundColor Cyan
|
|
||||||
|
|
||||||
Write-Host "Preparing settings..." -ForegroundColor Gray
|
|
||||||
|
|
||||||
# Load and validate .env.template (INI-style key=value list)
|
# Load and validate .env.template (INI-style key=value list)
|
||||||
$parentDir = Split-Path -Parent $PSScriptRoot
|
$parentDir = Split-Path -Parent $PSScriptRoot
|
||||||
@@ -72,9 +47,9 @@ foreach ($name in $settingNames) {
|
|||||||
if (-not $envValues.ContainsKey($name) -or [string]::IsNullOrWhiteSpace($envValues[$name])) {
|
if (-not $envValues.ContainsKey($name) -or [string]::IsNullOrWhiteSpace($envValues[$name])) {
|
||||||
do {
|
do {
|
||||||
Write-Host "$name value is missing!" -ForegroundColor Yellow
|
Write-Host "$name value is missing!" -ForegroundColor Yellow
|
||||||
$input = Read-Host "Enter value for $name"
|
$settingValue = Read-Host "Enter value for $name"
|
||||||
} while ([string]::IsNullOrWhiteSpace($input))
|
} while ([string]::IsNullOrWhiteSpace($settingValue))
|
||||||
$envValues[$name] = $input
|
$envValues[$name] = $settingValue
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Host "$name value already set to '$($envValues[$name])'" -ForegroundColor DarkGray
|
Write-Host "$name value already set to '$($envValues[$name])'" -ForegroundColor DarkGray
|
||||||
@@ -85,9 +60,63 @@ foreach ($name in $settingNames) {
|
|||||||
$out = foreach ($name in $settingNames) { "$name='$($envValues[$name])'" }
|
$out = foreach ($name in $settingNames) { "$name='$($envValues[$name])'" }
|
||||||
$out | Set-Content -Path $envPath -Encoding UTF8
|
$out | Set-Content -Path $envPath -Encoding UTF8
|
||||||
|
|
||||||
Write-Host "Settings preparation complete" -ForegroundColor Gray
|
Write-Host "Settings preparation complete"
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host "Environment preparation complete!" -ForegroundColor Cyan
|
function Initialize-NodeTools {
|
||||||
|
Write-Host "Installing Node.js dependencies for the ELX Tools..."
|
||||||
|
|
||||||
|
$extractElxToolsScriptPath = Join-Path $PSScriptRoot "../tools/extract-elx/"
|
||||||
|
|
||||||
|
Push-Location -StackName ElxTools $extractElxToolsScriptPath
|
||||||
|
|
||||||
|
# Install Node.js dependencies for the ELX Tools
|
||||||
|
& npm install
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Error "npm install failed with exit code $LASTEXITCODE."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Pop-Location -StackName ElxTools
|
||||||
|
|
||||||
|
Write-Host "Node.js dependencies installed successfully!"
|
||||||
|
}
|
||||||
|
|
||||||
|
# If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
|
||||||
|
# #"No Administrative rights, it will display a popup window asking user for Admin rights"
|
||||||
|
# $arguments = "-NoProfile -ExecutionPolicy Bypass -Command & '" + $myinvocation.mycommand.definition + "'"
|
||||||
|
# Start-Process "$psHome\powershell.exe" -Verb runAs -ArgumentList $arguments #-WindowStyle Hidden
|
||||||
|
# break
|
||||||
|
# }
|
||||||
|
|
||||||
|
# # Set execution policy remotesigned machine wide
|
||||||
|
# try {
|
||||||
|
# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -InformationAction SilentlyContinue
|
||||||
|
# }
|
||||||
|
# catch {
|
||||||
|
# # Suppress
|
||||||
|
# }
|
||||||
|
|
||||||
|
# # Load Environment Setup Module
|
||||||
|
# $envSetupModulePath = $(Join-Path $PSScriptRoot "EnvironmentSetup.psm1")
|
||||||
|
# if (-not (Test-Path $envSetupModulePath)) {
|
||||||
|
# Write-Warning "Environment Setup Module file '$($envSetupModulePath)' not found!"
|
||||||
|
# Write-Host
|
||||||
|
# exit 1
|
||||||
|
# }
|
||||||
|
# Import-Module -Force $envSetupModulePath
|
||||||
|
|
||||||
|
Write-Host "Preparing environment..." -ForegroundColor Cyan
|
||||||
|
Write-Host
|
||||||
|
|
||||||
|
Initialize-EnvironmentSettings
|
||||||
|
|
||||||
|
Write-Host
|
||||||
|
|
||||||
|
Initialize-NodeTools
|
||||||
|
|
||||||
|
Write-Host
|
||||||
|
Write-Host "Environment preparation complete!" -ForegroundColor Green
|
||||||
|
|
||||||
# do {
|
# do {
|
||||||
# Write-Host "To complete the intallations you need to restart your computer" -ForegroundColor Cyan
|
# Write-Host "To complete the intallations you need to restart your computer" -ForegroundColor Cyan
|
||||||
|
|||||||
Reference in New Issue
Block a user