Skip to content

Commit

Permalink
Use previous published mediasoup version if it's a prerelease
Browse files Browse the repository at this point in the history
  • Loading branch information
piranna committed Jan 13, 2025
1 parent 9d3f4b5 commit 06c27f4
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions scripts/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,32 @@ const options = {force: true, recursive: true}
const repo = 'versatica/mediasoup'


const {argv: [,, version]} = process;

let {argv: [,, version]} = process;

ok(version, 'version is required');

// If version is a pre-release, get the previous version
if(version.includes('-'))
{
let [major, minor, patch] = version.split('-')[0].split('.')

patch = parseInt(patch)
if(patch) patch -= 1
else
{
minor = parseInt(minor)
if(minor) minor -= 1
else
{
major = parseInt(major)
ok(major, 'Invalid version')
major -= 1
}
}

version = `${major}.${minor}.${patch}`
}


(async function()
{
Expand Down

0 comments on commit 06c27f4

Please sign in to comment.