[ANNOUNCE] node-red-contrib-ui-web-push: beta version

Hey guys,
Maxim has been so kind to make me contributor to his repository, so I have added my UI node to it.
But this is 100% against my nature ( :frowning_face: ):

  • The UI stuff is miles away from Maxim's stuff,
  • Don't like to intrude in the repository from somebody else
  • I need to bother him every time I want to publish a new version on npm
  • We both have different styles of documenting
  • ...

So would like to keep the repositories separated, if possible ...
Therefore I have tried another experiment to share the config nodes between Maxim's node-red-contrib-web-push and my node-red-contrib-ui-web-push, and still being able to install each both nodes without the other (and have no failure).

I think I found a solution/workaround (based on a global const issue of @Steve-Mcl a couple of days ago) :

  • Maxim's module contains the VAPID config node. However instead of always registering that config node, I install it conditionally if a global variable exists:

    if (!VapidConfigurationNodeHasBeenInstalled) {
       RED.nodes.registerType('vapid-configuration', VapidConfigurationNode);
       var VapidConfigurationNodeHasBeenInstalled = true;
       console.log("The Vapid config node has been installed for Maxim's node-red-contrib-web-push node")
    }
    
  • I add the same config node to my own module, and also register it conditionally based on the SAME GLOBAL VARIABLE:

    if (!VapidConfigurationNodeHasBeenInstalled) {
       RED.nodes.registerType('vapid-configuration', VapidConfigurationNode);
       var VapidConfigurationNodeHasBeenInstalled = true;
       console.log("The Vapid config node has been installed for Bart's node-red-contrib-ui-web-push node")
    }
    
  • As a result only one of both modules will register the VAPID config node (the other module not because then the global variable has been declared meanwhile):

    image

So you can install both nodes independently of each other, and they seem to be able to share the config nodes. That seems to me normal behaviour...

  • Does somebody see a disadvantage?
  • Not sure whether the VAPID config node code (html and js files) should be copied in my repository, or should we create a separate third module (and both Maxim's an my modules have a dependency to that common module)? If in the future that common module is updated on npm, then both our modules will have the update.

Thoughts?