UNPKG

@openshift-console/dynamic-plugin-sdk-webpack

Version:

Provides webpack ConsoleRemotePlugin used to build all dynamic plugin assets.

17 lines (16 loc) 630 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.loadSchema = void 0; const fs = require("fs"); const path = require("path"); const findUp = require("find-up"); const loadSchema = (relativePath) => { const pkgDir = path.dirname(findUp.sync('package.json', { cwd: __dirname })); const schemaPath = [ path.resolve(pkgDir, 'schema'), path.resolve(pkgDir, 'generated/schema'), ].find((p) => fs.existsSync(p) && fs.statSync(p).isDirectory()); // eslint-disable-next-line return require(path.resolve(schemaPath, relativePath)); }; exports.loadSchema = loadSchema;