refactor: update findAppRoot function and adjust Dockerfile paths for consistency
This commit is contained in:
@@ -3,7 +3,7 @@ import { join } from "node:path";
|
||||
import nunjucks from "nunjucks";
|
||||
import type { ImageSelection, UsageTemplate } from "./types";
|
||||
|
||||
const findAppNewRoot = (): string => {
|
||||
const findAppRoot = (): string => {
|
||||
const candidates = [join(__dirname, "../../.."), join(__dirname, "../..")];
|
||||
|
||||
for (const candidate of candidates) {
|
||||
@@ -12,19 +12,19 @@ const findAppNewRoot = (): string => {
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error("Unable to resolve app-new template root");
|
||||
throw new Error("Unable to resolve app template root");
|
||||
};
|
||||
|
||||
export class TemplateService {
|
||||
private readonly appNewRoot = findAppNewRoot();
|
||||
private readonly appRoot = findAppRoot();
|
||||
|
||||
private readonly env = nunjucks.configure(join(this.appNewRoot, "templates"), {
|
||||
private readonly env = nunjucks.configure(join(this.appRoot, "templates"), {
|
||||
autoescape: false,
|
||||
noCache: true
|
||||
});
|
||||
|
||||
private readonly templates: UsageTemplate[] = JSON.parse(
|
||||
readFileSync(join(this.appNewRoot, "templates.json"), "utf8")
|
||||
readFileSync(join(this.appRoot, "templates.json"), "utf8")
|
||||
) as UsageTemplate[];
|
||||
|
||||
public getTemplates(): UsageTemplate[] {
|
||||
|
||||
Reference in New Issue
Block a user