-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuild-Functions.psm1
30 lines (24 loc) · 1.21 KB
/
Build-Functions.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function Get-Versions {
Install-Module -Name powershell-yaml -AllowClobber -AcceptLicense
$versionFiles = Get-Item -Path src/**/version.yaml | Select-Object -ExpandProperty FullName
Write-Debug "Found the following version files:"
$versionFiles | ForEach-Object { $_ | Write-Debug }
$packageVersions = @{}
$versionFiles | ForEach-Object {
Write-Debug "Reading version file $_"
$packageName = Split-Path $_ -Parent | Split-Path -Leaf
$yamlVersion = (Get-Content $_ | ConvertFrom-Yaml).version
$semver = '{0}.{1}.{2}' -f $yamlVersion.major, $yamlVersion.minor, $yamlVersion.patch
$assemblyVersion = $semver + ".0"
$packageVersions[$packageName] = @{ 'SemVer' = $semver; 'AssemblyVersion' = $assemblyVersion; 'Root' = $(Split-Path $_ -Parent)}
}
$packageVersions | ConvertTo-Json | Write-Output
}
function Get-LockFiles {
$lockFiles = Get-Item -Path src/**/packages.lock.json | Select-Object -ExpandProperty FullName
Write-Debug "Found the following lock files:"
$lockFiles | ForEach-Object { Write-Debug "\t- $_" }
$lockFiles | Write-Output
}
Export-ModuleMember -Function Get-Versions
Export-ModuleMember -Function Get-LockFiles