-
Notifications
You must be signed in to change notification settings - Fork 22
chore: Add script to build and install uno.check for testing #379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4a6597d
chore: Add script to build and install uno.check for testing
Takoooooo bf4142c
chore: Add examples of usage
Takoooooo 1b834d6
chore: Add Contributing section
Takoooooo 0935460
chore: Cleanup
Takoooooo 93e663f
Merge branch 'main' into add-script-for-local-testing
jeromelaban File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -351,4 +351,5 @@ MigrationBackup/ | |
|
|
||
| .DS_Store | ||
|
|
||
| LocalFeed/ | ||
| /.idea/.idea.UnoCheck/.idea | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| <# | ||
| .SYNOPSIS | ||
| Pack a .NET solution (or current folder), generate a LocalOnly.NuGet.Config | ||
| inside the feed directory (so it won't affect the solution), and install | ||
| (or reinstall) the Uno.Check global tool from that feed. | ||
|
|
||
| .PARAMETER Solution | ||
| Optional path to a .sln file or project folder. | ||
| If omitted or empty, `dotnet pack` will run on the current directory. | ||
|
|
||
| .PARAMETER LocalFeed | ||
| Optional directory to emit nupkg files into. | ||
| If omitted or empty, defaults to `LocalFeed` in the script folder. | ||
|
|
||
| .EXAMPLE | ||
| Packs the solution from the current directory and places all nupkg files in ./LocalFeed | ||
| Removes any installed Uno.Check versions and installs locally-built version instead. | ||
| ./pack-and-install.ps1 | ||
|
|
||
| .EXAMPLE | ||
| # Packs path/to/MySolution.sln into ./MyFeed folder. | ||
| Removes any installed Uno.Check versions and installs locally-built version instead. | ||
| ./pack-and-install.ps1 path/to/MySolution.sln MyFeed | ||
| #> | ||
|
|
||
| [CmdletBinding()] | ||
| param( | ||
| [Parameter(Position = 0)] | ||
| [string]$Solution = "", | ||
|
|
||
| [Parameter(Position = 1)] | ||
| [string]$LocalFeed = "" | ||
| ) | ||
|
|
||
| # Fail on any error | ||
| $ErrorActionPreference = 'Stop' | ||
|
|
||
| $PackageId = 'Uno.Check' | ||
|
|
||
| # Determine script directory and set defaults | ||
| $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path | ||
| Push-Location $scriptDir | ||
|
|
||
| if (-not $Solution) { | ||
| Write-Host "No solution specified → packing current directory" | ||
| $packTarget = "." | ||
| } else { | ||
| $packTarget = $Solution | ||
| } | ||
|
|
||
| if (-not $LocalFeed) { | ||
| $LocalFeed = "LocalFeed" | ||
| Write-Host "No feed directory specified → using default '$LocalFeed'" | ||
| } | ||
|
|
||
| # Ensure feed directory exists | ||
| if (-not (Test-Path $LocalFeed)) { | ||
| Write-Host "Creating feed directory: $LocalFeed" | ||
| New-Item -ItemType Directory -Path $LocalFeed | Out-Null | ||
| } | ||
|
|
||
| Write-Host "Packing '$packTarget' to '$LocalFeed'..." | ||
| dotnet pack $packTarget -c Release -o $LocalFeed | ||
|
|
||
| # Place NuGet.Config inside the feed directory | ||
| $configFile = Join-Path $LocalFeed 'LocalOnly.NuGet.Config' | ||
| $feedUri = (Resolve-Path -Path $LocalFeed).ProviderPath.TrimEnd('\','/') | ||
|
|
||
| Write-Host "Generating NuGet.Config at '$configFile'..." | ||
| @" | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <configuration> | ||
| <packageSources> | ||
| <!-- only your local folder --> | ||
| <add key="LocalFeed" value="$feedUri" /> | ||
| </packageSources> | ||
| </configuration> | ||
| "@ | Out-File -FilePath $configFile -Encoding utf8 | ||
|
|
||
| # If Uno.Check is already installed, uninstall it first | ||
| $installed = dotnet tool list --global | Select-String -Pattern "^\s*$PackageId\s" | ||
| if ($installed) { | ||
| Write-Host "Detected existing installation of '$PackageId'. Uninstalling..." | ||
| dotnet tool uninstall --global $PackageId | ||
| } | ||
|
|
||
| Write-Host "Installing tool '$PackageId' using only '$configFile'..." | ||
| dotnet tool install --global $PackageId ` | ||
| --configfile $configFile ` | ||
| --ignore-failed-sources | ||
|
|
||
| Write-Host "`nDone. '$PackageId' is installed from your local feed." | ||
| Pop-Location | ||
|
|
||
| # Prevent the script window from closing immediately | ||
| Write-Host "`nPress Enter to exit..." | ||
| Read-Host | Out-Null | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.