mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-02-21 07:29:37 +01:00
chore: update versions (#5094)
This commit is contained in:
parent
22c3455918
commit
96e0011655
6
.changeset/silent-tips-admire.md
Normal file
6
.changeset/silent-tips-admire.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
'@verdaccio/middleware': patch
|
||||
'@verdaccio/web': patch
|
||||
---
|
||||
|
||||
chore: export and constant on middleware
|
@ -1,3 +1,6 @@
|
||||
/**
|
||||
* Enum for web urls, used on the web middleware
|
||||
*/
|
||||
export enum WebUrls {
|
||||
sidebar_scopped_package = '/sidebar/:scope/:package',
|
||||
sidebar_package = '/sidebar/:package',
|
||||
@ -8,3 +11,12 @@ export enum WebUrls {
|
||||
search = '/search/:anything',
|
||||
reset_password = '/reset_password',
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum for web urls namespace, used on the web middleware
|
||||
*/
|
||||
export enum WebUrlsNamespace {
|
||||
root = '/-/verdaccio/',
|
||||
data = '/data/',
|
||||
sec = '/sec/',
|
||||
}
|
||||
|
@ -1 +1,2 @@
|
||||
export { default } from './middleware';
|
||||
export { default, PLUGIN_UI_PREFIX, DEFAULT_PLUGIN_UI_THEME } from './middleware';
|
||||
export * from './web-utils';
|
||||
|
@ -8,6 +8,9 @@ import { webMiddleware } from '@verdaccio/middleware';
|
||||
|
||||
import webEndpointsApi from './api';
|
||||
|
||||
export const PLUGIN_UI_PREFIX = 'verdaccio-theme';
|
||||
export const DEFAULT_PLUGIN_UI_THEME = '@verdaccio/ui-theme';
|
||||
|
||||
export async function loadTheme(config: any) {
|
||||
if (_.isNil(config.theme) === false) {
|
||||
const plugin = await asyncLoadPlugin(
|
||||
@ -16,14 +19,14 @@ export async function loadTheme(config: any) {
|
||||
// TODO: add types { staticPath: string; manifest: unknown; manifestFiles: unknown }
|
||||
function (plugin: any) {
|
||||
/**
|
||||
*
|
||||
*
|
||||
- `staticPath`: is the same data returned in Verdaccio 5.
|
||||
- `manifest`: A webpack manifest object.
|
||||
- `manifestFiles`: A object with one property `js` and the array (order matters) of the manifest id to be loaded in the template dynamically.
|
||||
*/
|
||||
return plugin.staticPath && plugin.manifest && plugin.manifestFiles;
|
||||
},
|
||||
config?.serverSettings?.pluginPrefix ?? 'verdaccio-theme',
|
||||
config?.serverSettings?.pluginPrefix ?? PLUGIN_UI_PREFIX,
|
||||
PLUGIN_CATEGORY.THEME
|
||||
);
|
||||
if (plugin.length > 1) {
|
||||
@ -37,9 +40,9 @@ export async function loadTheme(config: any) {
|
||||
export default async (config, auth, storage, logger) => {
|
||||
let pluginOptions = await loadTheme(config);
|
||||
if (!pluginOptions) {
|
||||
pluginOptions = require('@verdaccio/ui-theme')(config.web);
|
||||
pluginOptions = require(DEFAULT_PLUGIN_UI_THEME)(config.web);
|
||||
logger.info(
|
||||
{ name: '@verdaccio/ui-theme', pluginCategory: PLUGIN_CATEGORY.THEME },
|
||||
{ name: DEFAULT_PLUGIN_UI_THEME, pluginCategory: PLUGIN_CATEGORY.THEME },
|
||||
'plugin @{name} successfully loaded (@{pluginCategory})'
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user