Open
Description
Problem
Currently, we are transforming every jsx/tsx files with data-oid
. While this helps with modifying the code exactly, it creates large commits that include irrelevant files.
Proposed solution
We should only track files that have been changed after the project is transformed. One way to do this is to create cache files and restore all the files that remain unchanged between the transform and cleaup. The algorithm should roughly be:
Start project
- Create a
.onlook
folder if it doesn't already exist - Create cache files for each tsx/jsx files before they are transformed
- Transform file with oid
- Store a hash of each file's content
- Edit project as usual
Clean up
- Hash file content
- Check if hash is the same (file unchanged since transform)
a. If hash is the same, restore cached file
b. Else, clean up as usual
Some optimizations:
In the cache folder root, store map of path to hash, something like this:
{
"actual/file/path.tsx": {
"hash": "sha123",
"cache_path": "123.tsx"
},
...
}