DEV Community

Joseph Snell
Joseph Snell

Posted on

pin-latest: Easily resolve package.json “latest” versions

GitHub logo wulfmann / pin-latest

Small utility for converting `package.json` versions from `latest` to the actual latest version.

pin-latest

Small utility for converting package.json versions from latest to the actual latest version.

Quickstart

Install

npm i -g pin-latest
# or
yarn global add pin-latest
# or
npx pin-latest

Given the following package.json:

{
    "name": "example-project"
    "dependencies": {
        "react": "latest"
    }
}

Running pin-latest will result in the following output:

$ pin-latest .
{
    "name": "example-project"
    "dependencies": {
        "react": "^16.13.1"
    }
}

To save changes pass the --write flag:

$ pin-latest .
package.json updated.

$ cat package.json
{
    "name": "example-project",
    "dependencies": {
        "react": "^16.13.1"
    }
}

Usage

$ pin-latest --help

Usage
    $ pin-latest <project-directory>
Options
    --exact, -t     Set the exact version
    --write, -w     Write changes
    --version,

The purpose of this project is providing an easy way to translate dependency versions specified in a package.json.

Any dependency that specifies a version of latest will be updated to the actual latest version of the package.

Quickstart

Install

npm i -g pin-latest
# or
yarn global add pin-latest
# or
npx pin-latest

Given the following package.json:

{
    "name": "example-project",
    "dependencies": {
        "react": "latest"
    }
}

Running pin-latest will result in the following output:

$ pin-latest .

{
    "name": "example-project",
    "dependencies": {
        "react": "^16.13.1"
    }
}

To save changes pass the --write flag:

$ pin-latest .
package.json updated.

$ cat package.json
{
    "name": "example-project",
    "dependencies": {
        "react": "^16.13.1"
    }
}

View more information in the project’s readme.

Top comments (0)