Skip to content

Commit

Permalink
Merge pull request #2572 from emqx/dev/1.8.1
Browse files Browse the repository at this point in the history
Sync code from refs/heads/dev/1.8.1 to enterprise
  • Loading branch information
Kinplemelon authored Apr 9, 2024
2 parents 882fa3d + 025ff73 commit f0940ea
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scripts/checkPackageVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
const packageJSON = require('../package.json')
const axios = require('axios')
const baseURL = process.env.HOST_URL || 'http://localhost:18083'
const packageVersion = packageJSON.version
const rawPackageVersion = packageJSON.version

const emqxVersionRegex = /^[ev](\d+\.\d+\.\d+)/
const packageVersionRegex = /^(\d+\.\d+)/
const matchPackageVersion = (packageVersion) => {
const matchRet = packageVersion.match(packageVersionRegex)
return matchRet ? matchRet[1] : ''
}

const emqxVersionRegex = /^[ev](\d+\.\d+)/
const matchEmqxVersion = (emqxVersion) => {
const matchRet = emqxVersion.match(emqxVersionRegex)
return matchRet ? matchRet[1] : ''
Expand All @@ -13,6 +19,7 @@ const matchEmqxVersion = (emqxVersion) => {
const check = async () => {
const { data } = await axios.get(`${baseURL}/api/v5/status`, { params: { format: 'json' } })
const { rel_vsn } = data
const packageVersion = matchPackageVersion(rawPackageVersion)
const emqxVersion = matchEmqxVersion(rel_vsn)
if (emqxVersion !== packageVersion) {
console.log('EMQX Version:', emqxVersion)
Expand Down

0 comments on commit f0940ea

Please sign in to comment.