What does your plugin development environment/workflow look like?



  • Does anyone have any tips on setting up a proper plugin development environment? All the links I've found are at least 2 years old and I'm wondering if there is a "better" way of doing things.


  • Global Moderator

    Here's how I do it:

    1. setup mongo
    2. setup node v6, npm i npm@4 so it doesn't use npm@5, cuz that breaks nodebb
    3. create dev directory in home folder
    4. git clone https://github.com/nodebb/nodebb, clones into ~/dev/nodebb
    5. git clone https://github.com/nodebb/nodebb-plugin-emoji, clones into ~/dev/nodebb-plugin-emoji
    6. cd nodebb-plugin-emoji, npm link
    7. cd ../nodebb, npm install, ./nodebb setup
    8. npm link nodebb-plugin-emoji, this "links" the plugin into node_modules, which is better than having the git repo directly inside node_modules
    9. 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?


  • Global Moderator

    Some things you do, some things you don't. It's complicated.


  • Admin

    @wfsaxton We use grunt to listen for file changes and rebuild automatically. You could consider that as well 😄

    The 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.



  • @PitaJ are these instructions still accurate?


  • Global Moderator

    @GarrettBryan mostly. Updated instructions:

    Here's how I do it:

    1. setup mongo
    2. setup node v10, no npm changes necessary
    3. cd ~, mkdir dev, cd dev
    4. git clone https://github.com/nodebb/nodebb, clones into ~/dev/nodebb
    5. git clone https://github.com/nodebb/nodebb-plugin-emoji, clones into ~/dev/nodebb-plugin-emoji
    6. cd nodebb-plugin-emoji, npm link
    7. cd ../nodebb, ./nodebb setup
    8. npm link nodebb-plugin-emoji, this "links" the plugin into node_modules, which is better than having the git repo directly inside node_modules
    9. 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?


  • Global Moderator

    @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.



  • @PitaJ I just started with VS Code, thanks for the motivation to try something new.


 

Suggested Topics

| |