chore: make dev versions increase monotonically (#33205)
This commit is contained in:
parent
01ffc7d12f
commit
10b0c99f17
11 changed files with 32 additions and 47 deletions
|
|
@ -94,7 +94,8 @@ StableUpdateWithUpdater.args = {
|
|||
|
||||
export const Nightly = Template.bind({});
|
||||
Nightly.args = {
|
||||
installed: "0.304.0-dev+5ce7be4",
|
||||
installed: "0.304.0-dev.1712345678",
|
||||
commit: "5ce7be4",
|
||||
};
|
||||
|
||||
export const DevBuild = Template.bind({});
|
||||
|
|
|
|||
|
|
@ -147,13 +147,7 @@ import Logo from "./Footer/Logo.vue";
|
|||
import api from "@/api";
|
||||
import settings from "@/settings";
|
||||
import { extractDomain } from "@/utils/extractDomain";
|
||||
import {
|
||||
isDevelopment,
|
||||
isNightly,
|
||||
getReleaseName,
|
||||
commitFromVersion,
|
||||
isNewVersionAvailable,
|
||||
} from "@/utils/version";
|
||||
import { isDevelopment, isNightly, getReleaseName, isNewVersionAvailable } from "@/utils/version";
|
||||
import { defineComponent } from "vue";
|
||||
|
||||
const GITHUB_REPO = "https://github.com/evcc-io/evcc";
|
||||
|
|
@ -164,6 +158,7 @@ export default defineComponent({
|
|||
components: { GenericModal, Logo },
|
||||
props: {
|
||||
installed: { type: String, default: "" },
|
||||
commit: { type: String, default: "" },
|
||||
availableVersion: String,
|
||||
releaseNotes: String,
|
||||
hasUpdater: Boolean,
|
||||
|
|
@ -208,7 +203,7 @@ export default defineComponent({
|
|||
return `${GITHUB_REPO}/network/dependencies`;
|
||||
},
|
||||
githubCommitUrl() {
|
||||
return `${GITHUB_REPO}/commit/${commitFromVersion(this.installed)}`;
|
||||
return `${GITHUB_REPO}/commit/${this.commit}`;
|
||||
},
|
||||
modalSize() {
|
||||
return this.newVersionAvailable ? undefined : "sm";
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ declare global {
|
|||
app: any;
|
||||
evcc?: {
|
||||
version: string;
|
||||
commit: string;
|
||||
customCss: boolean;
|
||||
customLogo: boolean;
|
||||
customBrand: string;
|
||||
|
|
|
|||
|
|
@ -2,14 +2,13 @@ import { describe, expect, test } from "vite-plus/test";
|
|||
import {
|
||||
isDevelopment,
|
||||
isNightly,
|
||||
commitFromVersion,
|
||||
getReleaseName,
|
||||
getShortVersion,
|
||||
isNewVersionAvailable,
|
||||
} from "./version";
|
||||
|
||||
const DEV = "0.0.0";
|
||||
const NIGHTLY = "0.304.0-dev+abc1234";
|
||||
const NIGHTLY = "0.304.0-dev.1712345678";
|
||||
const STABLE = "0.303.1";
|
||||
|
||||
describe("isDevelopment", () => {
|
||||
|
|
@ -21,20 +20,13 @@ describe("isDevelopment", () => {
|
|||
});
|
||||
|
||||
describe("isNightly", () => {
|
||||
test("only versions with build metadata", () => {
|
||||
test("only pre-release versions", () => {
|
||||
expect(isNightly(DEV)).toBe(false);
|
||||
expect(isNightly(NIGHTLY)).toBe(true);
|
||||
expect(isNightly(STABLE)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("commitFromVersion", () => {
|
||||
test("extracts build metadata", () => {
|
||||
expect(commitFromVersion(NIGHTLY)).toBe("abc1234");
|
||||
expect(commitFromVersion(STABLE)).toBe("");
|
||||
});
|
||||
});
|
||||
|
||||
describe("getReleaseName", () => {
|
||||
test("maps version to release name", () => {
|
||||
expect(getReleaseName(DEV)).toBe("development");
|
||||
|
|
@ -46,7 +38,7 @@ describe("getReleaseName", () => {
|
|||
describe("getShortVersion", () => {
|
||||
test("formats version", () => {
|
||||
expect(getShortVersion(DEV)).toBe("dev build");
|
||||
expect(getShortVersion(NIGHTLY)).toBe("v0.304.0-dev+abc1234");
|
||||
expect(getShortVersion(NIGHTLY)).toBe("v0.304.0-dev.1712345678");
|
||||
expect(getShortVersion(STABLE)).toBe("v0.303.1");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,13 +2,9 @@ export function isDevelopment(version: string): boolean {
|
|||
return version === "0.0.0";
|
||||
}
|
||||
|
||||
// untagged builds carry the commit as build metadata: 0.304.0-dev+abc1234
|
||||
// untagged builds are pre-releases carrying the build timestamp: 0.304.0-dev.1712345678
|
||||
export function isNightly(version: string): boolean {
|
||||
return version.includes("+");
|
||||
}
|
||||
|
||||
export function commitFromVersion(version: string): string {
|
||||
return version.split("+")[1] ?? "";
|
||||
return version.includes("-dev.");
|
||||
}
|
||||
|
||||
export function getReleaseName(version: string): string {
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ export default defineComponent({
|
|||
aboutModalProps() {
|
||||
return {
|
||||
installed: window.evcc?.version,
|
||||
commit: window.evcc?.commit,
|
||||
customLogo: this.custom.logo,
|
||||
customBrand: this.custom.brand,
|
||||
customWebsite: this.custom.website,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue