Socket
Socket
Sign inDemoInstall

json-bumper

Package Overview
Dependencies
2
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    json-bumper

bumps the "version" entry for a JSON file


Version published
Maintainers
1
Created

Readme

Source

json-bump

bumps the "version" entry for a JSON file

rationale

An easy to use component to bump the semver version of a JSON file. Includes both an exported package and a CLI.

installation

npm i json-bump

programmatic example

const bump = require('json-bump')
bump('package.json', { major: 1 })

command-line example

$ json-bump package.json
Updated package.json version from 0.1.2 to 0.1.3

$ json-bump data.json --minor
Updated data.json version from 1.0.5 to 1.1.0

$ json-bump

Usage: json-bump FILENAME [FLAGS]
Bumps the version in a json file using semver (MAJOR.MINOR.PATCH)

--replace=semver   this replaces the entire semver with the given string

--major=1          increment the major version (increments by 1 if flagged but not specified)
--minor=1          increment the minor version (increments by 1 if flagged but not specified)
--patch=1          increment the patch version (increments by 1 if flagged but not specified)
--entry=name       change entry updated (defaults is "version")
--spaces=4          number of spaces to format the .json file (set to 0 to remove spaces)

If no FLAGS are specified, increments PATCH by 1

API

function version(filename, options)

bumps the "version" entry for a .json file

  • {string} filename
  • {object} [options] defaults to incrementing PATCH by 1 if no options are provided
  • {string="version"} [entry] name of entry to change
  • {number} [major] increment major by number (resetting MINOR and PATCH to 0)
  • {number} [minor] increment minor by number (resetting PATCH to 0)
  • {number} [patch] increment patch by number
  • {string} [replace] replace entry with this string
  • {number} [spaces=4] number of spaces to format the .json file (set to 0 to remove spaces)
  • returns: { updated: string, original: string }

license

MIT License
(c) 2017 YOPEY YOPEY LLC by David Figatner

Keywords

FAQs

Last updated on 14 Aug 2020

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc