index.js
function (packagePath, semverIndex)
	{
		// Check if package file exists
		if ( !fs.existsSync(packagePath) )
		{
			throw new Error(`Package file ${packagePath} is not found.`, 1);
		}

		// Read package file content
		const packageData = JSON.parse( fs.readFileSync( packagePath ) );

		// Increment version according to semver increment index
		packageData.version = module.exports.semverIncrement(packageData.version, semverIndex);

		// Write new package.json
		fs.writeFileSync(packagePath, JSON.stringify( packageData, null, 2));

		// Return incremented version
		return packageData.version;
	}
function (packagePath, semverIndex)
	{
		// Check if package file exists
		if ( !fs.existsSync(packagePath) )
		{
			throw new Error(`Package file ${packagePath} is not found.`, 1);
		}

		// Read package file content
		const packageData = JSON.parse( fs.readFileSync( packagePath ) );

		// Increment version according to semver increment index
		packageData.version = module.exports.semverIncrement(packageData.version, semverIndex);

		// Write new package.json
		fs.writeFileSync(packagePath, JSON.stringify( packageData, null, 2));

		// Return incremented version
		return packageData.version;
	}
function ( packagePath , semverIndex ) { // Check if package file exists if ( ! fs . existsSync ( packagePath ) ) { throw new Error ( ` ${ packagePath } ` , 1 ) ; } // Read package file content const packageData = JSON . parse ( fs . readFileSync ( packagePath ) ) ; // Increment version according to semver increment index packageData . version = module . exports . semverIncrement ( packageData . version , semverIndex ) ; // Write new package.json fs . writeFileSync ( packagePath , JSON . stringify ( packageData , null , 2 ) ) ; // Return incremented version return packageData . version ; }
Increment any package.json version.
Increment any package . json version .