UNPKG

970 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var path = require("path");
4var glob = require("glob");
5var fs = require("fs");
6var graphql_codegen_core_1 = require("graphql-codegen-core");
7function scanForTemplatesInPath(dirPath, fileExtensions) {
8 var absolutePath = path.resolve(process.cwd(), dirPath);
9 var globPattern = absolutePath + "/**/*.@(" + fileExtensions.join('|') + ")";
10 graphql_codegen_core_1.debugLog("[scanForTemplatesInPath] Scanning for templates using glob pattern: " + globPattern);
11 var results = glob.sync(globPattern);
12 graphql_codegen_core_1.debugLog("[scanForTemplatesInPath] Got results from glob: ", results);
13 return results.reduce(function (prev, filePath) {
14 prev[filePath.substr(absolutePath.length + 1)] = fs.readFileSync(filePath).toString();
15 return prev;
16 }, {});
17}
18exports.scanForTemplatesInPath = scanForTemplatesInPath;
19//# sourceMappingURL=templates-scanner.js.map
\No newline at end of file