# Introduction We want the APP_VERSION to be able to contains pre-release options, in a nutshell to be semVer compatible. But we want to have workspace, at least for the moment, that only store `x.y.z` and not `vx.y.z` or `x.y.z-alpha` version in database Explaining this refactor Related https://github.com/twentyhq/twenty/pull/10907
12 lines
261 B
TypeScript
12 lines
261 B
TypeScript
import semver from 'semver';
|
|
|
|
export const extractVersionMajorMinorPatch = (version: string | undefined) => {
|
|
const parsed = semver.parse(version);
|
|
|
|
if (parsed === null) {
|
|
return null;
|
|
}
|
|
|
|
return `${parsed.major}.${parsed.minor}.${parsed.patch}`;
|
|
};
|