Fix initial setup scripts

This commit is contained in:
pietervdvn 2021-05-07 02:06:08 +02:00
parent 1f9b175a96
commit 55eedb4185

View file

@ -1,5 +1,5 @@
import {Utils} from "../Utils";
import {lstatSync, readdirSync, readFileSync, writeFileSync, unlinkSync} from "fs";
import {lstatSync, readdirSync, readFileSync, writeFileSync, unlinkSync, existsSync, mkdir, mkdirSync} from "fs";
import SmallLicense from "../Models/smallLicense";
import ScriptUtils from "./ScriptUtils";
@ -33,7 +33,8 @@ function generateLicenseInfos(paths: string[]): SmallLicense[] {
smallLicens.path = path.substring(0, 1 + path.lastIndexOf("/")) + smallLicens.path
licenses.push(smallLicens)
}}catch(e){
}
} catch (e) {
console.error("Error: ", e, "while handling", path)
}
@ -195,6 +196,9 @@ const contents = ScriptUtils.readDirRecSync("./assets")
const licensePaths = contents.filter(entry => entry.indexOf("license_info.json") >= 0)
const licenseInfos = generateLicenseInfos(licensePaths);
if (!existsSync("./assets/generated")) {
mkdirSync("./assets/generated")
}
writeFileSync("./assets/generated/license_info.json", JSON.stringify(licenseInfos, null, " "))