@@ -120,15 +120,22 @@ function Update-BowerLibraries () {
120120 foreach ($libraryProperty in $libraries.psobject.properties ) {
121121 $library = $libraries .$ ($libraryProperty.Name )
122122 $libraryName = $library.endpoint.source
123- $libraryVersion = $library.pkgMeta.version
124- $latestVersion = $library.update.latest
125- if ($latestVersion.Contains (' -' )) {
126- # if latest is beta
127- $latestVersion = $library.update.target
123+ $libraryVersion = GetBowerPackageVersion($library.pkgMeta )
124+
125+ $noVersion = $false
126+ $latestVersion = $null
127+ if (Get-Member - InputObject $library - Name ' update' ) {
128+ $latestVersion = $library.update.latest
129+ if ($latestVersion.Contains (' -' )) {
130+ # if latest is beta
131+ $latestVersion = $library.update.target
132+ }
133+ } else {
134+ $noVersion = $true
128135 }
129136
130- if ($libraryVersion -ne $latestVersion ) {
131- Write-Host " Updating $libraryName from $libraryVersion to $ ( $library .update.latest ) "
137+ if (( $libraryVersion -ne $latestVersion ) -or $noVersion ) {
138+ Write-Host " Updating $libraryName from $libraryVersion to $latestVersion "
132139 Update-BowerLibrary $libraryName $latestVersion
133140 }
134141 }
@@ -145,9 +152,7 @@ function Update-BowerLibrary ($name, $version = $null) {
145152
146153 $folderName = (bower info $name name -- json) | ConvertFrom-Json
147154 $packageInfo = (Get-Content .\_bower_components\$folderName \.bower.json) -join " `n " | ConvertFrom-Json
148- if (@ (Get-Member - InputObject $packageInfo | ? { $_.Name -eq ' version' }).Count -gt 0 ) {
149- $newVersion = $packageInfo.version
150- }
155+ $newVersion = GetBowerPackageVersion($packageInfo )
151156
152157 $oldVersionFolder = Get-Item " $ ( $folderName ) _*"
153158 if ($oldVersionFolder.Name -eq " $ ( $folderName ) _$newVersion " ) {
@@ -219,6 +224,16 @@ function MakeMinifiedPath($path) {
219224 }
220225}
221226
227+ function GetBowerPackageVersion ($package ) {
228+ if (Get-Member - InputObject $library.pkgMeta - Name ' version' ) {
229+ return $library.pkgMeta.version
230+ } elseif (Get-Member - InputObject $library.pkgMeta - Name ' _release' ) {
231+ return $library.pkgMeta._release
232+ } else {
233+ return ' *'
234+ }
235+ }
236+
222237Export-ModuleMember New-JavaScriptLibrary
223238Export-ModuleMember New-BowerLibrary
224239Export-ModuleMember Update-JavaScriptLibrary
0 commit comments