-
Notifications
You must be signed in to change notification settings - Fork 74
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
enabling npm scopes for plugins #106
Comments
wiki-server and others scan wiki/node_modules looking for wiki-plugin-* and uses what it finds in several ways. I don't recall all the ways but these are surely included:
I think all of these could be made to recognize namespaced plugins. Conflicts could be resolved by favoring larger version numbers with perhaps file date breaking ties. We would want to change all the places at once so good reconnaissance will be in order. We should consider version number suffixes at the same time but not necessarily applying the same methods. This is more a plugmatic issue than wiki-server I would think. |
A work-around might be to choose a slightly different name for your plugin while still obeying current conventions. There is certainly something unattractive about this when npm is trying so much harder. |
For my immediate calendar plugin development, I have found some docker-based work-arounds that loosely model the In this issue I'm thinking about the future wiki pages stewing in the back of my mind to recommend development of plugins and custom wikis. I really like the structure of npm packages and the many options the npm CLI offers for publishing and downloading packages: https://docs.npmjs.com/how-npm-works/packages My earliest experiment with calendar plugin used github urls in I found this issue while exploring the npm scoped publishing options. It may be easier to recommend github or tarball publishing instead of scoped npm publishing for plugin developers who want to share work in progress or build custom solutions. |
I have to add, I'm pretty fond of the idea of tarballing the plugins and serving them out of |
Wow. I love the idea of managing plugins as another class of assets. We have to think through the sharing logic to be sure we are not distributing viruses to unsuspecting site operators. One thing to remember, npm_modules is bound to the server while assets is bound to the site. As such, plugmatic requires admin privilege while site tooling, like flagmatic, requires only site ownership. I've tried to explore these issues in http://own.fed.wiki but may not have my metaphors right. |
There is some old discussion of this problem in fedwiki/wiki-server#107, and #59 I am not sure if the issue with scoped packages in npm, that I mention back in 2015, was ever solved. Not sure that I like the idea of using |
I heard mention at work yesterday of a "mini npm" which can proxy to the normal site and serve local content in front of it. I'll ask for more details because I couldn't find this on my own. |
Perhaps the simplest thing would be to improve plugmatic to safely and conveniently install from git repos directly. The markup would have to recognize this and somehow relate it to our more traditional sources, perhaps with a caution since plugmatic pages do get passed around. The win would be the ability to have colleagues experiment with new versions without publishing them in the standard repo. |
npm supports git urls in |
@paul90, thanks for pointing to the earlier PR and discussion. I've finally had a chance to review those more carefully. Not surprised this territory was covered rather throughly before. Even as I opened this issue I wondered if parsing I did also get time to experiment with my local, docker-based wiki and found that github names work fine with NPM. Here's my fork of That points to a branch in my fork of Works okay, but needs docs to explain how and why to compile the javascript and put it in a special branch. |
So, do you think we should adjust the code to find plugins within scoped packages? It would open another path for independent plugin development. Maybe not a big gain. It is not a small amount of work. |
I'll see if I can add git repos to plugmatic this weekend. It will be easier to figure out all of the consequences if we just start using it. Some things to think about:
|
Couldn't get started on this. Wrote some more thoughts instead. |
A possible alternative might be to use a private npm repository like sinopia - there is a section on override public packages which might be what you are looking for. I have not found anything more recent, though Ward had a recently conversation that mentioned something similar - but we couldn't find it when we looked yesterday. |
Sinopia work seems to have moved to https://github.com/verdaccio/verdaccio Following that thread taught me a fair bit about npm registry and configuration that I thought I'd move to wiki: |
I found the micro-npm server that is properly spelt unpm. https://www.npmjs.com/package/unpm The author, @hayes, has worked for us at New Relic which may be why we've employed this code. |
symptom
While working on the calendar plugin, I've tried to deploy a wiki from npm scopes. I've published my forks as:
My custom
wiki
modifiespackage.json
to point to my customwiki-plugin-calendar
. All the interesting stuff is in calendar.Wiki does not find my plugin when installed this way:
I see that npm does install the scoped plugin:
wiki --version
finds these plugins that start with c, notably excluding calendar:cause
npm install
puts my scoped package into a scoped directory tree which fails to match the filesystem glob that searches for plugins on disk.In
cli.coffee
Here we see that
--version
searchesconfig.packageDir
for folders starting withwiki-plugin-
. My scoped package landed in@dobbse/wiki-plugin-calendar
.The
@dobbse
scope hides my plugin from--version
, and presumably from other places too.potential remedy
I propose to inspect
package.json
instead of file globbing.Something like this would work for
--version
, though similar changes are needed elsewhere:other things I notice
This area of code has been through some other issues:
wiki: Move cli/farm into wiki-node
wiki-server: Move cli/farm to wiki-node
wiki-server: more specific annotation of json
Plugin management really wants to live in plugmatic.
"Warning: This workflow has proven to be unreliable and will be replaced by plugin support within wiki. It is left here for historical reference. See About Plugmatic Plugin"
There's a good chance I haven't discovered all the things tugging on this code, and warrants futher discussion.
The text was updated successfully, but these errors were encountered: