`./nodebb build` build only one plugin
-
Is there a way to have
./nodebb build
only build a specific plugin's content and inject its JS library into NodeBB?(and better yet, separate those two out, one build task to only build content (which case does not even need NodeBB restart) and another to inject JS library)
I don't know if this a lot to ask for, but it would greatly accelerate my cycles, build is something I can run a couple times per minute when iterating quickly, even shaving 4-5 seconds off it would actually mean a lot to me.
-
Have you tried the grunt flow?
-
Nope, here is what I found googling "nodebb grunt flow":
https://github.com/NodeBB-Community/nodebb-grunt/wiki/WorkflowI'm a little bit lost there too, so could use a bit more documentation if available
With that
node-grunt
repo, do I clone it inside NodeBB repo? Also, what is ag
module? I suppose it is a grunt-like module (which decides which files to keep track of for you basically?)Anyway, if possible please point me to some more docs.
Here is my workflow: I do my NodeBB plugin work in another repo, whenever I wonna test, I simply run a script that copies everything to
nodebb/node_modules/nodebb-plugin-my-plugin
and runs a./nodebb build
This honestly serves me well, I just wonder if its possible (or even feasible) to do something like
./nodebb build plugin my-plugin
-
https://docs.nodebb.org/development/#grunt is whati was talking about. Essentially, install it with
npm i -g grunt
and then rungrunt
which will both build stuff whenever anything changes, and run and restart the NodeBB server automatically.Instead of copying into node_modules, you can use npm link.
-
I would use npm link but as I mentioned I work with a separate repo, which includes other code and is organized differently than a nodebb-plugin npm module. So my script is a bit more complex than just "copy a directory" over.
However, npm link essentially does symlinks so it would make sense to convert my script to symlink everything instead of copy. So thank you for this!
Last question about grunt, going back to the original topic, would it just:
run
grunt
which will both build stuff whenever anything changes, and run and restart the NodeBB server automatically.or would it actually trigger only "sub-builds" (ie, only build a certain plugin and nothing else) ?
Thanks
-
Finally, regardless of grunt, according to this:
https://docs.nodebb.org/development/#selective-building-of-assets
./nodebb build
does support selective building, but the link in the doc above "The full list is can be found in the codebase itself." is not helpful Is there a better link for a full list?Thank you!
-
would it actually trigger only "sub-builds" (ie, only build a certain plugin and nothing else) ?
The build system only supports building by type: js, CSS, etc. It doesn't support building by plugin since NodeBB builds bundled files per format. Grunt will detect what kind of build needs to be done, and run that.
You can run
./nodebb help build
to see all the options, but there isn't an option to only build select plugins.