Skip to content

Instantly share code, notes, and snippets.

@vpctorr
Last active November 25, 2023 04:09
Show Gist options
  • Save vpctorr/5217a668544e88790e545cbe6914d34e to your computer and use it in GitHub Desktop.
Save vpctorr/5217a668544e88790e545cbe6914d34e to your computer and use it in GitHub Desktop.
Turf.js TypeScript 5 Patch
curl https://gist.githubusercontent.com/vpctorr/5217a668544e88790e545cbe6914d34e/raw/75420dcf22e73b80f027d3dd81dd42315284b044/turf_types_patch.sh | bash
#!/bin/bash
directory="node_modules/@turf"
for subdir in $directory/*; do
package="$subdir/package.json"
if [[ -f "$package" ]]; then
types_value=$(jq -r .types $package)
if [[ "$types_value" != "null" ]]; then
types_value="./$types_value"
new_content=$(jq --arg types "$types_value" '.exports["."].types = $types' $package)
echo "$new_content" > $package
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment