], }

Package Versions

Pak uses version strings in the pak.json file in several places. Versions follow the Semver 2 standard. i.e. major.minor.patch[-pre-release] which prescribes the precise meaning of each component of the version string. For example:

$ pak search bootstrap
{
    "name": "kickstart",
    "version": "0.8.1",
    "dependencies": {
        "esp-angular": "^5.3",
        "esp-mgr-skeleton": "^5.3"
    }
}
FieldUsageDescription
versionVersion StringPackage version number.
dependenciesVersion ExpressionObject collection of dependent packages and a version expression criteria.
optionalDependenciesVersion ExpressionObject collection of optionally dependent packages and a version expression criteria.

Version expressions are also used in Pak override files. See Customizing Packages for more details.

{
    "jquery/jquery": {
        ">=2.1.0": {
            /* more */
        },
        ">=1.11.0": {
            /* more */
        }
    }
}

Version Expressions

Version expressions are used by dependency, optionalDependency properties in the pak.json file and in package override files. The following terms are permitted in version expressions.

Topic Description
1.2.3Simple version. Allows prereleases.
1.2.X Any patch for 1.2. Allows prereleases.
^1.2.3Compatible with 1.2. Same as >=1.2.3 <2.0.0 — does not allow prereleases.
~1.2.3Compatible with 1.2. Same as >=1.2.3 <2.0.0 — allows prereleases.
>, >=, <, <=, ==, != Version comparison.
expression || expression Either expression matches.
expression && expression Both expressions must qualify.
expression expression Same as &&

For example:

{
    "dependencies" : {
        "simple" : "2.0.1",

        /* Range of acceptable versions */
        "foo"    : ">=1.0.0 <2.10.20",

        /* Compatible with 1.2 - same minor number, allows pre-releases */
        "compat" : "~1.2",

        /* Compatible with 1.2 - but no pre-releases */
        "full"   : "^2.x",

        "complex": "1.2.3 || 1.2.8 || 1.3.*",
    }
}

© Embedthis Software. All rights reserved.