@simulacrum/github-api-simulator
Version:
Provides common functionality to frontend app and plugins.
23 lines • 953 B
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSchema = getSchema;
const path_1 = __importDefault(require("path"));
const fs_1 = __importDefault(require("fs"));
const schemaDefaults = [
"schema.docs-enterprise.graphql",
"schema.docs.graphql",
"api.github.com.json",
];
function getSchema(schemaFile) {
let root = path_1.default.join(__dirname, "..").endsWith("dist")
? path_1.default.join(__dirname, "..", "..")
: path_1.default.join(__dirname, "..");
const fileString = fs_1.default.readFileSync(schemaDefaults.includes(schemaFile)
? path_1.default.join(root, "schema", schemaFile)
: schemaFile, "utf-8");
return schemaFile.endsWith(".json") ? JSON.parse(fileString) : fileString;
}
//# sourceMappingURL=utils.js.map
;