Automate project with gulp and transition to TypeScript.
Expand character data and sheet.
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import Globals from "../Globals";
|
||||
import Color from "color";
|
||||
|
||||
class Logger {
|
||||
// static class
|
||||
private constructor() {}
|
||||
|
||||
private static GetCurrentTime(): string {
|
||||
return `[${(new Date().toLocaleTimeString())}] `;
|
||||
}
|
||||
|
||||
static log(str: string, colour: Color = Color("white"), bold = false): void {
|
||||
const time = ToConsole(Logger.GetCurrentTime(), Color("gray"), false)
|
||||
const moduleName = ToConsole(Globals.name + " ", Color("cyan"), true);
|
||||
const text = ToConsole(str, colour, bold);
|
||||
console.log(time.str + moduleName.str + text.str, ...time.params.concat(moduleName.params, text.params));
|
||||
}
|
||||
|
||||
static Err(str: string): void {
|
||||
Logger.log(str, Color("orange"));
|
||||
}
|
||||
|
||||
static Warn(str: string): void {
|
||||
Logger.log(str, Color("yellow"));
|
||||
}
|
||||
|
||||
static Ok(str: string): void {
|
||||
Logger.log(str, Color("green"));
|
||||
}
|
||||
}
|
||||
|
||||
interface ConsoleColour {
|
||||
str: string,
|
||||
params: Array<string>;
|
||||
}
|
||||
|
||||
const ToConsole = (str: string, col: Color, bold: boolean): ConsoleColour => {
|
||||
return {
|
||||
str: `%c` + str + `%c`,
|
||||
params: [
|
||||
"color: " + col.hex() + ";" + (bold ? "font-weight: bold;" : ""),
|
||||
"color: unset; font-weight: unset;"
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
export default Logger;
|
||||
@@ -0,0 +1,8 @@
|
||||
import {ModuleData} from "@league-of-foundry-developers/foundry-vtt-types/src/foundry/common/packages.mjs";
|
||||
import Globals from "../Globals";
|
||||
|
||||
export const getModuleInformation = async (): Promise<ModuleData> => {
|
||||
const systemOrModule = Globals.isModule ? "module" : "system"
|
||||
const module = await fetch(systemOrModule + "s/" + Globals.name + "/" + systemOrModule + ".json")
|
||||
return await module.json();
|
||||
};
|
||||
Reference in New Issue
Block a user