support in master #299

Merged
edraft merged 7 commits from support into master 2023-04-10 13:15:32 +02:00
3 changed files with 13 additions and 6 deletions
Showing only changes of commit c01a6b97fe - Show all commits

View File

@ -51,4 +51,4 @@
"tslib": "^2.4.1",
"typescript": "~4.9.5"
}
}
}

View File

@ -25,4 +25,4 @@
"Name": "sh-edraft-dark-theme"
}
]
}
}

View File

@ -1,5 +1,6 @@
import { Appsettings } from "./src/app/models/config/appsettings";
import { SoftwareVersion } from "./src/app/models/config/software-version";
import fs from "fs";
const jsonFilePath = "./src/assets/config.json";
@ -33,14 +34,20 @@ async function getVersion(): Promise<SoftwareVersion> {
}
if (versions.length > 2) {
micro = versions.slice(2).toString().replace(',', '.');
micro = versions.slice(2).toString().replace(",", ".");
}
} else if (branch.startsWith("#")) {
const fs = require("fs");
const config: Appsettings = JSON.parse(fs.readFileSync(jsonFilePath, 'utf-8'))
const config: Appsettings = JSON.parse(fs.readFileSync(jsonFilePath, "utf-8"));
major = config.WebVersion.Major;
minor = config.WebVersion.Minor;
micro = `dev${branch.split("#")[1]}`;
} else {
const fs = require("fs");
const config: Appsettings = JSON.parse(fs.readFileSync(jsonFilePath, "utf-8"));
major = config.WebVersion.Major;
minor = config.WebVersion.Minor;
micro = config.WebVersion.Micro;
}
return new SoftwareVersion(major, minor, micro);
}
@ -57,13 +64,13 @@ async function setVersion(version: SoftwareVersion) {
fs.writeFile(jsonFilePath, JSON.stringify(settings, null, 4), "utf8", () => {
});
});
fs.readFile('./package.json', "utf8", (err: Error, data: string) => {
fs.readFile("./package.json", "utf8", (err: Error, data: string) => {
if (err) {
throw err;
}
const settings = JSON.parse(data);
settings.version = version.getVersionString();
fs.writeFile('./package.json', JSON.stringify(settings, null, 4), "utf8", () => {
fs.writeFile("./package.json", JSON.stringify(settings, null, 4), "utf8", () => {
});
});
}