fix: hash plugin files after prepare #5753
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Checklist
What is the current behavior?
NativeScript CLI hashes plugin files before preparing them, meaning that the next run of the CLI will have outdated hashes if the plugin changed any of its files during the prepare step.
This can lead to some cases of plugins not being prepared when they should because the known hashes (from
.ns-plugins-build-data.json
) match the hashes of a plugin that was not built yet.This is notable when using yarn and some plugins from nativescript-community (i.e. ui-lottie and ui-material-*) because they don't ship a
.aar
in the tarball. After installing any dependency with yarn it'll reset the node_modules to a known state that will break the known hashes of the CLI.Steps to reproduce:
What is the new behavior?
The CLI now hashes the plugin files after a successful prepare, meaning that it'll store the most recent file hashes for plugins that change their contents during this step.
A side-effect of this fix is that the CLI tracks more accurately which plugins need to be prepared after a yarn install even if they do ship their own
.aar
files as it now has a way for checking if the shipped.aar
has the same hashes as the one previous compiled locally.