@ng-doc/builder
Version:
<!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/ng-doc/ng-doc"> <img src="https://ng-doc.com/assets/images/ng-doc.svg?raw=true" alt="Logo" height="150px"> </a>
23 lines • 873 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildFileAsset = buildFileAsset;
const tslib_1 = require("tslib");
const fs = tslib_1.__importStar(require("fs"));
const variables_1 = require("../engine/variables");
const code_type_from_ext_1 = require("./code-type-from-ext");
/**
* Builds an asset from a file.
* @param filePath - The path to the file.
*/
function buildFileAsset(filePath) {
const fileContent = fs.readFileSync(filePath, 'utf8').trim();
const codeType = (0, code_type_from_ext_1.codeTypeFromExt)(filePath);
return {
title: codeType,
code: fileContent,
isEmpty: !fileContent,
filePath: variables_1.GLOBALS.relative(filePath),
lang: codeType.replace('TypeScript', 'angular-ts').replace('HTML', 'angular-html'),
};
}
//# sourceMappingURL=build-file-assets.js.map
;