0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-20 22:52:46 -05:00
verdaccio/packages/tools/mock/src/config.ts
Juan Picado a828271d63
refactor: fetch package endpoint and basic integration fastify (#2750)
* refactor: download manifest endpoint and integrate fastify

* fix file not found issue

* add temporary migration method to storage memory

* sanitize fs methods

* restore tests

* chore: restore sanitilize

will do later

* add tests

* add changeset

* lint

* trying something test

* chore: lint

* restore code

* fix e2e

* fix lint
2021-12-12 18:00:19 +01:00

26 lines
752 B
TypeScript

import buildDebug from 'debug';
import _ from 'lodash';
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 = {},
configFile: string = 'default.yaml',
location: string = ''
) {
const locationFile = location
? path.join(location, configFile)
: path.join(__dirname, `./config/yaml/${configFile}`);
debug('config location: %s', locationFile);
const config = parseConfigFile(locationFile);
debug('config file: %o', JSON.stringify(config));
return _.assign({}, _.cloneDeep(config), externalConfig);
}
export { configExample };