Skip to content

Instantly share code, notes, and snippets.

@adamblvck
Created July 22, 2022 18:00
Show Gist options
  • Save adamblvck/4a06ee4bd04d9c00c53ab17bc500d088 to your computer and use it in GitHub Desktop.
Save adamblvck/4a06ee4bd04d9c00c53ab17bc500d088 to your computer and use it in GitHub Desktop.
Bash script, allowing one to quickly fix key import lines, allowing Expo-based developers to make WebView Crypto work in their projects
# Put this file in root of your expo project. Don't forget to execute `chmod +x ./gundb_expo_fix.sh`
# Run the file after every `npm install` or `expo install` as those commands revert changes done by this script
##### Fix first file
# replace first line of code with working import
sed '1 c\
import serializeError from "serialize-error";' node_modules/webview-crypto/src/MainWorker.ts > tmp_file.ts
# overwrite file to fix, and remove tmp-file
cat tmp_file.ts > node_modules/webview-crypto/src/MainWorker.ts
rm -rf tmp_file.ts
###### Fix second file
# replace first line of code with working import
sed '1 c\
import find from "lodash/find";' node_modules/webview-crypto/src/asyncSerialize.ts > tmp_file.ts
# overwrite file to fix, and remove tmp-file
cat tmp_file.ts > node_modules/webview-crypto/src/asyncSerialize.ts
rm -rf tmp_file.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment