Plugin.json scripts no duplicates

Feature Requests
  • I'd like the scripts property within plugin.json to ignore duplicates.

    A value like this ["public/scripts/globals/", "public/scripts/"] should first include all files within public/scripts/globals/ and afterwards all files within public/scripts/ without including those within /public/scripts/globals/ again.

    I need this for my nodebb-grunt rework which is nearly able to get released 😉
    If it doesn't get implemented I'd have to use a more ugly file-structure for my module prototype.

  • Wouldn't it just be OK to do the parent one, it implies you're including that subfolder already anyways

  • But it wouldn't ensure the order which I need to do for defining global variables (I basically need a variable defined for all other files).

  • Could this work for your usecase?


    MyAsyncFunction(function() {
     MyPlugin.stuff = X;


    window.on('myplugin:init', doThis);

    Probably a good idea to avoid globals anyways?

  • Ok, I'll get a bit more into details...

    I have a compile-step (grunt task) that replaces occurrences like @{id} with my-plugin.
    I want this to apply to as few files as possible (no performance issues, but applying to all files could produce issues when you really want to use the string @{id} somewhere - may be for a different super-language of javascript).

    This is why I created a sub-directory globals (in fact it's called meta in my case) which gets this compile-step applied.

    Now I want to use the plugin-id within files outside of this globals directory and without hard-coding it (you should be able to change your plugins name by just editing the package.json when done properly).

    Because of this I use var currentModuleID = "@{}/@{id}"; within the globals directory and reference this variable within the other files.

  • You mentioned a hack to figure it out for your usecase, how does that look? I'm just saying this because adding a subfolder to run first to get globals set and then requiring the parent folder to ensure load order sounds like something that doesn't really make sense.

    Ima defer this to @baris / @julian though. But I do think you could probably figure out an alternative?

  • For the hack I'd either need to create a directory parallel to public/scripts/ (like public/scripts_globals/) or to public/scripts/globals/ (like public/scripts/foobar/ and require all other scripts to be in there).
    An alternative I'd use rather for now would be to apply the compile-step to all files within public/scripts/. This would also get rid of the global variable.
    But as mentioned it could drive the developer nuts if he/she/it tries to get such a string...

    I just thought this might be an overall nice feature (since it's pretty common in such arrays with other frameworks) if it's not too hard to achieve.

    Without you cannot define the order of generic files if and only if they share the same parental directory. Sounds a bit inconsistent to me... Otherwise I'd not asked 😉

    So the question regardless of my use-case should be: "Should we allow developers to define the script-execution order?"

  • I decided to go with applying the compile-step to all client-side scripts options.

    Nonetheless this might be nice to have 😉

Suggested Topics

  • OpenAl Plugin

    Feature Requests
    1 Votes
    5 Posts

    That's the main thing that gives me pause... while I don't believe that ChatGPT will signify the end of online human interaction (among other things), I do believe that we will adapt to it and learn to live alongside.

    However my prediction is that ChatGPT will rather have the opposite effect, that it will enhance the value of user-generated content, simply through sheer quantity of AI generated content. It doesn't make said UGC any more or less correct, but human interaction will always be more interesting than a human-like construct 😄

    Lots of people are doing very interesting things with ChatGPT, and I'll put it very very bluntly:

    Something we can do is have ChatGPT consume an entirety of a NodeBB's post content and answer queries like a tailored help bot Seems like we see a new library or script doing this almost daily It is easier for me to sit back while hundreds of people attempt to do this, and wait for the winner to surface 😆
  • 1 Votes
    5 Posts

    @baris yes, this was our method; however, there have been many real new users who wanted to use those fields, and it was taking a lot of time for us to fill in their info manually, so we had to abandon this method.

  • 0 Votes
    17 Posts

    What if its a giant "I ❤ NodeBB" banner then? 😛

  • 0 Votes
    4 Posts

    @Jelena You're welcome, didn't look in the plugin file. 🙂 glad you've got it working,

  • 0 Votes
    3 Posts

    Sounds good 🙂