Files
elixforms-moduli/scripts/export-elx.ps1
T

30 lines
1.2 KiB
PowerShell

[CmdletBinding()]
param(
[Parameter(Mandatory)][ValidateNotNullOrEmpty()][string]$ModuleId
)
$psVersion = $PSVersionTable.PSVersion
if ($psVersion.Major -lt 7 -or ($psVersion.Major -eq 7 -and $psVersion.Minor -lt 4)) {
Write-Host "This script requires PowerShell 7.4 or higher. Please install PowerShell >= 7.4 and try again." -ForegroundColor Red
exit 1
}
Write-Host "Checking module folder existence..."
$modulesSrcPath = Join-Path $PSScriptRoot "../src"
if (-not (Test-Path -Path $modulesSrcPath)) {
Write-Host "Module folder not found. Creating folder for module '$ModuleId'..." -ForegroundColor Yellow
New-Item -ItemType Directory -Path $modulesSrcPath -Force | Out-Null
}
$modulesSrcPath = Join-Path -Resolve $PSScriptRoot "../src"
Write-Host "Module '$ModuleId' will be exported to '$modulesSrcPath' in its own folder"
Import-Module $(Join-Path (Split-Path -Parent $MyInvocation.MyCommand.Definition) "elx-tools-module.psm1") -Force
Write-Host "Exporting module '$ModuleId' from elixForms..."
$ModuleTag = (Export-ElxModuleManual -ModuleId $ModuleId -ModulePath $modulesSrcPath)
Write-Host "Module '$ModuleId' exported successfully!" -ForegroundColor Green
Return $ModuleTag