Closed JamesRamm closed 8 years ago
There is now an option to install plugins in the plugin panel. This uses NPM under the hood, so plugins can be installed from the npm repository, github or a local tarball or a local directory with a package.json
MapThing will accept any folder as its' 'plugins' folder and scan the subdirs for
package.json
files. Any it finds, it will try to import as a plugin.This brings up the question of how a developer should deploy plugins? Three possible methods and their problems are:
npm install /path/to/local/package
when in the MapThing folder. However, this will install the plugin alongside all MapThings' other dependencies innode_modules
- if mapthing were to scan that directory it would try to import many non-plugins. The way around this is to runnpm install /path/to/local/package -g --prefix /path/to/plugins
and it will install inpath/to/plugins/node_modules
. You can then set this path as the plugin path. The downside is it will duplicate dependencies between mapthing and its' plugins. This could bloat the distribution somewhat.npm link
? NPM link appears to make a symlink from some package to another folder: https://docs.npmjs.com/cli/link So, we could potentiallynpm install
the plugin as a normal node package in the mapthingnode_modules
folder, then usenpm link
to symlink plugin packages to the plugins folder.NPM link seems to be the best solution, although introduces a bit of work for a user to install a plugin.
It would be good if MapThing could do this behind the scenes - add the ability to
npm install
thennpm link
in a single step either from NPM repo or a local directory.