-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Create empty file when not found #98
Comments
import-map-deployer currently will create an empty import map if the io-method's import-map-deployer/src/modify.js Lines 50 to 51 in 3c947e2
Currently the in-memory io-method (used mostly for tests) will return an empty string from readManifest when it's starting out, but no other io-methods do. What this means is that currently the import map file must be created by something other than import-map-deployer, but its contents may be an empty string. I agree that it'd be nice change import-map-deployer so that it upserts an import map when you read/modify the map. I think the best way to do that would maybe be to have the |
@joeldenning yeah that does seem like a nice solution. As the error is thrown from this service when there is nothing to find. I will see if I can get to this within a week or so, but no promises. If anyone else does find the time to do this before, its probably a better bet |
Do you have interest in submitting a pull request implementing this? |
@joeldenning its on the list of things I have left of my current job. But not highest on the list right now. So that is why I said not to promise anything and it may take some time. But I like this tool so it might be time until it is in |
Hello, @joeldenning ! :) Long time no write! Of course, if @vongohren does not mind and he is not currently working on this. |
@quenchaman @joeldenning yeah I have not been able to get to it, but yeah, basically create an empty manifest in the bucket of choice. Not just s3 :P |
Making it work for all buckets in a higher level of abstraction is like playing twister with an octopus.. |
@quenchaman sounds smart. But how about putting it at the right abstraction level, and letting the different bucket types hold the error handling so you atleats put it in the right place? If that makes sense? I dont remember if there is class abstractions or anything there, but when then read manifest would fail, one can call this.handleError? Or do a switch case with a default action of file creation is not implemented for this bucket? |
I do not think that putting the checks in a centralised place is a good idea and with the current error handling it would be a nightmare. |
Its a long time since I have been in the code base, so unsure, I guess it was my hope that getManifest was agnostic of what bucket called it, so that it could just handle and error where the bucket implementation would take over. |
#107 implemented this for s3 and is released in https://github.com/single-spa/import-map-deployer/releases/tag/v4.1.0. This still needs to be implemented for the other providers, so I'm keeping this issue open to track it for them. |
Azure support in #109, but reopening for the remaining io methods |
The import map should be automatically created if it's not present, when using s3 or azure. The other IO methods don't have this implemented yet. Which IO method are you using? |
I wonder about one thing. I found that this service expects it to exist a file in the storage location for it to work? Is that correct? Or is it something I have done wrong?
The problem with this is when initiating the infrastructure, it is unclear who shall controll this empty state. Setting up with terraform and creating a file a provision is not optimal, as the terraform state changes and the file is not consistent. So I do believe this service should handle empty bucket, and potentially just create an empty file.
But maybe it already does, and I had the wrong setup when testing out?
The text was updated successfully, but these errors were encountered: