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