@ng-doc/builder
Version:
<!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/ng-doc/ng-doc"> <img src="https://ng-doc.com/assets/images/ng-doc.svg?raw=true" alt="Logo" height="150px"> </a>
24 lines • 973 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadConfig = loadConfig;
const cosmiconfig_1 = require("cosmiconfig");
const cosmiconfig_typescript_loader_1 = require("cosmiconfig-typescript-loader");
/**
* Loads configuration from global configuration file
* @param path - Path to the configuration file
* @param search - Whether to search for the configuration file or not
*/
function loadConfig(path, search = true) {
const moduleName = 'ng-doc';
const explorerSync = (0, cosmiconfig_1.cosmiconfigSync)(moduleName, {
searchPlaces: [`${moduleName}.config.ts`, `${moduleName}.config.js`],
loaders: {
'.ts': (0, cosmiconfig_typescript_loader_1.TypeScriptLoader)(),
},
});
const searchedFor = search
? explorerSync.search(path)
: explorerSync.load(path);
return [searchedFor?.filepath ?? '', searchedFor?.config ?? {}];
}
//# sourceMappingURL=load-config.js.map
;