Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow scopes in loading plugins #1867

Closed
IhToN opened this issue Jul 8, 2020 · 9 comments · Fixed by #3227
Closed

feat: allow scopes in loading plugins #1867

IhToN opened this issue Jul 8, 2020 · 9 comments · Fixed by #3227

Comments

@IhToN
Copy link

IhToN commented Jul 8, 2020

Describe the bug
Verdaccio is not able to load @verdaccio/active-directory plugin when using the config setup from the documentation.

To Reproduce
Install @verdaccio/active-directory
Set the proper config file
Retrieve error: verdaccio-activedirectory plugin not found. try "npm install verdaccio-activedirectory"

Expected behavior
Get the plugin to load

If we install the verdaccio-activedirectory package it works as intended, it looks like Verdaccio is not able to load or retrieve the plugin from the @verdaccio scope.

@IhToN IhToN changed the title @verdaccio/active-directory: Couldn @verdaccio/active-directory: plugin not found Jul 8, 2020
@sergiohgz
Copy link
Member

Sorry, at the moment, Verdaccio is not able to load plugins whose name is @verdaccio/plugin-name. This is a feature we are planning

@IhToN
Copy link
Author

IhToN commented Jul 8, 2020

Thanks for the answer. We will stay with the old package for now =)

@juanpicado juanpicado transferred this issue from verdaccio/monorepo Jul 8, 2020
@juanpicado juanpicado added this to the 5.x.x milestone Jul 8, 2020
@juanpicado juanpicado changed the title @verdaccio/active-directory: plugin not found feat: allow scopes in loading plugins Jul 8, 2020
@juanpicado
Copy link
Member

On the roadmap ;-) @IhToN

Could be added to 4.x if someones pick it up.

@IhToN
Copy link
Author

IhToN commented Jul 8, 2020

After some after-work investigations I found that it was possible to reference the plugin name directly on the config.yaml file, example:

auth:
  '@verdaccio/active-directory':

In any case I've added a new condition after verdaccio- and sinopia- prefixes it'll try to load @verdaccio/ prefix.

It also changes the Plugin successfully loaded message to follow this structure:
Plugin successfully loaded: @verdaccio/active-directory || From: locally installed plugin

From can be: external plugin folder, locally installed plugin and config folder

@juanpicado juanpicado linked a pull request Jul 8, 2020 that will close this issue
@juanpicado
Copy link
Member

@IhToN one suggestion, this is something I've been thinking for a while .. what if .... the prefix is configurable ... ? I mean, nobody could publish under verdaccio scope at npmjs, so the feature would have limited use cases.

I'd suggest a new configuration parameter:

plugin_prefix: 'whatever` 

Then we could override the default here:

export default function loadPlugin<T extends IPlugin<T>>(
  config: Config,
  pluginConfigs: any = {},
  params: any,
  sanityCheck: any,
  prefix: string = 'verdaccio'
): any[] {

That will solve your issue and you wouldn't have to do this

auth:
  '@verdaccio/active-directory':

rather a default configuration

plugin_prefix: '@verdaccio` 
auth:
  active-directory:

This scalable for private plugins :) for all needs.

what do you think?

@IhToN
Copy link
Author

IhToN commented Jul 9, 2020

@juanpicado That would be another possibility but then we would still have the struggle that it may be that different plugins have different prefixes.

If we have the packages

@verdaccio/active-directory
verdaccio-htpasswd
@foo/bar
@zoo/bar
@joo/bar

the problem will persist, and for the end user it will be simplier just to use the full plugin name.

The way it is right now it's kind of a way to have "official" plugins (@verdaccio/, verdaccio- and sinopia-) and it would still let the end user include an infinite amount of plugins wihtout problems.

It may be needed to document properly how the plugin loading works though.

@stale
Copy link

stale bot commented Jul 21, 2021

Hi pal 👋🏼!
This issue has gone quiet 😶.

We get a lot of issues, so we currently close issues after 180 days of inactivity. It’s been at least 90c days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add/suggest the label "discuss" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out https://github.com/verdaccio/contributing for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Verdaccio community! 💘

@stale stale bot added the issue: wontfix label Jul 21, 2021
@juanpicado
Copy link
Member

juanpicado commented Jun 13, 2022

A workaround for this is here using Docker https://github.com/xlts-dev/verdaccio-prometheus-middleware#installation

@juanpicado
Copy link
Member

#3227

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants