Skip to main content

插件开发

有很多种扩展 verdaccio的方法,支持的插件种类有:

我们建议使用flow类型定义来开发插件。

Other plugins

基本上我们必须用一个叫做authenticate的单一方法来返回一个object(对象),此方法将接收到3 个参数(user, password, callback)。

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. 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

要么是发生了糟糕的事,要么是授权不成功。

More info in the PR.

callback(null, false)

API

groups是用户组成的一组字符串。

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>;
}