Skip to content
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

[ls] return unresolved packages as a warning instead of an error #2511

Merged
merged 2 commits into from
Feb 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion internal/devbox/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type UpdateVersion struct {
func (d *Devbox) Outdated(ctx context.Context) (map[string]UpdateVersion, error) {
lockfile := d.Lockfile()
outdatedPackages := map[string]UpdateVersion{}
var warnings []string

for _, pkg := range d.AllPackages() {
// For non-devbox packages, like flakes, we can skip for now
Expand All @@ -61,7 +62,8 @@ func (d *Devbox) Outdated(ctx context.Context) (map[string]UpdateVersion, error)

lockPackage, err := lockfile.FetchResolvedPackage(pkg.Versioned())
if err != nil {
return nil, errors.Wrap(err, "failed to fetch resolved package")
warnings = append(warnings, fmt.Sprintf("Note: unable to check updates for %s", pkg.CanonicalName()))
continue
}
existingLockPackage := lockfile.Packages[pkg.Raw]
if lockPackage.Version == existingLockPackage.Version {
Expand All @@ -71,6 +73,10 @@ func (d *Devbox) Outdated(ctx context.Context) (map[string]UpdateVersion, error)
outdatedPackages[pkg.Versioned()] = UpdateVersion{Current: existingLockPackage.Version, Latest: lockPackage.Version}
}

for _, warning := range warnings {
fmt.Fprintf(d.stderr, "%s\n", warning)
}

return outdatedPackages, nil
}

Expand Down
Loading