
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
CLI tool and Node.js library for generating version hashes based on your Git repository's state and file modifications, helps with cache busting and versioning by producing unique identifiers (hashes) that can be embedded in filenames
gitverdiff is a CLI tool and Node.js library for generating version hashes based on your Git repository's state and file modifications. It helps with cache busting and versioning by producing unique identifiers (hashes) that can be embedded in filenames.
Version Hash Generation:
Combines data from multiple sources:
package.json.Flexible Configuration:
Configure via command-line arguments, a gitverdiff field in your package.json, or local configuration files (.gitverdiff and .gitverdiffignore).
Monorepo Support:
If you run the command from a subdirectory in a monorepo, gitverdiff will first check for configuration in that subdirectory’s package root. If none is found, it falls back to the Git root.
Customizable Output:
Define the output format and token separator to fit your build or deployment process.
Install globally using npm, pnpm, or yarn:
npm install -g gitverdiff
# or
pnpm add -g gitverdiff
# or
yarn global add gitverdiff
Run the command in your project directory:
gitverdiff [include patterns...] [--ignore <pattern>] [--format <token,token,...>] [--separator <separator>] [--help]
include patterns:
Glob patterns to include files.
--ignore :
Glob pattern to exclude files.
--format :
Comma-separated list of tokens for building the version hash.
Available tokens:
package-version: The version from package.jsonbranch: The current Git branch nameshort-commit-sha: The first 7 characters of the commit hashcommit-sha: The full commit hashdiff-hash: The SHA256 hash of the diff (modified files)Default: package-version,branch,short-commit-sha,diff-hash
--separator :
Separator string used to join tokens (defaults to - or the value from package.json).
--help:
Show this help message.
Default configuration (relies on package.json and/or local config files):
gitverdiff
Overriding format and separator:
gitverdiff --format branch,short-commit-sha --separator "."
You can also use gitverdiff programmatically:
const { generateVersionHash } = require('gitverdiff')
const versionHash = generateVersionHash({
format: 'package-version,branch,short-commit-sha,diff-hash',
packageRoot: __dirname, // Optional: starting directory (defaults to process.cwd())
separator: '|'
})
console.log('Version hash:', versionHash)
gitverdiff supports configuration via multiple methods:
Command-Line Arguments
Pass options like --format, --ignore, and --separator directly.
package.json
Add a gitverdiff field in your package.json:
{
"gitverdiff": {
"format": "package-version,branch,short-commit-sha,diff-hash",
"ignore": ["src/config.json", "src/build/*"],
"include": ["src/**/*"],
"separator": "|"
}
}
Local Configuration Files
In a monorepo, if a package has its own configuration in the package root, that configuration is used first. Otherwise, gitverdiff falls back to the configuration in the Git root.
This project is licensed under the Apache License 2.0.
Contributions are welcome! Please open an issue or submit a pull request with your ideas or improvements.
Ivan Karpan
Claude GPT
FAQs
CLI tool and Node.js library for generating version hashes based on your Git repository's state and file modifications, helps with cache busting and versioning by producing unique identifiers (hashes) that can be embedded in filenames
We found that gitverdiff 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.