2.0 Compatible Plugins
-
Not really a breaking change (yet), but the module definitions in plugin.json are kinda, odd...
I would expect the key to be the module name, but it's actually the filename. That makes sense in RJS world, where the file name needs to end in .js, but not so much in plugin.json world. You end up with this weirdness:
https://github.com/NodeBB/NodeBB/blob/master/src/meta/js.js#L90-L113Where you could just use the module name and add the .js in the build step:
https://github.com/NodeBB/NodeBB/blob/master/src/meta/js.js#L178
destPath: path.join(__dirname, '../../build/public/src/modules', relPath + ".js"),
It would make this more readable too since both the json and js would use the string 'jquery'.
https://docs.nodebb.org/development/plugins/libraries/Yes, I am very nit-picky.
-
@yariplus That's good feedback, and yes, it is an unfortunate artefact of our RJS implementation.
I even remember the headspace I was in that day... I had implemented the
modules
logic and my brain was basically scrambled egg at that point, since for whatever reason I can never wrap my head around module loaders. I ended up with an implementation that worked, and called it quits. That's likely why the key is a relative path, simply appended to the base directory (and resolved if needed, to get rid of../
, etc.), and ends in js. They're symlinks, and so I needed to build an absolute path out of them.Webpack upends this behaviour, so it's no longer necessary, so it's something we can consider. If anything, we can just make the
.js
suffix optional, and check for.js
and.min.js
if no extension is passed in. -
Out of the top 30 plugins requested via nbbpm, the following are not in the list at top:
- nodebb-plugin-category-notifications (@baris done)
- nodebb-plugin-embed (which @crazycells mentioned above)
- nodebb-plugin-discord-notification (https://github.com/amargon/nodebb-plugin-discord-notification/pull/12)
- nodebb-plugin-emoji-apple
- nodebb-plugin-adsense (@baris done)
-
maybe this :
GitHub - dealbee/nodebb-plugin-user-level: A plugin to add user level
A plugin to add user level. Contribute to dealbee/nodebb-plugin-user-level development by creating an account on GitHub.
GitHub (github.com)
-
This one by @exodo would be fantastic
https://github.com/exo-do/nodebb-plugin-reputation-rules -
@baris There seems to be an error in
nodebb-plugin-polls
as below2022-03-08T17:38:48.973Z [4567/50454] - error: [build] requirejs modules build failed 2022-03-08T17:38:48.973Z [4567/50454] - error: [build] Encountered error during build step Error: ENOENT: no such file or directory, stat '/home/sudonix/nodebb/node_modules/nodebb-plugin-poll/vendor/dayjs.min.js' 2022-03-08T17:38:48.973Z [4567/50454] - error: admin.reload Error: ENOENT: no such file or directory, stat '/home/sudonix/nodebb/node_modules/nodebb-plugin-poll/vendor/dayjs.min.js'
-
Is there a branch we can test against?
-
app.require('benchpress')
Error: Cannot find module './benchpress'
-
@yariplus Hmm yeah requiring benchpress at runtime like that isn't supported. What are you trying to do? Usually you can require it in your module at the top as usual or use
app.parseAndTranslate
without requiring benchpress directly. -
@yariplus Where are you using the
app.require('bootbox')
call? If you are writing some client side or admin side code, you can just require them at the top of your file without usingapp.require
app.require can only require core and plugin modules that are inbuild/public/src/modules
and is meant to be used from widgets or custom JS tab. -