NodeBB Grunt


  • GNU/Linux

    Hey folks,

    I've just released 1.0.0 of my completely reworked grunt setup for NodeBB module development.

    See nodebb-grunt.

    If you remember this one you'll be happy to hear that I'm not used to CoffeeScript anymore.
    The rework allows you to simply:tm: define custom compilation steps and guides you on the way to a new plugin/module - currently only a basic plugin setup is shipped.

    One important (to me) compilation step is the meta-replace. Means every occurrences of @{...} within certain files get replaced with the respective meta data (either from within package.json or .meta.json or from some pre-defined values, details are planned for the wiki).
    So one might write "@{version}" within source code and it gets resolved to sth. like "0.1.0+12".
    This is useful for preventing meta-data to be defined on multiple places. Everything only needs to be defined once.

    In combination with the pre-defined meta @{env} which resolves to development or distribution, depending on which grunt task got run, this is a powerful feature. You can simply enable debugging for your development workflow without the need to care about disabling it anytime you want to publish.

    It might still have a few glitches, but the main functionality is working so far.

    I hope (with some more shipped module setups, etc.) it could help many fellows out there developing NodeBB modules.
    And maybe I'll get it to be the standard environment for the NodeBB Community Projects :-)
    At least it's pretty helpful for myself developing modules (even so it didn't pay off the work I put into it yet :seedling: ).

    Some notes:

    • The ./g bash script is undocumented within repository yet, see the source for usage information.
    • I'd be happy to merge (I don't add others to the team yet, needs proof of code quality etc.) any PRs regarding module setups (e.g. themes) which should match the structure of the shipped plugin setup (e.g. use of @{...} where appropriate)
      • Some guides are going to get into the wiki soon, so wait for it...
    • Since I just use JSHint, I'd be happy to accept PRs regarding rc files (within setups/**/*) of JSLint, ESLint, JSCS, Closure Linter (alias GJSLint) which should be equivalent to the restrictions within the .jshintrc files
    • The restrictions within .jshintrc files (within setups/**/*) are open for discussion, so maybe wait a bit with the previous note.
    • I plan to try out typescript some time and would definitely add setups for this when I do so ;)
    • I'd be happy to receive any kind of feedback

    My workflow on nodebb-plugin-shortcuts for example has been minimized to

    1. ./g sh d - starts grunt dev:sh and grunt within NodeBB root
    2. do my work on the plugin, NodeBB refreshes automatically
    3. ./g sh e - triggers defined publish tasks (see config/publish.json)

  • Admin

    Does this mean we'll see a reworked emoji extended too? :laughing:


  • GNU/Linux

    @julian is planned ;)


  • Plugin & Theme Dev

    Awesome, this is really all I ever wanted for NodeBB plugin dev. Great work, I hope it will become the standard for all plugins to come :+1:


  • Admin

    @frissdiegurke said:

    @julian is planned ;)

    Yes please! I want to submit a design for the emoji plugin to make it awesome on both desktop and mobile (see: fb, slack, mobile interface) but coffeescript... :bus:


  • Admin

    Going to give this a run next time I build a plugin or theme, looking forward to it. Is livereload part of your future plans, I didn't see it in your docs


  • Admin

    Maybe I'm missing the point, but can't you do

    nconf.get("something")

    Instead of

    One important (to me) compilation step is the meta-replace. Means every occurrences of @{...} within certain files get replaced with the respective meta data (either from within package.json or .meta.json or from some pre-defined values, details are planned for the wiki).


  • GNU/Linux

    @psychobunny livereload would need to be triggered by the NodeBB core grunt task, since nodebb-grunt does only distribute the files for example into NodeBB/node_modules/nodebb-plugin-shortcuts/. From there on it relies on NodeBB Core grunt to notice those file changes and reload/restart NodeBB.
    So livereload would need to trigger when NodeBB is fully restarted.

    @psychobunny said:

    Maybe I'm missing the point, but can't you do

    nconf.get("something")

    Instead of

    One important (to me) compilation step is the meta-replace. Means every occurrences of @{...} within certain files get replaced with the respective meta data (either from within package.json or .meta.json or from some pre-defined values, details are planned for the wiki).

    • The compilation includes meta-data regarding the module without the need to nconf.file() at runtime.
    • The compilation works client-, server-side and everywhere else in your project (for example path names too) - as long as the files are matched by selectors within nodebb-grunt configuration.

  • Community Rep

    @frissdiegurke Are you moving away from coffeescript in general? or just for your nodebb plugins?


  • GNU/Linux

    @yariplus in general


  • Global Moderator


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.