0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00
verdaccio/packages/store/test/helpers.ts

23 lines
672 B
TypeScript
Raw Normal View History

import buildDebug from 'debug';
import path from 'path';
import { parseConfigFile } from '@verdaccio/config';
const debug = buildDebug('verdaccio:mock:config');
/**
* Override the default.yaml configuration file with any new config provided.
*/
function configExample(externalConfig: any = {}, configFile?: string, location?: string) {
let config = {};
if (location && configFile) {
const locationFile = path.join(location, configFile);
debug('config location: %s', locationFile);
config = parseConfigFile(locationFile);
debug('config file: %o', JSON.stringify(config));
}
return { ...externalConfig, ...config };
}
export { configExample };