add batch script to call extract-elx tool
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
@echo off
|
||||||
|
echo %cmdcmdline% | findstr /i /c:"%~nx0" >NUL && set iscommandline=1
|
||||||
|
echo %PSModulePath% | findstr "%USERPROFILE%" >NUL && set ispowershell=1
|
||||||
|
cd /D "%~dp0"
|
||||||
|
|
||||||
|
echo.
|
||||||
|
|
||||||
|
@REM IF %* == "" echo "Module tag not specified."
|
||||||
|
@REM #set /p "ModuleTag=Insert module tag: "
|
||||||
|
@REM ) ELSE (
|
||||||
|
@REM #set "ModuleTag=%*"
|
||||||
|
@REM )
|
||||||
|
|
||||||
|
@powershell -NoProfile -ExecutionPolicy Bypass -Command .\scripts\extract-elx-internals.ps1 -ModuleTag %*
|
||||||
|
|
||||||
|
echo.
|
||||||
|
|
||||||
|
IF DEFINED iscommandline IF NOT DEFINED ispowershell pause
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory=$false)][string]$ModuleTag
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-Host "Extracting ELX internals for module tag $ModuleTag..." -ForegroundColor Cyan
|
||||||
|
Write-Host "Switching to ELX Tools directory..." -ForegroundColor DarkGray
|
||||||
|
|
||||||
|
$extractElxToolsScriptPath = Join-Path $PSScriptRoot "../tools/extract-elx/"
|
||||||
|
Push-Location -StackName ElxTools $extractElxToolsScriptPath
|
||||||
|
|
||||||
|
Write-Host "Identifying module file..." -ForegroundColor DarkGray
|
||||||
|
|
||||||
|
$modulesSrcPath = Join-Path $PSScriptRoot "../src/$($ModuleTag)"
|
||||||
|
$moduleFile = Get-childitem -Path $modulesSrcPath -Filter "*.elx" -ErrorAction Stop | Select-Object -First 1
|
||||||
|
if (-not $moduleFile) {
|
||||||
|
Write-Error "No .elx file found in '$modulesSrcPath'."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Module file found: $moduleFile" -ForegroundColor Gray
|
||||||
|
Write-Host "Installing Node.js dependencies for the ELX Tools..." -ForegroundColor DarkGray
|
||||||
|
|
||||||
|
# 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
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Node.js dependencies installed successfully!" -ForegroundColor DarkGray
|
||||||
|
Write-Host "Executing ELX extraction..." -ForegroundColor DarkGray
|
||||||
|
|
||||||
|
& node "extract-elx.js" $moduleFile.FullName --clean
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Error "ELX extraction failed with exit code $LASTEXITCODE."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "ELX extraction completed successfully!" -ForegroundColor DarkGray
|
||||||
|
|
||||||
|
Pop-Location -StackName ElxTools
|
||||||
|
|
||||||
|
Write-Host "ELX internals extracted successfully!" -ForegroundColor Cyan
|
||||||
|
|
||||||
|
# do {
|
||||||
|
# Write-Host "To complete the intallations you need to restart your computer" -ForegroundColor Cyan
|
||||||
|
# Write-Host "do you want to restart? [Y/n]" -ForegroundColor Cyan
|
||||||
|
# $key = ([console]::ReadKey()).Key.ToString().ToUpper()
|
||||||
|
# if ($key -eq 'Y') {
|
||||||
|
# Restart-Computer
|
||||||
|
# }
|
||||||
|
# } while ($key -ne 'N' -and $key -ne 'Y')
|
||||||
Reference in New Issue
Block a user