npm should manage the project as a whole rather than automating it for each plugin. This allows npm features such as dedupe to work
Wallace should scan for npm modules that list a compatible wallace version as a peer dependency, these can be loaded directly rather than from the directory.
Rather than having a npm postinstall script go through all the plugin folders, it would probably be better to list out the plugins needing dependencies in the package.json. npm should then copy the plugins from the plugin directory into the node_modules.
The old folder loading code can be kept, but plugins loaded this way will not have their npm dependencies installed automatically anymore.
If an identical npm module is found to one that's in a plugin folder, prioritise the npm module unless the bot is in dev mode.
Two issues, can be solved in one go:
Rather than having a npm postinstall script go through all the plugin folders, it would probably be better to list out the plugins needing dependencies in the package.json. npm should then copy the plugins from the plugin directory into the node_modules.
The old folder loading code can be kept, but plugins loaded this way will not have their npm dependencies installed automatically anymore.
If an identical npm module is found to one that's in a plugin folder, prioritise the npm module unless the bot is in dev mode.