-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbindSchema.js
More file actions
31 lines (25 loc) · 728 Bytes
/
Copy pathbindSchema.js
File metadata and controls
31 lines (25 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Bring all schemas by directory discovery/scan and compile them for the export
const path = require("path");
const fs = require("fs");
let schemaDir = path.resolve(__dirname, "schemas");
let queriesDir = path.resolve(__dirname, "queries");
let schemaFiles = fs.readdirSync(schemaDir);
let queryFiles = fs.readdirSync(queriesDir);
let schema = schemaFiles.reduce(function (prev, curr) {
return prev.concat(
fs.readFileSync(path.resolve(schemaDir, curr), {
encoding: "utf8",
})
);
}, "");
let query = queryFiles.reduce(function (prev, curr) {
return prev.concat(
fs.readFileSync(path.resolve(queriesDir, curr), {
encoding: "utf8",
})
);
}, "");
module.exports = {
schema,
query,
};