All files / lib version.ts

100% Statements 44/44
0% Branches 0/2
100% Functions 0/0
100% Lines 44/44

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 451x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/*******************************************************************************
 * Copyright bei
 * Entwicklungs- und Pflegeverbund für das gemeinsame Fachverfahren gefa
 *
 *******************************************************************************/
import { GEFA_CONTROLS_VERSION_STRING } from './version.env';
 
/** Representation of a semantic version number. */
export interface Version {
  /** Core version string, without any prerelase or build information (e.g. '1.2.3'). */
  readonly version: string;
  /** Major part of the version number */
  readonly major: number;
  /** Minor part of the version number */
  readonly minor: number;
  /** Patch part of the version number */
  readonly patch: number;
 
  /** Complete semantic version number, including all prerelease and build information. */
  readonly full: string;
  /** Pre-release identifier, if present in the version number. */
  readonly preRelease?: string;
  /** Build metadata, if present in the version number. */
  readonly build?: string;
}
 
const versionFull = GEFA_CONTROLS_VERSION_STRING;
const versionBuildParts = versionFull.split('+', 2);
const versionPrereleaseParts = versionBuildParts[0].split('-', 2);
const versionParts = versionPrereleaseParts[0].split('.');
 
/** Version number of the gefa controls library. */
export const GEFA_CONTROLS_VERSION: Version = {
  full: versionFull,
  version: versionPrereleaseParts[0],
 
  major: parseInt(versionParts[0]),
  minor: parseInt(versionParts[1] ?? '0'),
  patch: parseInt(versionParts[2] ?? '0'),
 
  preRelease:
    versionPrereleaseParts.length > 1 ? versionPrereleaseParts[1] : undefined,
  build: versionBuildParts.length > 1 ? versionBuildParts[1] : undefined,
};