Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion bin/lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@ function getVersion () {
// Obtain version from git
const options = { cwd: __dirname, encoding: 'utf8' }
const { stdout } = spawnSync('git', ['describe', '--tags'], options)
return stdout.trim()
const version = stdout.trim()
if (version === '') {
throw new Error('No git version here')
}
return version
} catch (e) {
// Obtain version from package.json
const { version } = require(path.join(__dirname, '../../package.json'))
return version
}
}