-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move externalModules back into the user dir #3064
Conversation
@HiroyasuNishiyama I would like your feedback on this before we merge - in case there is any problems you can see with this change. |
As you described, if we leave the removal of the library to the user's responsibility, it may be OK to have one directory. By the way, when I tried this PR, I got an error in my environment.
|
Making some more changes to the Function node module handling.
Given the above, it is no longer appropriate to present the module list as if it were a line of code - The functionality remains the same - the module name gives you a TypedInput listing the modules already in use, plus an "Other" option. The variable name is autogenerated from the module name, but can be customised if needed. I am still thinking about the move of the module list into the top-level package.json. I still think we should do it, but we should have a way to distinguish modules installed manually vs modules installed via the UI. I think we can do this by keeping a list of modules in runtime settings (ie |
With the latest commit, we now keep a record of any modules the runtime installs in I think this is good enough for 2.0 - and gives a way forward to have a better management api/ui for external modules in a later release. |
Hi @knolleary I tested this patch with monaco editor to ensure types are picked up for intellisense - all good :) One very VERY minor thing (might be a chrome issue) but the new UI is a couple of pixels too tall and causes the scrollbar to appear... Cheers. |
Proposed changes
In 1.3 we introduced the ability for the Function node to specify additional modules via the UI.
For various reasons, we decided to install those extra modules under
~/.node-red/externalModules
. This was whilst trying to solve various issues around the full lifecycle management of those modules.However we never released support for removing modules via the UI - that has to be done on the command line. So none of the issues that were addressed by having a separate directory actually apply.
Feedback from the community was not overly positive on having a separate directory. Users want a single package.json for their application that covers everything - rather than having one for the app and one for the external modules.
This PR changes the behaviour to install and load external modules from the user dir -
~/.node-red
.This means they live in the top level package.json - making it easier to manage.
The code checks for the existence of the 'old' externalModules directory and displays this warning if it is found:
The runtime will reinstall the modules (rather than try to copy/move files) as needed - just as if they were requested for the first time.
This is a change we can only make on a major version bump. If we don't do this for 2.0, then I suspect the
externalModules
directory usage will get too well established before we can consider the change again in 3.0.