Read templates relative to the root of project

Signed-off-by: Min Kim <minkimcello@gmail.com>
This commit is contained in:
Min Kim
2024-12-21 19:30:19 -05:00
parent 9b93f4dfd5
commit 06f2fd9a86
+4 -2
View File
@@ -68,10 +68,12 @@ export function verifyTemplate({ id, target }: TemplateLocation): Template {
if (target.startsWith('http')) {
throw new Error('Remote templates are not supported yet');
}
if (!fs.existsSync(target)) {
if (!fs.existsSync(paths.resolveTargetRoot(target))) {
throw new Error(`Your CLI template does not exist: ${target}`);
}
const template = parse(fs.readFileSync(target, 'utf-8'));
const template = parse(
fs.readFileSync(paths.resolveTargetRoot(target), 'utf-8'),
);
const templatePath = paths.resolveTargetRoot(
dirname(target),
template.template,