1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var path = require("path");
|
4 | var glob = require("glob");
|
5 | var fs = require("fs");
|
6 | var graphql_codegen_core_1 = require("graphql-codegen-core");
|
7 | function 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 | }
|
18 | exports.scanForTemplatesInPath = scanForTemplatesInPath;
|
19 |
|
\ | No newline at end of file |