UNPKG

@yandex/themekit

Version:

Build system of design-tokens for any platforms

23 lines (22 loc) 697 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.loadConfig = void 0; const glob_1 = require("./glob"); const errors_1 = require("./errors"); const file_reader_1 = require("./file-reader"); /** * Loads config with one of available extensions (js, json, yaml). * * @param path - Config path. * @returns Config. */ function loadConfig(path) { // Use glob for get config with one of available extensions. const [configPath] = glob_1.glob(path); if (configPath === undefined) { throw new errors_1.NotFoundConfig(configPath); } const config = file_reader_1.readFile(configPath); return config; } exports.loadConfig = loadConfig;