Closed Drzaln closed 4 months ago
Did you find an easy way to manage this case ?
I create custom function to check the version
const compareSemVer = (version1: string, version2: string) => {
const v1 = version1 ? version1.split('.').map(Number) : [0, 0, 0];
const v2 = version2 ? version2.split('.').map(Number) : [0, 0, 0];
if (v1[0] < v2[0]) {
return 'force';
} else if (v1[0] === v2[0] && v1[1] < v2[1]) {
return 'major';
} else if (v1[0] === v2[0] && v1[1] === v2[1] && v1[2] < v2[2]) {
return 'minor';
} else {
return 'none'; // No upgrade needed
}
};
export default compareSemVer;
Hi, I want to ask something. How to check the version and separate to force upgrade, major and minor upgrade? The use case will be like this
1.xxx.xxx to 2.xxx.xxx --> force upgrade 2.1.xxx to 2.2.xxx --> major upgrade 2.2.43 to 2.2.44 --> minor upgrade
Thank you