Search code examples
chocolatey

What is the purpose of the .json file with version numbers that is included in chocolatey packages?


Background

I recently started taking the dive into making my own chocolatey packages. I've looked through the documentation as well as have looked at the code for the community packages.

In the community packages, there is a .json file included (example) which contains some version information. I've seen some that list stable/pre info:

{
    "stable":  "23.1",
    "pre":  "21.4-beta"
}

... and others that list truncated version numbers:

{
  "7.3": "7.3.0-preview07",
  "7.2": "7.2.6",
  "7.1": "7.1.5",
  "7.0": "7.0.12"
}

When one types choco new <pkgname> to create a new package, such a .json file is not included in that default template. According to the docs, all that is needed for a package is a .nuspec and a chocolateyInstall.ps1 (chocolateyUninstall.ps1 being recommended and chocolateyBeforeModify.ps1, README, etc. being optional).

Question

What is the precise purpose of this file/how is it used?


Solution

  • Almost all of the packages that are maintained in the Chocolatey Community Chocolatey Packages Repository on GitHub use a system originally called AU, to keep the packages up to date. One of the things that AU is able to able is the concept of multiple updated version ranges. What I mean by that is a software product is pushing out new releases to multiple major versions. In AU this is known as Streams and the json file that you are referring to is where the latest version of each "stream" is persisted for the next time a check is made.

    Unless you are actively using AU, and wanting to use Streams, you don't need to worry about this file.