git-revision-webpack-plugin
Advanced tools
Comparing version 3.0.5 to 3.0.6
@@ -7,3 +7,2 @@ var buildFile = require('./build-file') | ||
var BRANCH_COMMAND = 'rev-parse --abbrev-ref HEAD' | ||
var LASTCOMMITDATETIME_COMMAND = 'log -1 --format=%cI' | ||
@@ -26,5 +25,2 @@ function GitRevisionPlugin (options) { | ||
this.lastCommitDateTimeCommand = options.lastCommitDateTimeCommand || | ||
LASTCOMMITDATETIME_COMMAND | ||
if (options.versionCommand && options.lightweightTags) { | ||
@@ -52,10 +48,2 @@ throw new Error('lightweightTags can\'t be used together versionCommand') | ||
buildFile({ | ||
compiler: compiler, | ||
gitWorkTree: this.gitWorkTree, | ||
command: this.lastCommitDateTimeCommand, | ||
replacePattern: /\[git-revision-last-commit-datetime\]/gi, | ||
asset: 'LASTCOMMITDATETIME' | ||
}) | ||
if (this.createBranchFile) { | ||
@@ -93,9 +81,2 @@ buildFile({ | ||
GitRevisionPlugin.prototype.lastcommitdatetime = function () { | ||
return runGitCommand( | ||
this.gitWorkTree, | ||
this.lastCommitDateTimeCommand | ||
) | ||
} | ||
module.exports = GitRevisionPlugin |
@@ -105,30 +105,2 @@ /* global describe, it */ | ||
}) | ||
describe('on setting custom last commit date time command', function () { | ||
it('should run the build on .apply', function () { | ||
var buildFile = sinon.spy() | ||
GitRevisionPlugin.__set__('buildFile', buildFile) | ||
new GitRevisionPlugin({ | ||
lastCommitDateTimeCommand: 'custom last commit date time command' | ||
}).apply() | ||
var lastCommitDateTimeCall = buildFile.args.find(function (calls) { | ||
return calls[0].asset === 'LASTCOMMITDATETIME' | ||
}) | ||
expect(lastCommitDateTimeCall[0].command).to.eql('custom last commit date time command') | ||
}) | ||
it('should run the custom git command on .lastcommitdatetime', function () { | ||
var runGitCommand = sinon.spy() | ||
GitRevisionPlugin.__set__('runGitCommand', runGitCommand) | ||
new GitRevisionPlugin({ | ||
lastCommitDateTimeCommand: 'custom last commit date time command' | ||
}).lastcommitdatetime() | ||
expect(runGitCommand.args[0][1]).to.eql('custom last commit date time command') | ||
}) | ||
}) | ||
}) |
{ | ||
"name": "git-revision-webpack-plugin", | ||
"version": "3.0.5", | ||
"version": "3.0.6", | ||
"description": "Simple webpack plugin that generates VERSION and COMMITHASH files during build", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -56,3 +56,2 @@ # Git revision webpack plugin | ||
- `[git-revision-branch]` (only [when branch is enabled](#branch-false)) | ||
- `[git-revision-last-commit-datetime]` | ||
@@ -72,3 +71,3 @@ Example: | ||
The `VERSION`, `COMMITHASH`, `LASTCOMMITDATETIME` and `BRANCH` are also exposed through a public API. | ||
The `VERSION`, `COMMITHASH` and `BRANCH` are also exposed through a public API. | ||
@@ -89,3 +88,2 @@ Example using the [DefinePlugin](https://webpack.js.org/plugins/define-plugin/#usage): | ||
'BRANCH': JSON.stringify(gitRevisionPlugin.branch()), | ||
'LASTCOMMITDATETIME': JSON.stringify(gitRevisionPlugin.lastcommitdatetime()), | ||
}) | ||
@@ -186,20 +184,2 @@ ] | ||
### `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 | ||
@@ -206,0 +186,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21553
372
190