fix(utils): fix resources map becomes directory - #10293
Conversation
closes #10187 Fixes the behavior of mapped resources generating extra directory, for example: `"../resources/user.json": "resources/user.json"` generates this resource `resources/user.json/user.json` where it should generate `resources/user.json` This PR includes a refactor of the Iterator implementation which splits it into more scoped functions and relis on recursing instead of a loop which makes the code a lot more readable and easier to maintain.
Package Changes Through 4dfd836There are 11 changes which include tauri-cli with prerelease, @tauri-apps/cli with prerelease, tauri-build with prepatch, tauri-codegen with prerelease, tauri-utils with prerelease, tauri-bundler with prerelease, tauri with prerelease, tauri-macos-sign with prepatch, @tauri-apps/api with prepatch, tauri-runtime with prepatch, tauri-runtime-wry with prepatch Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
|
I tested with some folder cases, and it seems to have some differences from the past version when the source has folders inside a folder or the destination is a folder: Source: Folder, Dest: Folder{
"resources": {
"assets/": "dist/"
}
}Source: Folder, Dest: Root{
"resources": {
"assets/": ""
}
}Source: Glob, Dest: Folder{
"resources": {
"assets/*": "dist/"
}
}Source: Glob, Dest: Root (this one is correct){
"resources": {
"assets/*": ""
}
} |
|
Thanks @pewsheen for extensive tests, I will fix the However |
|
I just noticed that which is a different behavior than before but consistent with |
|
@pewsheen all should be good now, please give it another test |
|
This one is weird And if the the glob path is not valid, it'll remain in the glob format Maybe we should check the glob path is valid or return |
|
@pewsheen these two cases should be fixed now, let me know if you find any more bugs |
lucasfernog
left a comment
There was a problem hiding this comment.
I opened this PR considering writing tests to validate this, but you already did it ❤️
|
I think this PR is probably what broke the resources setting for me. I have a I should probably make a separate issue for it, but don't have the time to make it detailed enough. And sorry if this is unrelated (very possible) |
What you wrote here is already detailed enough for an initial issue. :) |
|
@Raicuparta I believe However I think we may need to improve the error. |
|
That makes sense. I guess the error could specifically mention globs when those are used to make it more clear. But maybe the breaking change could be documented in V2 migration docs. Unless it's considered a bug fix because the previous version wasn't following globbing expectations. |
|
I will open a PR to improve the error a bit, However for The migration docs will be updated. |
* fix(resources): enhance error messages for globs ref: #10293 (comment) * fmt
closes #10187
Fixes the behavior of mapped resources generating extra directory, for example:
"../resources/user.json": "resources/user.json"generates this resourceresources/user.json/user.jsonwhere it should generateresources/user.jsonThis PR includes a refactor of the Iterator implementation which splits it into more scoped functions and relis on recursing instead of a loop which makes the code a lot more readable and easier to maintain.