Files
twenty_crm/packages/twenty-website/src/app/releases/utils/get-formatted-release-number.ts
Ady Beraud df5cb9a904 Smart changelog (#5205)
Added a smart Changelog :

- Publish the Changelog before the app release. If the release has not
yet been pushed to production, do not display it.
- When the app release is done, make the Changelog available with the
correct date.
- If the Changelog writing is delayed because the release has already
been made, publish it immediately.
- Display everything locally to be able to iterate on the changelog and
have a preview

Added an endpoint for the Changelog

---------

Co-authored-by: Ady Beraud <a.beraud96@gmail.com>
Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
2024-05-01 08:35:11 +02:00

20 lines
562 B
TypeScript

export const getFormattedReleaseNumber = (versionNumber: string) => {
const formattedVersion = versionNumber.replace('v', '');
const parts = formattedVersion.split('.').map(Number);
if (parts.length !== 3) {
throw new Error('Version must be in the format major.minor.patch');
}
// Assign weights. Adjust these based on your needs.
const majorWeight = 10000;
const minorWeight = 100;
const patchWeight = 1;
const numericVersion =
parts[0] * majorWeight + parts[1] * minorWeight + parts[2] * patchWeight;
return numericVersion;
};