Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

git-revision-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-revision-webpack-plugin

Simple webpack plugin that generates VERSION and COMMITHASH files during build

  • 2.1.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is git-revision-webpack-plugin?

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.

What are git-revision-webpack-plugin's main functionalities?

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())
    })
  ]
};

Other packages similar to git-revision-webpack-plugin

Keywords

FAQs

Package last updated on 13 May 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc