-
Notifications
You must be signed in to change notification settings - Fork 913
fix(minimax-docx): restore the CLI project directly #24
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -13,7 +13,9 @@ $ErrorActionPreference = "Stop" | |||||||||||||||||||||||||||||||||
| $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path | ||||||||||||||||||||||||||||||||||
| $ProjectDir = Split-Path -Parent $ScriptDir | ||||||||||||||||||||||||||||||||||
| $DotnetDir = Join-Path $ScriptDir "dotnet" | ||||||||||||||||||||||||||||||||||
| $CliProject = Join-Path (Join-Path $DotnetDir "MiniMaxAIDocx.Cli") "MiniMaxAIDocx.Cli.csproj" | ||||||||||||||||||||||||||||||||||
| $LogFile = Join-Path $ProjectDir ".setup.log" | ||||||||||||||||||||||||||||||||||
| $DefaultNugetSource = "https://api.nuget.org/v3/index.json" | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| # --- Output Helpers --- | ||||||||||||||||||||||||||||||||||
| function Log { Write-Host "[OK] $args" -ForegroundColor Green } | ||||||||||||||||||||||||||||||||||
|
|
@@ -22,6 +24,66 @@ function Fail { Write-Host "[FAIL] $args" -ForegroundColor Red } | |||||||||||||||||||||||||||||||||
| function Info { Write-Host "[INFO] $args" -ForegroundColor Cyan } | ||||||||||||||||||||||||||||||||||
| function Step { Write-Host "`n=== $args ===" -ForegroundColor Blue } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| function Add-DefaultRestoreSources { | ||||||||||||||||||||||||||||||||||
| param( | ||||||||||||||||||||||||||||||||||
| [string[]]$Sources = @() | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| $result = @($Sources) | ||||||||||||||||||||||||||||||||||
| $result += $DefaultNugetSource | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| $localFeeds = @( | ||||||||||||||||||||||||||||||||||
| (Join-Path $DotnetDir "packages"), | ||||||||||||||||||||||||||||||||||
| (Join-Path $ProjectDir "assets/nuget") | ||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||
| foreach ($feed in $localFeeds) { | ||||||||||||||||||||||||||||||||||
| if (Test-Path $feed) { | ||||||||||||||||||||||||||||||||||
| $result += $feed | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| return $result | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| function Get-RestoreSources { | ||||||||||||||||||||||||||||||||||
| $sources = @() | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if ($env:MINIMAX_DOCX_NUGET_SOURCES) { | ||||||||||||||||||||||||||||||||||
| foreach ($source in ($env:MINIMAX_DOCX_NUGET_SOURCES -split ';')) { | ||||||||||||||||||||||||||||||||||
| $trimmed = $source.Trim() | ||||||||||||||||||||||||||||||||||
| if ($trimmed) { | ||||||||||||||||||||||||||||||||||
| $sources += $trimmed | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
| } | |
| } | |
| if ($sources.Count -eq 0) { | |
| Warn "MINIMAX_DOCX_NUGET_SOURCES contained no valid entries; falling back to default NuGet sources." | |
| $sources += $DefaultNugetSource | |
| $localFeeds = @( | |
| (Join-Path $DotnetDir "packages"), | |
| (Join-Path $ProjectDir "assets/nuget") | |
| ) | |
| foreach ($feed in $localFeeds) { | |
| if (Test-Path $feed) { | |
| $sources += $feed | |
| } | |
| } | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same edge case as in setup.sh: if
MINIMAX_DOCX_NUGET_SOURCESis set but all entries trim to empty,RESTORE_SOURCE_ARGSends up empty and the check will silently fall back to default NuGet.Config sources while still treating it as a “custom source(s)” case. Consider validating that at least one source remains after trimming and otherwise failing or falling back to the default + detected local feeds.