Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
git-revision-webpack-plugin
Advanced tools
Simple webpack plugin that generates VERSION and COMMITHASH files during build
The git-revision-webpack-plugin is a Webpack plugin that allows you to embed Git revision information into your build. This can be useful for versioning, debugging, and tracking the state of your codebase at the time of the build.
Embed Git Revision Information
This feature allows you to embed the current Git revision information into your Webpack build. The code sample shows how to include the GitRevisionPlugin in your Webpack configuration.
const GitRevisionPlugin = require('git-revision-webpack-plugin');
const gitRevisionPlugin = new GitRevisionPlugin();
module.exports = {
plugins: [
gitRevisionPlugin
]
};
Access Git Information in Code
This feature allows you to access Git information such as the version, commit hash, and branch name directly in your code. The code sample demonstrates how to log this information to the console.
const GitRevisionPlugin = require('git-revision-webpack-plugin');
const gitRevisionPlugin = new GitRevisionPlugin();
console.log('Version:', gitRevisionPlugin.version());
console.log('Commit Hash:', gitRevisionPlugin.commithash());
console.log('Branch:', gitRevisionPlugin.branch());
Define Global Constants
This feature allows you to define global constants in your Webpack configuration that hold Git information. The code sample shows how to use the DefinePlugin to create global constants for the version, commit hash, and branch name.
const GitRevisionPlugin = require('git-revision-webpack-plugin');
const gitRevisionPlugin = new GitRevisionPlugin();
module.exports = {
plugins: [
new webpack.DefinePlugin({
'VERSION': JSON.stringify(gitRevisionPlugin.version()),
'COMMITHASH': JSON.stringify(gitRevisionPlugin.commithash()),
'BRANCH': JSON.stringify(gitRevisionPlugin.branch())
})
]
};
The webpack-build-info-plugin is a Webpack plugin that provides build information including Git commit hash, branch name, and build timestamp. It is similar to git-revision-webpack-plugin but also includes additional build metadata.
The webpack-git-revision plugin is another alternative that focuses on embedding Git revision information into your Webpack build. It provides similar features to git-revision-webpack-plugin but with a different API.
FAQs
[![npm version](https://badge.fury.io/js/git-revision-webpack-plugin.svg)](https://badge.fury.io/js/git-revision-webpack-plugin) [![downloads](https://img.shields.io/npm/dm/git-revision-webpack-plugin.svg?style=flat-square)](https://www.npmjs.com/package/
We found that git-revision-webpack-plugin 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.