symptom
While working on the calendar plugin, I've tried to deploy a wiki from npm scopes. I've published my forks as:
@dobbse/wiki@v0.12.1-e
@dobbse/wiki-plugin-calendar@v0.2.3-a
My custom wiki modifies package.json to point to my custom wiki-plugin-calendar. All the interesting stuff is in calendar.
Wiki does not find my plugin when installed this way:
$ npm install @dobbse/wiki@v0.12.1-e
I see that npm does install the scoped plugin:
$ find node_modules -type d -name wiki-plugin-calendar
node_modules/@dobbse/wiki/node_modules/@dobbse/wiki-plugin-calendar
wiki --version finds these plugins that start with c, notably excluding calendar:
$ wiki --version | grep plugin-c
wiki-plugin-calculator: 0.2.2
wiki-plugin-changes: 0.2.5
wiki-plugin-chart: 0.3.2
wiki-plugin-code: 0.2.2
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
# starting at line 110:
config = cc(argv,
...
cc.env('wiki_'),
...
packageDir: path.resolve(path.join(__dirname, 'node_modules'))
# a little later on line 142:
glob 'wiki-plugin-*', {cwd: config.packageDir}, (e, plugins) ->
Here we see that --version searches config.packageDir for folders starting with wiki-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:
require('./package').dependencies.keys.reduce(
((acc, name) -> acc[name] = require(name).version),
{}
)
other things I notice
-
This area of code has been through some other issues:
-
Plugin management really wants to live in plugmatic.
- Maintaining a Custom Wiki mentions:
"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.
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
wikimodifiespackage.jsonto 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 --versionfinds these plugins that start with c, notably excluding calendar:cause
npm installputs my scoped package into a scoped directory tree which fails to match the filesystem glob that searches for plugins on disk.In
cli.coffeeHere we see that
--versionsearchesconfig.packageDirfor folders starting withwiki-plugin-. My scoped package landed in@dobbse/wiki-plugin-calendar.The
@dobbsescope hides my plugin from--version, and presumably from other places too.potential remedy
I propose to inspect
package.jsoninstead 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.