refactor: use standard prettier formatting

This commit is contained in:
2024-04-06 13:15:35 +02:00
parent 86ec8651b6
commit 854ab6d3be
106 changed files with 2703 additions and 2046 deletions

View File

@@ -1,24 +1,24 @@
export class SemVer {
major = 0
minor = 0
patch = 0
preRelease?: string
meta?: string
major = 0;
minor = 0;
patch = 0;
preRelease?: string;
meta?: string;
constructor(versionString: string) {
const result =
/^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+))?$/.exec(
versionString,
)
);
if (!result) {
console.error("Invalid version string:", versionString)
console.error("Invalid version string:", versionString);
} else {
const [, major, minor, patch, preRelease, meta] = result
this.major = Number.parseInt(major)
this.minor = Number.parseInt(minor)
this.patch = Number.parseInt(patch)
if (preRelease) this.preRelease = preRelease
if (meta) this.meta = meta
const [, major, minor, patch, preRelease, meta] = result;
this.major = Number.parseInt(major);
this.minor = Number.parseInt(minor);
this.patch = Number.parseInt(patch);
if (preRelease) this.preRelease = preRelease;
if (meta) this.meta = meta;
}
}
@@ -27,6 +27,6 @@ export class SemVer {
`${this.major}.${this.minor}.${this.patch}` +
(this.preRelease ? `-${this.preRelease}` : "") +
(this.meta ? `+${this.meta}` : "")
)
);
}
}