1.0.5 • Published 2 years ago

package-revision v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Patches the package.json version field with the latest tag from the current git commit.

Why?

We got sick of having to add a commit to our JavaScript projects to update the version field in package.json before tagging for releases, so we came up with a solution to do it automatically.

How to use

You can use it however you want. Best used with npx in a build script.

Example (package.json)

{
  "scripts": {
    "build": "npx package-revision && make build"
  }
}

You can also add a hashVersion property to your package.json by supplying -h or --head arguments:

npx package-revision --head

This will add the current commit ID. Note that this may already be available when running your application via the npm_package_gitHead environment variable, so you may not need this.

Caveats

  • Lightweight tags may cause issues where multiple tags are based on the same commit. Usually the first tag is used in this case. Recommended to use annotated tags instead, which contain date information and will always return the latest tag information.
  • Modifies the package.json file which may end up being committed by people who tend to do git add .. This may or may not be desired in your project. Proceed with caution :)
1.0.5

2 years ago

1.0.4

2 years ago

1.0.2

2 years ago

1.0.3-2

2 years ago

1.0.3-1

2 years ago

1.0.3-3

2 years ago

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago