mirror of
https://github.com/immich-app/immich.git
synced 2025-02-11 01:18:24 -05:00
chore: remove unused code (#9824)
This commit is contained in:
parent
db4c66094c
commit
5ef144bf79
1 changed files with 0 additions and 37 deletions
|
@ -1,37 +0,0 @@
|
||||||
import { version } from '../package.json';
|
|
||||||
|
|
||||||
export interface ICliVersion {
|
|
||||||
major: number;
|
|
||||||
minor: number;
|
|
||||||
patch: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class CliVersion implements ICliVersion {
|
|
||||||
constructor(
|
|
||||||
public readonly major: number,
|
|
||||||
public readonly minor: number,
|
|
||||||
public readonly patch: number,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
toString() {
|
|
||||||
return `${this.major}.${this.minor}.${this.patch}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
const { major, minor, patch } = this;
|
|
||||||
return { major, minor, patch };
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromString(version: string): CliVersion {
|
|
||||||
const regex = /v?(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)/i;
|
|
||||||
const matchResult = version.match(regex);
|
|
||||||
if (matchResult) {
|
|
||||||
const [, major, minor, patch] = matchResult.map(Number);
|
|
||||||
return new CliVersion(major, minor, patch);
|
|
||||||
} else {
|
|
||||||
throw new Error(`Invalid version format: ${version}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const cliVersion = CliVersion.fromString(version);
|
|
Loading…
Add table
Reference in a new issue