2021-03-06 12:56:45 -05:00
|
|
|
import { Application } from 'express';
|
2021-10-29 10:33:05 -05:00
|
|
|
import path from 'path';
|
2021-03-06 12:56:45 -05:00
|
|
|
|
2022-03-27 14:42:52 -05:00
|
|
|
import apiMiddleware from '@verdaccio/api';
|
|
|
|
import { parseConfigFile } from '@verdaccio/config';
|
2021-03-06 12:56:45 -05:00
|
|
|
import { setup } from '@verdaccio/logger';
|
2021-10-29 10:33:05 -05:00
|
|
|
import { Storage } from '@verdaccio/store';
|
2022-03-27 14:42:52 -05:00
|
|
|
import { initializeServer as initializeServerHelper } from '@verdaccio/test-helper';
|
2021-10-29 10:33:05 -05:00
|
|
|
|
2021-03-06 12:56:45 -05:00
|
|
|
import routes from '../src';
|
|
|
|
|
2023-02-12 14:26:18 -05:00
|
|
|
setup({});
|
2021-03-06 12:56:45 -05:00
|
|
|
|
2022-03-27 14:42:52 -05:00
|
|
|
export const getConf = (configName: string) => {
|
2021-03-06 12:56:45 -05:00
|
|
|
const configPath = path.join(__dirname, 'config', configName);
|
|
|
|
return parseConfigFile(configPath);
|
|
|
|
};
|
|
|
|
|
2022-03-27 14:42:52 -05:00
|
|
|
// @deprecated
|
|
|
|
export async function initializeServer(configName): Promise<Application> {
|
2022-09-16 01:02:08 -05:00
|
|
|
return initializeServerHelper(
|
|
|
|
getConf(configName),
|
|
|
|
[apiMiddleware, { async: true, routes }],
|
|
|
|
Storage
|
|
|
|
);
|
2021-03-06 12:56:45 -05:00
|
|
|
}
|