We have a local NuGet feed that includes some JS content-only packages.
I want to install those packages in a plain JS app (that I edit in Brackets and where I don't use VS at all). Obviously something like Bower would be more appropriate, but I don't want to maintain two package feed systems.
If I do nuget install MyPackage, it downloads and unpacks the packages, but does not copy content files to subfolders (in fact it downloads the packages in the current folder).
Can I use nuget.exe to actually copy the content, or does it have to be an external step?
OK, here is some initial work I did for command-line update (which would work for install just as well, if you modify packages.config manually).
It has the following limitations:
Code:
Set-StrictMode -Version 2
$ErrorActionPreference = 'Stop'
$packagesDirectory = (Get-Item nuget_packages)
$packagesDirectory.GetDirectories() | % {
Write-Host "Deleting $_"
Remove-Item $_.FullName -Recurse
}
Write-Host "Starting nuget.exe"
Start-Process nuget -ArgumentList "install packages.config" -WorkingDirectory nuget_packages -NoNewWindow -Wait
$packagesDirectory.GetDirectories() | % {
$contentPath = Join-Path (Join-Path $packagesDirectory.Name $_) 'content'
if (!(Test-Path $contentPath)) {
return;
}
Get-ChildItem $contentPath -Exclude *.transform | % {
$target = $_.Name
if (Test-Path $target) {
Write-Host "Deleting $target"
Remove-Item $target -Recurse
}
Write-Host "Copying $(Join-Path $contentPath $_.Name) to $target"
Copy-Item $_.FullName -Destination $target -Recurse
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With