Assume there is a Lovelace plugin.
It was installed by HACS and is stored here:
Since HA is an open-source project, everyone is supposed to be welcome to contribute.
Assume I want to add some new features to some custom card, correct bugs etc.
And I want to achieve it by PR.
But before proposing a PR - I need to test it locally.
So, I go to the plugin’s folder, open JS file - and I see it is obfuscated - which make a “hacker”'s life a bit more difficult.
OK, I go the GitHub repo, open the source code, decide about required chages - then trying to edit that ugly obfuscated (i.e. “optimized”) code correspondingly - which in some cases not possible due to this “optimization”.
Next, I decide to fork the repo, add necessary changes to my repo, then I want to replace the “official plugin” by “my plugin” .
Go to HACS, uninstall the plugin.
The trying to install my plugin (“add a new repo”) - and getting a “Repository structure is not compliant” error.
My forked repo cannot be added as a Lovelace plugin.
So, I cannot ether to replace a custom card (HACS does not allow) or to edit plugin’s code locally (“optimized” code).
What am I doing wrong?
One more thing.
Some small changes I can do with that obfuscated JS file, and it is a bit uneasy:
– remove gz file for this plugin;
– edit js file;
– restart HA;
– clear browser’s cache.
Is it necessary to restart HA every time?
Using HA Container.
Which one a “new file”?
Assume that source codes are “a few ts files” in many cases.
I tried to save these files in some folder (/www/community/my-plugin), then this plugin is supposed to be added as a resource - but the standard “Add a resource” needs JS file.
P.S. I used to be a C/C++ dev since 90x, practised some Java, know nothing about a connection between ts & js.
Well HACs is really a separate project in that sense…
I don’t have a quote at hand or anything, I believe the owner didn’t want to merge it officially into HA…
Odd…did not have these issues before, if you created a proper fork then it should work imo.
Other option is indeed to add a new folder under www/community and copy the github js in it
Do note that I had issues before where the js file had the same name as another, already installed, js
Or it could be a set of js files. Which one should be declared as a Resource then?
I wonder what is a great meaning of providing plugins as obfuscated js files?
Is it about “prevent stealing someone’s code”?
Btw, once I realized that some Lovelace plugin was ALREADY obfuscated on Github !
One of my cards is a weather card and I wanted to fix things, the fork could not work next to the parent one only until the name of the js file changed
Usually I provided issues / FRs to plugin’s authors/maintainers; here I wanted to change something by myself.
Some changes I managed to add into js file locally.
The initial idea was to change files locally in my repo, upload them to GitHub, re-download my plugin to HA, test on HA - then propose a PR to the “official” repo.
Please try if this repo can be added via HACS.
(works still in progress)
Same issue as you have (structure…) and having now looked at this, this is quite a bit more complex then I have seen before so I doubt that I will be of further help
I think this is not just a HACS issue.
As you said - HACS is a custom plugin itself.
This is about global HA issues:
How plugins are installed into HA - there are must be a possibility to manually install a plugin w/o using HACS. Now I see that this does not work and people have to use HACS - which does not allow to use forked repos.
How plugins are provided for HA - currently they are provided obfuscated to make a life worse for HA users (who wants to change codes).