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 - npm Package Compare versions

Comparing version 3.0.6 to 4.0.0

dist/build-file.d.ts

79

package.json
{
"name": "git-revision-webpack-plugin",
"version": "3.0.6",
"description": "Simple webpack plugin that generates VERSION and COMMITHASH files during build",
"main": "lib/index.js",
"scripts": {
"test": "npm run test:lint && npm run test:unit",
"test:lint": "standard",
"test:unit": "mocha recursive --reporter spec ./lib",
"test:unit-watch": "npm run test:unit -- --watch"
},
"engines": {
"node": ">=6.11.5"
},
"version": "4.0.0",
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"files": [
"lib"
"dist",
"src"
],

@@ -22,11 +14,25 @@ "repository": {

},
"keywords": [
"git",
"git-describe",
"plugin",
"version",
"webpack"
],
"engines": {
"node": ">=10"
},
"scripts": {
"start": "tsdx watch",
"build": "tsdx build",
"test": "tsdx test",
"lint": "tsdx lint",
"prepare": "tsdx build",
"size": "size-limit",
"analyze": "size-limit --why"
},
"peerDependencies": {
"webpack": "^5.0.0"
},
"prettier": {
"printWidth": 120,
"semi": false,
"singleQuote": true,
"trailingComma": "all"
},
"name": "git-revision-webpack-plugin",
"author": "Paulo Ragonha",
"license": "MIT",
"bugs": {

@@ -36,12 +42,25 @@ "url": "https://github.com/pirelenito/git-revision-webpack-plugin/issues"

"homepage": "https://github.com/pirelenito/git-revision-webpack-plugin",
"module": "dist/git-revision-webpack-plugin.esm.js",
"size-limit": [
{
"path": "dist/git-revision-webpack-plugin.cjs.production.min.js",
"limit": "10 KB"
},
{
"path": "dist/git-revision-webpack-plugin.esm.js",
"limit": "10 KB"
}
],
"devDependencies": {
"chai": "^4.1.2",
"file-loader": "^1.1.11",
"fs-extra": "^5.0.0",
"mocha": "^5.0.4",
"rewire": "^3.0.2",
"sinon": "^4.4.8",
"standard": "^11.0.1",
"webpack": "^4.1.1"
"@size-limit/preset-small-lib": "^4.10.2",
"@types/fs-extra": "^9.0.11",
"@types/webpack": "5.28.0",
"file-loader": "^6.2.0",
"fs-extra": "^9.1.0",
"size-limit": "^4.10.2",
"tsdx": "^0.14.1",
"tslib": "^2.2.0",
"typescript": "^4.2.4",
"webpack": "^5.28.0"
}
}

@@ -1,7 +0,5 @@

# Git revision webpack plugin
# git-revision-webpack-plugin
[![Build Status](https://travis-ci.org/pirelenito/git-revision-webpack-plugin.svg)](https://travis-ci.org/pirelenito/git-revision-webpack-plugin)
[![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/git-revision-webpack-plugin)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)
[![Code Climate](https://codeclimate.com/github/pirelenito/git-revision-webpack-plugin/badges/gpa.svg)](https://codeclimate.com/github/pirelenito/git-revision-webpack-plugin)

@@ -13,3 +11,3 @@

Given a **webpack 4** project ([check below](#outdated-webpack) for **old webpack versions**), install it as a local development dependency:
Given a **webpack 5** project ([check below](#outdated-webpack) for **old webpack versions**), install it as a local development dependency:

@@ -26,5 +24,3 @@ ```bash

module.exports = {
plugins: [
new GitRevisionPlugin()
]
plugins: [new GitRevisionPlugin()],
}

@@ -58,2 +54,3 @@ ```

- `[git-revision-branch]` (only [when branch is enabled](#branch-false))
- `[git-revision-last-commit-datetime]`

@@ -66,4 +63,4 @@ Example:

publicPath: 'http://my-fancy-cdn.com/[git-revision-version]/',
filename: '[name]-[git-revision-hash].js'
}
filename: '[name]-[git-revision-hash].js',
},
}

@@ -74,3 +71,3 @@ ```

The `VERSION`, `COMMITHASH` and `BRANCH` are also exposed through a public API.
The `VERSION`, `COMMITHASH`, `LASTCOMMITDATETIME` and `BRANCH` are also exposed through a public API.

@@ -88,7 +85,8 @@ Example using the [DefinePlugin](https://webpack.js.org/plugins/define-plugin/#usage):

new webpack.DefinePlugin({
'VERSION': JSON.stringify(gitRevisionPlugin.version()),
'COMMITHASH': JSON.stringify(gitRevisionPlugin.commithash()),
'BRANCH': JSON.stringify(gitRevisionPlugin.branch()),
})
]
VERSION: JSON.stringify(gitRevisionPlugin.version()),
COMMITHASH: JSON.stringify(gitRevisionPlugin.commithash()),
BRANCH: JSON.stringify(gitRevisionPlugin.branch()),
LASTCOMMITDATETIME: JSON.stringify(gitRevisionPlugin.lastcommitdatetime()),
}),
],
}

@@ -111,5 +109,5 @@ ```

new GitRevisionPlugin({
lightweightTags: true
})
]
lightweightTags: true,
}),
],
}

@@ -128,5 +126,5 @@ ```

new GitRevisionPlugin({
branch: true
})
]
branch: true,
}),
],
}

@@ -147,5 +145,5 @@ ```

new GitRevisionPlugin({
commithashCommand: 'rev-list --max-count=1 --no-merges HEAD'
})
]
commithashCommand: 'rev-list --max-count=1 --no-merges HEAD',
}),
],
}

@@ -166,5 +164,5 @@ ```

new GitRevisionPlugin({
versionCommand: 'describe --always --tags --dirty'
})
]
versionCommand: 'describe --always --tags --dirty',
}),
],
}

@@ -185,13 +183,39 @@ ```

new GitRevisionPlugin({
branchCommand: 'rev-parse --symbolic-full-name HEAD'
})
]
branchCommand: 'rev-parse --symbolic-full-name HEAD',
}),
],
}
```
### `lastCommitDateTimeCommand: 'log -1 --format=%cI'`
To change the default `git` command used to read the value of `LASTCOMMITDATETIME`.
This configuration is not not meant to accept arbitrary user input and it is executed by the plugin without any sanitization.
```javascript
var GitRevisionPlugin = require('git-revision-webpack-plugin')
module.exports = {
plugins: [
new GitRevisionPlugin({
branchCommand: 'log -1 --format=%ci',
}),
],
}
```
## Outdated webpack
If your project is **not using webpack version 4 or greater**, you will need to install an older version of this package:
If your project is not running on Webpack 5, you will need older versions of this package.
### Webpack 4
```
npm install git-revision-webpack-plugin@3.0.6
```
### Webpack 3 or older
```
npm install git-revision-webpack-plugin@2.5.1

@@ -198,0 +222,0 @@ ```

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