How do I pre-install plugins?
-
Well yeah, but you can install the wrong version using the script too.
Under the hood, the ACP plugin installer just runs an
npm i
for the plugin you want, which installs the package in the node_modules folder.Npm uses the package.json file to figure out what to install as dependencies for the NodeBB platform, which get installed in the same folder. So when you run
npm i
in the NodeBB folder, it looks at the package.json file, and installs the dependencies. So, technically you can add whatever plugin you want as a dependency in the package.json folder (adding the appropriate version number that you know will work). At that point, you'd just have to go into the ACP and activate them.The only caveat is you'd have to mind what's happening to that root package.json file when you're updating, to avoid conflicts / losing your settings.
Addressing the original question, you can specify a specific version you want to install by specifying the version of a package you want, i.e.
"nodebb-plugin-imgbed": "0.2.1"
https://docs.npmjs.com/files/package.json @ "dependencies"
-
@BDHarrington7 I understand that but the script installs the specific version that's compatible with my nodebb based on the response from packages.nodebb.org/api/v1/suggest.
For example: https://packages.nodebb.org/api/v1/suggest?package=nodebb-plugin-composer-default&version=0.9.1
-
@BDHarrington7 said:
Under the hood, the ACP plugin installer just runs an
npm i
for the plugin you want, which installs the package in the node_modules folder.Under the hood NodeBB runs an
npm i package@version
with the version resolved via NBBPM (packages.nodebb.org). And this is exactly what @ferik wanted without the need of using the NodeBB web-interface.Well yeah, but you can install the wrong version using the script too.
True if you have listings within the package.json that are not compatible with the plugin authors suggestion.
But if you have such listings, you wouldn't call the script with this package in the first place since you already know which version you want to have installed.Addressing the original question, you can specify a specific version you want to install by specifying the version of a package you want, i.e.
"nodebb-plugin-imgbed": "0.2.1"
As @ferik already said this requires you to know the version of the package you want to use that is compatible with your version of NodeBB. And the original question is how to do this automatically. You might want to read the second sentence of the original question again
@ferik said:
I can
npm install them
but that requires me to know what exact version I need for that version of NodeBB. Is there a way to through the command line ask NodeBB to install the version of a plugin that works with it? -
@frissdiegurke Yup, you answered all my questions, thank you!
-
@frissdiegurke yeah I missed that "automatically" part
In my defense, I'd rather reduce the number of external dependencies, and knowing the versions compatible, could still make an installation reproducible without needing to depend on anything. Maybe I just like doing things the hard way, haha.
Still, kudos for that quick script! Wasn't trying to make it sound like wasted work.
-
Seriously, a down vote for admitting I missed something and lauding frissdiegurke's script?
-
Haha! True, those voting buttons are really tiny on mobile... @psychobunny
-
Just keeping you guys on your toes
Tbh a forum like this should be using the "Likes" plugin instead, flagging is enough for spam etc
-
@psychobunny There's just something with pressing the flagging button for some reason on bots, it feels... Rewarding.