Yeah nodebb plugins are npm modules so they need to have a package.json file. The plugin.json file is just for nodebb.
Are there any plans to allow privately hosted modules to be accessed as plugins?
I realise this may go against the grain in terms of the open source approach of the development, but there are some elements to the code which are business sensitive, so it will not be possible to have them in the public domain.
If I've grasped what you mean, you can use private npm or a private github account to create plugins that no one else can see...
With privately hosted modules, they are brought into the project under node_modules/@<npmAccountName>
The admin console doesn't seem to recognise plugins which aren't directly in the node_modules folder. In plugins.js it sets the plugin path as "var npmPluginPath = path.join(__dirname, '../node_modules');" and there's no recursion to look any deeper in the structure.
Would it be possible to add a check in here for any folders beginning with '@' to indicate privately hosted modules, then call itself to check for any plugins?
jarey last edited by
@snodejoke you can locate you priveçate plugins under node_modules without having to publish then on npm. You can still manage the on the ACP of nodebb (enabling, disabling etc).
I'm looking to host the modules on private npm, along with the other modules we have for the wider project, for ease of maintenance and working with the team.
I'm assuming there is no way to currently activate plugins which are not directly in the node_modules then? Unless I'm misreading something...
I haven't tried this, but I'm pretty sure you can just create or clone a plugin into the node_modules folder, but you have to prefix the folder name with nodebb-plugin-<your plugin name>. Just try not to clash it with existing plugin names... You can host the source anywhere including a private Github repo, effectively keeping your private business details private.
It might be a bit more trouble to set up a private npm repo and have nodebb pull from that npm in addition to the public one
@snodejoke As others have mentioned, we don't have a private npm account to test with, and as you've discovered by looking in the code, we don't support this at the moment.
Would be nice to, if it doesn't complicate the codebase to recurse through all folders...
How about doing a symlink?
ln -s node_modules/@account/nodebb-plugin-xyz node_modules/nodebb-plugin-xyz
@julian Sorry, hadn't seen that you hadn't got a private npm account to play around with!
@psychobunny That's a really good idea, it's actually how I've been testing separate projects that use my privately hosted modules currently, before publishing the updates to the npm account.
It would be great if support came out the box at some point though