-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: ignore exit code instead of catching errors
- Loading branch information
Showing
2 changed files
with
9 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,10 @@ | ||
const execSync = require('child_process').execSync; | ||
|
||
const lastTag = () => { | ||
let sha; | ||
|
||
try { | ||
sha = execSync( | ||
'git describe --tags --match "v[0-9]*" --exclude="*dev*" --abbrev=0 origin/master', | ||
{ encoding: 'utf8' } | ||
).trim(); | ||
} catch(e) {} | ||
|
||
return sha; | ||
} | ||
const lastTag = ({ branch = 'origin/master', dev = true } = {}) => { | ||
const exclude = dev ? ' --exclude="*dev*"' : ''; | ||
return execSync(`git describe --tags --match "v[0-9]*" ${exclude} --abbrev=0 ${branch} || true`, | ||
{ encoding: 'utf8' } | ||
).trim(); | ||
}; | ||
|
||
module.exports = lastTag; |