HEX
Server: Apache/2.4.65 (Debian)
System: Linux kubikelcreative 5.10.0-35-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64
User: www-data (33)
PHP: 8.4.13
Disabled: NONE
Upload Files
File: //usr/share/npm/node_modules/libnpmversion/lib/retrieve-tag.js
const {spawn} = require('@npmcli/git')
const semver = require('semver')

module.exports = async opts => {
  const tag = (await spawn(['describe', '--abbrev=0'], opts)).stdout.trim()
  const match = tag.match(/v?(\d+\.\d+\.\d+(?:[-+].+)?)/)
  const ver = match && semver.clean(match[1], { loose: true })
  if (ver)
    return ver
  throw new Error(`Tag is not a valid version: ${JSON.stringify(tag)}`)
}