How to guide for writing your first plugin
-
@termnml said:
PS: How to enter CodeBlock ? XD
4 spaces like this:
{ "name": "nodebb-plugin-yourname", "version": "0.0.1", "description": "NodeBB plugin", "main": "library.js" }
Or wrap it with
```
top and bottom, like this{ "name": "nodebb-plugin-yourname", "version": "0.0.1", "description": "NodeBB plugin", "main": "library.js" }
Quote my post to see the formatting.
-
@a_5mith said:
@termnml said:
PS: How to enter CodeBlock ? XD
4 spaces like this:
{ "name": "nodebb-plugin-yourname", "version": "0.0.1", "description": "NodeBB plugin", "main": "library.js" }
Or wrap it with
```
top and bottom, like this{ "name": "nodebb-plugin-yourname", "version": "0.0.1", "description": "NodeBB plugin", "main": "library.js" }
Quote my post to see the formatting.
Ha. Thx.
-
I tried following this, and I can't even get the basic "hello, world" logging.
nobebb/node_modules/nodebb-plugin-json-auth/package.json
{ "id": "nodebb-plugin-json-auth", "version": "0.0.1", "name": "NodeBB JSON remote Authentication", "description": "Replaces NodeBB login with a remote location.", "library": "./library.js" }
nobebb/node_modules/nodebb-plugin-json-auth/library.js
console.log('hello, world!');
When I look in Advanced > Logs I can see the "reloading..." and such logged, but there is no "hello, world!". It doesn't appear in Extend > Plugins, either.
-
-
The doc is over two years old. so does contain out of date info.
Refer to the documentation, it'll likely be more up to date. Link to Documentation
-
@a_5mith said:
The doc is over two years old. so does contain out of date info.
Refer to the documentation, it'll likely be more up to date. Link to Documentation
That's where I found that to begin with. It didn't mention needing a package.json https://docs.nodebb.org/en/latest/plugins/create.html so that needs to be added.
-
This post is deleted!
-
I created a very simple skeleton plugin for reference that works as of NodeBB 0.7.2 https://github.com/jongarrison/nodebb-plugin-skeleton
-
I should also mention that this includes instructions on how to use 'npm link' to use a plugin that is under development.
-
Here is another thing that would be good for new plugin devs to find early on...
GitHub - NodeBB/nodebb-plugin-quickstart: A starter kit for quickly creating NodeBB plugins.
A starter kit for quickly creating NodeBB plugins. - NodeBB/nodebb-plugin-quickstart
GitHub (github.com)
Maybe this thread is getting kind of old and shouldn't be pinned any more. When I was starting out trying to develop some plugins it lead me down some odd roads. It is good to see where all of the active community members get their start though
-
Good point. Unpinned, this is pretty damn old haha.