-
Notifications
You must be signed in to change notification settings - Fork 0
/
fix.sh
34 lines (21 loc) · 1.17 KB
/
fix.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# This script is used to fix the import of fmin in venn.js
target_file="./node_modules/crux/node_modules/venn.js/src/diagram.js"
original_import='import {nelderMead} from "../node_modules/fmin/index.js"'
replacement_import='import {nelderMead} from "fmin"'
target_file2="./node_modules/crux/node_modules/venn.js/src/layout.js"
original_import2="scale} from '../node_modules/fmin/index.js'"
replacement_import2="scale} from 'fmin'"
#echo "Updating ${target_file}"
#sed -i "" "s|$original_import|$replacement_import|g" "$target_file"
#echo "Updating ${target_file2}"
#sed -i "s|$original_import2|$replacement_import2|g" "$target_file2"
# sed -i 's#from "\.\./node_modules/fmin/index\.js"#from "fmin"#g' "$target_file"
# sed -i 's#from "\.\./node_modules/fmin/index\.js"#from "fmin"#g' "$target_file2"
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i "" "s|$original_import|$replacement_import|g" "$target_file"
sed -i "" "s|$original_import2|$replacement_import2|g" "$target_file2"
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
sed -i "s|$original_import|$replacement_import|g" "$target_file"
sed -i "s|$original_import2|$replacement_import2|g" "$target_file2"
fi