0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00
verdaccio/website/versioned_docs/version-5.x/dev-plugins.md
Juan Picado 3d158a195a
chore(website): plugin search ui (#3539)
* chore: plugin search ui

chore: progress

chore: format code

chore: progress

chore: @verdaccio-ui/copy-clipboard

chore: search finish

* chore: ui-components

* Update ToolList.tsx

* xss protection

* Update static-data.yml

* Update AddonCard.tsx
2022-12-25 18:48:18 +01:00

1.8 KiB

id title
dev-plugins Developing Plugins

There are many ways to extend verdaccio, the kind of plugins supported are:

We recommend developing plugins using our TypeScript type definitions.

Other plugins

The following plugins are valid and in process of incubation.

Theme Plugin

The plugin must return a function that returns a string. The string should be the absolute location of the root of your user interface.

API

const path = require('path');

module.exports = (...arguments) => {
  return path.join(__dirname, 'static');
};

It is imporant that the name of the plugin must start with verdaccio-theme- prefix.

Theme Example

Filter Plugin

Since 4.1.0

Filter plugins were introduced due a request in order to be able to filter metadata from uplinks.

More info in the PR.

filters:
  storage-filter-blackwhitelist:
    filter_file: /path/to/file

API

The method filter_metadata will allow you to filter metadata that comes from any uplink, it is Promise based and has to return the same metadata modified.

Do not remove properties from the metadata, try to do not mutate rather return a new object.

interface IPluginStorageFilter<T> extends IPlugin<T> {
	filter_metadata(packageInfo: Package): Promise<Package>;
}