
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@devprice/version-from-git
Advanced tools
Bump package.json version to pre-release tagged with Git branch and short commit hash, 1.0.0-master.1a2b3c4
Note Forked to update dependencies with vulnerabilities and fix an issue in the original package, which seems unmaintained.
We want to use npm version to bump to a customized version that contains both Git branch and commit hash.
And use Travis CI to automatically publish the pre-release version to NPM, tagged using npm dist-tag.
Instead of using plus (+) to denote build information, we prefer period (.) for simpler escapes. If you prefer the plus sign, you can customize the pre-release version pattern.
Run npx version-from-git, it will run npm version 1.0.0-master.1a2b3c4.
Usage: version-from-git [options]
Bump package.json version to pre-release tagged with Git branch and short commit hash, 1.0.0-master.1a2b3c4
Options:
-V, --version output the version number
-p, --path <path> path to package.json, default to current directory (default: C:\Users\Compulim\Source\Repos\version-from-git)
--template <template> pre-release version template (default: branch.short)
-t, --travis run in Travis CI: skip when TRAVIS_TAG present
-f, --force run "npm version" with --force
-m, --message <message> run "npm version" with --message
--allow-same-version run "npm version" with --allow-same-version
--sign-git-tag run "npm version" with --sign-git-tag
--no-commit-hooks run "npm version" with --commit-hooks
--no-git-tag-version run "npm version" with --no-git-tag-version
-h, --help output usage information
In Travis, when you push a tag (probably by npm version 1.0.0 followed by git push origin v1.0.0), you may want to skip version-from-git from generating a pre-release tag.
Run npx version-from-git -t, it will detect whether TRAVIS_TAG environment variable is present and skip.
You can customize the version pattern when tagging for pre-release versions by running with argument --template branch.short.
| Pattern name | Description | Sample |
|---|---|---|
branch | Branch name In Travis, will use process.env.TRAVIS_BRANCH | master |
long | Git commit in long form | 3807f9004867438c57a3e26f2073c33c458d4ef9 |
short | Git commit in short form | 3807f90 |
Default pattern is branch.short, which would produce master.1a2b3c4.
Like us? Star us.
Want to make it better? File us an issue.
Don't like something you see? Submit a pull request.
FAQs
Bump package.json version to pre-release tagged with Git branch and short commit hash, 1.0.0-master.1a2b3c4
We found that @devprice/version-from-git demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.