What does your plugin development environment/workflow look like?
-
Here's how I do it:
- setup mongo
- setup node v6,
npm i npm@4
so it doesn't usenpm@5
, cuz that breaks nodebb - create
dev
directory in home folder git clone https://github.com/nodebb/nodebb
, clones into~/dev/nodebb
git clone https://github.com/nodebb/nodebb-plugin-emoji
, clones into~/dev/nodebb-plugin-emoji
cd nodebb-plugin-emoji
,npm link
cd ../nodebb
,npm install
,./nodebb setup
npm link nodebb-plugin-emoji
, this "links" the plugin into node_modules, which is better than having the git repo directly inside node_modules- setup vscode to automatically build plugin, build nodebb, and run nodebb when debugging
-
@pitaj Wow, thanks for the exhaustive instructions.
Do you really have to rebuild after every change though? In my limited experience developing Node apps, I'm usually been able to use vagrant + synced folders so that I could make a change on my desktop, sync it over to my vagrant box automatically, and the change taking effect immediately.
Is that kind of workflow not possible with nodeBB?
-
Some things you do, some things you don't. It's complicated.
-
@wfsaxton We use
grunt
to listen for file changes and rebuild automatically. You could consider that as wellThe reason why re-building is necessary is because some items are built once before you start NodeBB, and used from then onwards. This blog post goes into more detail about why we use a build system now.
-
@GarrettBryan mostly. Updated instructions:
Here's how I do it:
- setup mongo
- setup node v10, no npm changes necessary
cd ~
,mkdir dev
,cd dev
git clone https://github.com/nodebb/nodebb
, clones into~/dev/nodebb
git clone https://github.com/nodebb/nodebb-plugin-emoji
, clones into~/dev/nodebb-plugin-emoji
cd nodebb-plugin-emoji
,npm link
cd ../nodebb
,./nodebb setup
npm link nodebb-plugin-emoji
, this "links" the plugin into node_modules, which is better than having the git repo directly inside node_modules- setup vscode to automatically build plugin, build nodebb, and run nodebb when debugging
-
Thanks @PitaJ ! I use Atom and Sublime Text2. Any suggestions for debugging?
-
@GarrettBryan well I strongly suggest VS Code as it's essentially Atom but better in every way. It has a built in debugger and everything.
Beyond that, can't help you. I suggest you Google it.