Skip to content

Commit f1eaed0

Browse files
committed
Allow custom version commands as well 👯
1 parent 71dccc0 commit f1eaed0

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,20 @@ function GitRevisionPlugin (options) {
88
this.gitWorkTree = options && options.gitWorkTree
99
this.lightweightTags = options && options.lightweightTags || false
1010
this.commithashCommand = options && options.commithashCommand || commithashCommand
11+
this.versionCommand = options && options.versionCommand || versionCommand
1112
}
1213

1314
GitRevisionPlugin.prototype.apply = function (compiler) {
1415
buildFile(compiler, this.gitWorkTree, this.commithashCommand, /\[git-revision-hash\]/gi, 'COMMITHASH')
15-
buildFile(compiler, this.gitWorkTree, versionCommand + (this.lightweightTags ? ' --tags' : ''), /\[git-revision-version\]/gi, 'VERSION')
16+
buildFile(compiler, this.gitWorkTree, this.versionCommand + (this.lightweightTags ? ' --tags' : ''), /\[git-revision-version\]/gi, 'VERSION')
1617
}
1718

1819
GitRevisionPlugin.prototype.commithash = function (callback) {
1920
return runGitCommand(this.gitWorkTree, this.commithashCommand)
2021
}
2122

2223
GitRevisionPlugin.prototype.version = function (callback) {
23-
return runGitCommand(this.gitWorkTree, versionCommand + (this.lightweightTags ? ' --tags' : ''))
24+
return runGitCommand(this.gitWorkTree, this.versionCommand + (this.lightweightTags ? ' --tags' : ''))
2425
}
2526

2627
module.exports = GitRevisionPlugin

0 commit comments

Comments
 (0)