@pitaj said in NodeBB Installation as Module(s):
I am not entirely convinced about the whole overwriting story
npm deletes the old version of the module before installing the new module version. So any changes you make inside a module directory that is managed by npm will be deleted.
Ok but why not let npm do the management and add the entries in such a place that it is managed correctly?
even if that was the case, what would prevent simply reinstalling the plugins as well?
The package.json defining installed plugins would be deleted.
Ok I see your point but this is precisely the case because NodeBB insists to run in its source code directory. Indeed, NodeBB should look for package.json in the parent directory and further up the directory tree and add the plugin entries there prior to running npm install.
plugins to require('nodebb/src/...') instead of require.main.require('./src/...') which in turn would open way to proper unit testing for plugins
Unit tests shouldn't need to connect to NodeBB, as units are small pieces of code that can be isolated from the rest, including NodeBB. You can set up your unit tests however you want for your plugins.
That is true, I just mean that plugins notoriously use NodeBB internals by means of require.main.require('./src/database') etc. it would be cleaner if NodeBB actually came as a set of modules and one could simply require('nodebb-database');
As for higher level tests:
Again, NodeBB requires a connection to a database, even while testing. Your plugin test harness would still need to initialize the database as they do now.
Well ok that is true, I guess the main points are the ones before.
run multiple instances without copying the entire source code directory
That would be a nice result of rearchitecting, except then every NodeBB instance must be at the exact same version.
True but it is usually fine to just run the most recent version.
be more in line with how Node apps are installed generally
Again, I'm unaware of any node applications like NodeBB, that must connect to a database to function, that work the way you describe. Please provide an example.
I don't think that connecting to a database somehow "excuses" applications writing inside of their own source code directories. It just feels very much not right.
Among bigger applications I guess ESlint still nicely provides a binary. But it would be great if NodeBB was a pioneer and the first one to do it "right" among the Web apps