Skip to content

Commit 1990880

Browse files
committed
fix(install): When PVW is used as dependency
1 parent 1a08216 commit 1990880

1 file changed

Lines changed: 74 additions & 1 deletion

File tree

config/prebuild.sh

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,76 @@
11
#!/bin/bash
22
# FROM: https://github.com/JetBrains/svg-sprite-loader/issues/359#issuecomment-738834513
3-
cat ./config/funcMock.js > ./node_modules/svg-sprite-loader/lib/utils/get-matched-rule.js
3+
4+
function abspath() {
5+
# generate absolute path from relative path
6+
# $1 : relative filename
7+
# return : absolute path
8+
if [ -d "$1" ]; then
9+
# dir
10+
(cd "$1"; pwd)
11+
elif [ -f "$1" ]; then
12+
# file
13+
if [[ $1 = /* ]]; then
14+
echo "$1"
15+
elif [[ $1 == */* ]]; then
16+
echo "$(cd "${1%/*}"; pwd)/${1##*/}"
17+
else
18+
echo "$(pwd)/$1"
19+
fi
20+
fi
21+
}
22+
23+
CURRENT_DIR=`abspath .`
24+
SRC_FILE=`abspath ./config/funcMock.js`
25+
DST_FILE="./node_modules/svg-sprite-loader/lib/utils/get-matched-rule.js"
26+
27+
cd $CURRENT_DIR
28+
if [ -f "$DST_FILE" ]; then
29+
cat "$SRC_FILE" > "$DST_FILE"
30+
exit 0
31+
fi
32+
cd ..
33+
if [ -f "$DST_FILE" ]; then
34+
cat "$SRC_FILE" > "$DST_FILE"
35+
exit 0
36+
fi
37+
cd ..
38+
if [ -f "$DST_FILE" ]; then
39+
cat "$SRC_FILE" > "$DST_FILE"
40+
exit 0
41+
fi
42+
cd ..
43+
if [ -f "$DST_FILE" ]; then
44+
cat "$SRC_FILE" > "$DST_FILE"
45+
exit 0
46+
fi
47+
cd ..
48+
if [ -f "$DST_FILE" ]; then
49+
cat "$SRC_FILE" > "$DST_FILE"
50+
exit 0
51+
fi
52+
cd ..
53+
if [ -f "$DST_FILE" ]; then
54+
cat "$SRC_FILE" > "$DST_FILE"
55+
exit 0
56+
fi
57+
cd ..
58+
if [ -f "$DST_FILE" ]; then
59+
cat "$SRC_FILE" > "$DST_FILE"
60+
exit 0
61+
fi
62+
cd ..
63+
if [ -f "$DST_FILE" ]; then
64+
cat "$SRC_FILE" > "$DST_FILE"
65+
exit 0
66+
fi
67+
cd ..
68+
if [ -f "$DST_FILE" ]; then
69+
cat "$SRC_FILE" > "$DST_FILE"
70+
exit 0
71+
fi
72+
cd ..
73+
if [ -f "$DST_FILE" ]; then
74+
cat "$SRC_FILE" > "$DST_FILE"
75+
exit 0
76+
fi

0 commit comments

Comments
 (0)