declarapi
Version:
Declarative API generation
16 lines • 565 B
JavaScript
import { promises as fs } from 'fs';
import path from 'path';
export const loadJSON = async (path) => {
return JSON.parse(await fs.readFile(path, { encoding: 'utf8' }));
};
// This is required for both es6 and commonjs support
if (!(global === null || global === void 0 ? void 0 : global['__dirname'])) {
global.__dirname = undefined;
}
export const baseSchemaLocation = async () => {
if (!__dirname) {
return (await import('./url.js')).es6SchemaLocation;
}
return path.join(__dirname, '/../schema/');
};
//# sourceMappingURL=util.js.map