Reviewed-on: #1 Co-authored-by: Mike Bloy <mike@bloy.org> Co-committed-by: Mike Bloy <mike@bloy.org>
20 lines
552 B
JavaScript
20 lines
552 B
JavaScript
export const MODULE_ID = "mb-cypher2";
|
|
|
|
export function log(...args) {
|
|
console.log(`${MODULE_ID} |`, ...args);
|
|
}
|
|
|
|
export function normalizeTemplatePaths(paths, baseDir = "") {
|
|
const templates = {};
|
|
log("finding templates", paths, baseDir);
|
|
const basePath = `modules/${MODULE_ID}/templates${baseDir ? "/" + baseDir : ""}`;
|
|
for (const file of paths) {
|
|
templates[file] = `${basePath}/${file}`;
|
|
}
|
|
return templates;
|
|
}
|
|
|
|
export async function preloadTemplatePaths(normalizedPaths) {
|
|
return loadTemplates(Object.values(normalizedPaths));
|
|
}
|