MCPcopy Index your code
hub / github.com/jetify-com/devbox / Outdated

Method Outdated

internal/devbox/packages.go:52–81  ·  view source on GitHub ↗

Outdated returns a map of package names to their available latest version.

(ctx context.Context)

Source from the content-addressed store, hash-verified

50
51// Outdated returns a map of package names to their available latest version.
52func (d *Devbox) Outdated(ctx context.Context) (map[string]UpdateVersion, error) {
53 lockfile := d.Lockfile()
54 outdatedPackages := map[string]UpdateVersion{}
55 var warnings []string
56
57 for _, pkg := range d.AllPackages() {
58 // For non-devbox packages, like flakes, we can skip for now
59 if !pkg.IsDevboxPackage {
60 continue
61 }
62
63 lockPackage, err := lockfile.FetchResolvedPackage(pkg.Versioned(), false)
64 if err != nil {
65 warnings = append(warnings, fmt.Sprintf("Note: unable to check updates for %s", pkg.CanonicalName()))
66 continue
67 }
68 existingLockPackage := lockfile.Packages[pkg.Raw]
69 if lockPackage.Version == existingLockPackage.Version {
70 continue
71 }
72
73 outdatedPackages[pkg.Versioned()] = UpdateVersion{Current: existingLockPackage.Version, Latest: lockPackage.Version}
74 }
75
76 for _, warning := range warnings {
77 fmt.Fprintf(d.stderr, "%s\n", warning)
78 }
79
80 return outdatedPackages, nil
81}
82
83// Add adds the `pkgs` to the config (i.e. devbox.json) and nix profile for this
84// devbox project

Callers 1

printOutdatedPackagesFunction · 0.80

Calls 5

LockfileMethod · 0.95
AllPackagesMethod · 0.95
FetchResolvedPackageMethod · 0.80
VersionedMethod · 0.80
CanonicalNameMethod · 0.65

Tested by

no test coverage detected