danielsitek/tateru-cli

View on GitHub
src/utils/getTemplateFile.ts

Summary

Maintainability
A
2 hrs
Test Coverage
import fs from 'fs';
import path from 'path';


export const getTemplateFile = (templateBase: string, templateFilePath: string): string => {
    const templateFileSrc = path.resolve(templateBase, templateFilePath);

    if (!fs.existsSync(templateFileSrc)) {
        throw new Error(`Cannot load template file ${templateFileSrc}`);
    }

    return templateFileSrc;
};