Skip to content

Commit

Permalink
fix: find version number regardless of quotations in declaration
Browse files Browse the repository at this point in the history
This patch adds a better catch to the regex for the new version number,
ensuring it will be found regardless of if the version number is defined
with single/double quotes, backticks or no quotes at all.
  • Loading branch information
Jacobomara901 authored and mblenk committed Jul 16, 2024
1 parent 0f489a8 commit f8b9be8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions checkVersionNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ if(cliInput === 'version') {

if(!versionNumberIdentified) return console.log('No version found')
if(versionNumberIdentified) {
const regex = /"(.*?)"/
const regex = /our \$VERSION\s*=\s*(["'`]?)([\d.]+)\1;/
const findVersionNumber = regex.exec(fileByLine[versionNumberIdentified])
const pluginVersion = findVersionNumber[1]
const pluginVersion = findVersionNumber[2]
console.log(`v${pluginVersion}`)
}
}

0 comments on commit f8b9be8

Please sign in to comment.