Problem with shoutbox plugin after 1.12.2 -> 1.13.0 nodebb upgrade

Plugin Development
  • Hello !

    I have a shoutbox plugin like this one :
    https://github.com/TheWorms/nodebb-plugin-shoutbox-cabane-libre

    It worked well on nodebb v1.12.2 but it fails on nodebb v1.13.0. There is no message on server logs but I see this in console on client :

    TypeError: Shoutbox.actions is undefined   nodebb.min.js:26976:4
    TypeError: Shoutbox.base is undefined     nodebb.min.js:26976:4
    

    Do you have an idea of what have changed on nodebb that gives this problem after its upgrade ? It seems that somme javascript code is not loaded on client now (?).

    Thanks for help !

  • Remark :

    unloaded things are in public/js/lib/ of this plugin which is declared in plugin.json as

    "scripts": [
        "public/js/loader.js",
        "public/js/lib/"
      ],
    

    Is it this thing that should be changed on nodebb 1.13.0 ? We must declare all js scripts explicitly and not only their folder ?

  • Well... js scripts are loaded when I put all their filenames in plugin.json like this :

      "scripts": [
        "public/js/loader.js",
        "public/js/lib/actions.js",
        "public/js/lib/base.js",
        "public/js/lib/commands.js",
        "public/js/lib/settings.js",
        "public/js/lib/sockets.js",
        "public/js/lib/utils.js",
        "public/js/lib/actions/bug.js",
        "public/js/lib/actions/default.js",
        "public/js/lib/actions/gist.js",
        "public/js/lib/actions/hide.js",
        "public/js/lib/actions/settings.js",
        "public/js/lib/commands/default.js"
      ],
    

    It doesn't work like on nodebb v1.12.2 when it was only necessary to put the folder path (like on my previous message).

    I don't know if it's intentional from nodebb developers or if it's a problem with a different origin... Mystery... ???

  • @alfazaz Did you try with the original https://github.com/Schamper/nodebb-plugin-shoutbox. Is it also failing?

  • @fais3000 I didn't tried this version which was behind for many commits I wanted from the cabane-Libre version. I made also own changes...

    It works now like I said : it's necessary to change "scripts" configuration with each filenames (it doesn't work since nodebb v1.13.0 with dirname).

  • @fais3000 I have this issue with the original on version v1.13.3. (Shoutbox.base is undefined)


Suggested Topics


  • 0 Votes
    1 Posts
    1k Views

    Hi guys,
    I used ./nodebb dev to develop my first plugin, everything worked smoothly, but when I activated it in production, the server didn't started at all with this error:

    nodebb[12835]: {"level":"error","message":"[meta/js] Could not compile nodebb.min.js: SyntaxError: Unexpected token: name (bool)","timestamp":"2016-11-22T18:24:25.854Z"} nodebb[12835]: {"message":"SyntaxError: Unexpected token: name (bool)","stack":"Error: SyntaxError: Unexpected token: name (bool)\n at ChildProcess.<anonymous> (/var/nodebb/src/meta/js.js:182:15)\n at emitTwo (events.js:106:13)\n at ChildProcess.emit (events.js:191:7)\n at process.nextTick (internal/child_process.js:744:12)\n at _combinedTickCallback (internal/process/next_tick.js:67:7)\n at process._tickDomainCallback (internal/process/next_tick.js:122:9)","level":"error","timestamp":"2016-11-22T18:24:25.855Z"}

    the point is that on dev it never happened before, what I'm doing wrong?

  • Best way of forking a plugin?

    Unsolved Plugin Development
    0 Votes
    2 Posts
    1k Views

    Hey there! Thanks for investigating a fix 😄

    You can fork the plugin on the GitHub pages, and when you are ready you can submit a pull request to merge those changes back into the upstream repository. Then your work can be shared to everybody!

  • 0 Votes
    3 Posts
    2k Views

    Alternatively, just install it with the --save flag and it will pin the current version in your package.json

    npm install --save sparkpost

  • 1 Votes
    1 Posts
    1k Views

    I'm thinking it would be good if we establish some best practices for NodeBB plugin development.

    Feel free to contribute by replying and I'll add it to the list.

    Database keys should start with plugin:[your-plugin-name]: ex: if the plugin is nodebb-plugin-mentions then the database keys would start with plugin:mentions: Use sockets instead of ajax Use CSS transitions instead of jQuery animations, trigger them by toggling classes on the elements Use Bootstrap elements as much as possible or not at all your suggestion here
  • 1 Votes
    10 Posts
    4k Views

    Yeah nodebb plugins are npm modules so they need to have a package.json file. The plugin.json file is just for nodebb.