add more scripts to automatically update:

- last updated elx file
- all elx files
This commit is contained in:
2026-05-26 13:36:48 +02:00
parent 60fc9e8d07
commit 0fe463338a
6 changed files with 97 additions and 64 deletions
+10
View File
@@ -0,0 +1,10 @@
@echo off
SETLOCAL EnableDelayedExpansion
echo %cmdcmdline% | findstr /i /c:"%~nx0" >NUL && set iscommandline=1
echo %PSModulePath% | findstr /i /c:"%USERPROFILE%" >NUL && set ispowershell=1
cd /D "%~dp0"
@powershell -NoProfile -ExecutionPolicy Bypass -Command .\scripts\extract-elx-internals-all.ps1
IF DEFINED iscommandline IF NOT DEFINED ispowershell pause
ENDLOCAL
+10
View File
@@ -0,0 +1,10 @@
@echo off
SETLOCAL EnableDelayedExpansion
echo %cmdcmdline% | findstr /i /c:"%~nx0" >NUL && set iscommandline=1
echo %PSModulePath% | findstr /i /c:"%USERPROFILE%" >NUL && set ispowershell=1
cd /D "%~dp0"
@powershell -NoProfile -ExecutionPolicy Bypass -Command .\scripts\extract-elx-internals-last-updated.ps1
IF DEFINED iscommandline IF NOT DEFINED ispowershell pause
ENDLOCAL
+19
View File
@@ -0,0 +1,19 @@
Write-Host "Getting last updated module file..."
$modulesSrcPath = Join-Path $PSScriptRoot "../src/"
$moduleFiles = Get-ChildItem -Path $modulesSrcPath -Recurse -Depth 2 -Filter "*.elx" -ErrorAction Stop
if (-not $moduleFiles) {
Write-Error "No .elx files found in '$modulesSrcPath'."
exit 1
}
Write-Host "Found module files:" -ForegroundColor Cyan
$moduleFiles | ForEach-Object { Write-Host " - $($_.FullName)" -ForegroundColor Cyan }
Write-Host "Extracting ELX internals for each module..."
Import-Module $(Join-Path (Split-Path -Parent $MyInvocation.MyCommand.Definition) "extract-elx-module.psm1") -Force
$moduleFiles | ForEach-Object {
Save-ElxInternals -ModulePath $_.FullName
}
Write-Host "ELX internals extracted successfully!" -ForegroundColor Green
@@ -0,0 +1,16 @@
Write-Host "Getting last updated module file..."
$modulesSrcPath = Join-Path $PSScriptRoot "../src/"
$moduleFile = Get-ChildItem -Path $modulesSrcPath -Recurse -Filter "*.elx" -ErrorAction Stop | Sort-Object LastWriteTime -Descending | Select-Object -First 1
if (-not $moduleFile) {
Write-Error "No .elx file found in '$modulesSrcPath'."
exit 1
}
Write-Host "Latest updated module file found: '$($moduleFile.FullName)'" -ForegroundColor Cyan
Write-Host "Extracting ELX internals for module tag '$($moduleFile.FullName)'..."
Import-Module $(Join-Path (Split-Path -Parent $MyInvocation.MyCommand.Definition) "extract-elx-module.psm1") -Force
Save-ElxInternals -ModulePath $moduleFile.FullName
Write-Host "ELX internals extracted successfully!" -ForegroundColor Green
+7 -64
View File
@@ -1,77 +1,20 @@
# 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
Write-Host "Checking module file existence..."
$modulesSrcPath = Join-Path $PSScriptRoot "../src/$($ModuleTag)"
$moduleFile = Get-childitem -Path $modulesSrcPath -Filter "*.elx" -ErrorAction Stop | Select-Object -First 1
$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.FullName)'" -ForegroundColor Cyan
Write-Host "Extracting ELX internals for module tag '$($moduleFile.FullName)'..."
Write-Host "Module file found: $moduleFile" -ForegroundColor Gray
Write-Host "Installing Node.js dependencies for the ELX Tools..." -ForegroundColor DarkGray
Import-Module $(Join-Path (Split-Path -Parent $MyInvocation.MyCommand.Definition) "extract-elx-module.psm1") -Force
# 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
}
Save-ElxInternals -ModulePath $moduleFile.FullName
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')
Write-Host "ELX internals extracted successfully!" -ForegroundColor Green
+35
View File
@@ -0,0 +1,35 @@
function Save-ElxInternals {
param(
[ValidateScript({ Test-Path $_ -PathType Leaf })][Parameter(Mandatory)]$ModulePath
)
Write-Host "Switching to ELX Tools directory..."
$extractElxToolsScriptPath = Join-Path $PSScriptRoot "../tools/extract-elx/"
Push-Location -StackName ElxTools $extractElxToolsScriptPath
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
}
Write-Host "Node.js dependencies installed successfully!" -ForegroundColor Cyan
Write-Host "Executing ELX extraction..."
& node "extract-elx.js" $ModulePath --clean
if ($LASTEXITCODE -ne 0) {
Write-Error "ELX extraction failed with exit code $LASTEXITCODE."
exit 1
}
Write-Host "ELX extraction completed successfully!" -ForegroundColor Green
Write-Host "Switching back to original directory..."
Pop-Location -StackName ElxTools
}
Export-ModuleMember -Function Save-ElxInternals