-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try generating the minimum versions instead.
- Loading branch information
Showing
3 changed files
with
30 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export function generateWpVersions( versionString ) { | ||
const version = versionString.split( '-' )[ 0 ]; | ||
let [ major, minor ] = version.split( '.' ).slice( 0, 2 ).map( Number ); | ||
|
||
const versions = []; | ||
|
||
// Iterate through the versions from current to 5.9 | ||
while ( major > 5 || ( major === 5 && minor >= 9 ) ) { | ||
versions.push( `${ major }.${ minor }` ); | ||
|
||
// Decrement minor version | ||
if ( minor === 0 ) { | ||
minor = 9; // Wrap around if minor is 0, decrement the major version | ||
major--; | ||
} else { | ||
minor--; | ||
} | ||
} | ||
|
||
return versions; | ||
} |