1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00
verdaccio/.changeset/early-jokes-nail.md
Juan Picado 9fc2e79611
feat(plugin): improve plugin loader (#3370)
* feat(plugin): implement scope package support plugins

* feat(plugin): improve plugin loader

* chore: fix build

* chore: cover config path case

* chore: async ui thene plugin

* chore: store async plugin

* chore: refactor plugin loader auth

* feat: filter refactoring

* chore: remove old plugin loader

* chore: add changeset

* chore: add docs

* chore: refactor relative plugin loader

* Update user.jwt.spec.ts

* Update user.jwt.spec.ts
2022-09-16 08:02:08 +02:00

1.7 KiB

@verdaccio/api @verdaccio/auth @verdaccio/config @verdaccio/types @verdaccio/loaders @verdaccio/node-api verdaccio-audit verdaccio-auth-memory verdaccio-htpasswd @verdaccio/local-storage verdaccio-memory @verdaccio/server @verdaccio/server-fastify @verdaccio/store @verdaccio/test-helper customprefix-auth verdaccio @verdaccio/web
major major major major major major major major major major major major major major major major major major

feat(plugins): improve plugin loader

Changes

Features

// config.yaml
server:
  pluginPrefix: mycompany
middleware:
  audit:
      foo: 1

This configuration will look up for mycompany-audit instead Verdaccio-audit.

Breaking Changes

sinopia plugins

  • sinopia fallback support is removed, but can be restored using pluginPrefix

plugin filter

  • method rename filter_metadata->filterMetadata

Plugin constructor does not merge configs anymore https://github.com/verdaccio/verdaccio/issues/928

The plugin receives as first argument config, which represents the config of the plugin. Example:

// config.yaml
auth:
  plugin:
     foo: 1
     bar: 2

export class Plugin<T> {
  public constructor(config: T, options: PluginOptions) {
    console.log(config);
    // {foo:1, bar: 2}
 }
}