forked from MapComplete/MapComplete
Fix initial setup scripts
This commit is contained in:
parent
1f9b175a96
commit
55eedb4185
1 changed files with 32 additions and 28 deletions
|
@ -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, " "))
|
||||
|
||||
|
|
Loading…
Reference in a new issue