Skip to content

Commit 667543b

Browse files
committed
Prevent using lightweightTags with versionCommand 😜
One defeats the purpose of the other
1 parent 311ef14 commit 667543b

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

lib/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ function GitRevisionPlugin (options) {
1414

1515
this.versionCommand = options.versionCommand ||
1616
VERSION_COMMAND + (options.lightweightTags ? ' --tags' : '')
17+
18+
if (options.versionCommand && options.lightweightTags) {
19+
throw new Error('lightweightTags can\'t be used together versionCommand')
20+
}
1721
}
1822

1923
GitRevisionPlugin.prototype.apply = function (compiler) {

lib/index.spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ describe('git-revision-webpack-plugin (unit)', function () {
3636
})
3737

3838
describe('on setting custom version command', function () {
39+
it('should prevent setting lightweightTags flag', function () {
40+
expect(function () {
41+
/* eslint no-new: 0 */
42+
new GitRevisionPlugin({
43+
versionCommand: 'custom version command',
44+
lightweightTags: true
45+
})
46+
}).to.throw('lightweightTags can\'t be used together versionCommand')
47+
})
48+
3949
it('should run the build on .apply', function () {
4050
var buildFile = sinon.spy()
4151
GitRevisionPlugin.__set__('buildFile', buildFile)

0 commit comments

Comments
 (0)