unimonkiez / react-native-asset

Linking and unlinking of assets 🔥

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve command to avoid unecessary change in pbxproj

MoOx opened this issue · comments

If you run the command twice, IDs in pbxproj are changed, even if files didn't change.
It's unecessary and not very handy when you work with git in team.
In my case I have a combination of a generated font (for icons, with a static name) and static pdf, and references changing in xcode proj is totally not necessary.
The fact that my font is generated from svg made me ignore my font file in android assets folder. So I must run the command to generate my font and then do the linking (to have the font at the right place for android). That's why I need to call the link command everytimes (npm postinstall hook & prestart).

Finding a way to avoid this unecessary updates could be nice!

Thanks for opening the issue! 😄
Right now the manifest only includes file names and cannot detect changes to the files themselves, though calculating the files SHA can be done and stored in the manifest to avoid relinking.

In my app me and my team avoided committing the command changes and by doing so we reduced the project git size (because android copies the assets) and also not having to deal with the issue you mentioned.

I might implement this change when I'm bored, but it is not that crucial

Made the manifest store relative path and sha1 of each asset, and it now compares them to decide if needs to make any changes at all.
This is in version v1.1.0 which is already up 👍