ioBroker.javascript icon indicating copy to clipboard operation
ioBroker.javascript copied to clipboard

Use js-controller v6 methods to manage node modules

Open foxriver76 opened this issue 1 year ago • 7 comments

Is your feature request related to a problem? Please describe. Currently when installing user defined node modules, npm will clean them at every operation, leading to the module not being available until a restart of javascript adapter.

Describe the solution you'd like js-controller v6 introduces new methods with https://github.com/ioBroker/ioBroker.js-controller/pull/2650 to install and require node modules without running into this issue

Describe alternatives you've considered None

Additional context Code needs to check if methods available if yes use this method else stick to old behavior

Only for implementing developer: To test the feature locally with the js-controller v6, simply install iobroker.js-controller@dev

foxriver76 avatar Apr 23 '24 06:04 foxriver76

Only for implementing developer: To test the feature locally with the js-controller v6, simply install iobroker.js-controller@dev

@dev is 5.0.20-alpha.0-20240502-e03492751 instead of 6.x ?

klein0r avatar May 02 '24 09:05 klein0r

Yes, at development time there is no v6

foxriver76 avatar May 02 '24 09:05 foxriver76

@foxriver76 Please review 3bc5b19d35c7ca7f38eb17b99d9deaf899abc007

klein0r avatar May 02 '24 10:05 klein0r

Thanks a lot, LGTM in general :+1:

I think this should be awaited too https://github.com/ioBroker/ioBroker.javascript/commit/3bc5b19d35c7ca7f38eb17b99d9deaf899abc007#diff-58417e0f781b6656949d37258c8b9052ed266e2eb7a5163cad7b0863e6b2916aR1813

Do you know if there is also code somewhere to remove the node modules?

foxriver76 avatar May 03 '24 18:05 foxriver76

Do you know if there is also code somewhere to remove the node modules?

At the moment: no.

Can you provide some function to get all installed packages for the current namespace? In that case I could remove all packages which are not in the packages list of the instance.

klein0r avatar May 03 '24 18:05 klein0r

Yes, so we need something like a adapter.listInstalledNodeModules() returning a string array with the package names. I can implement no problem.

foxriver76 avatar May 03 '24 18:05 foxriver76

Please have a look if this will be suitable for you: https://github.com/ioBroker/ioBroker.js-controller/pull/2723

foxriver76 avatar May 03 '24 19:05 foxriver76