-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathppublish.sh
30 lines (28 loc) · 1.04 KB
/
ppublish.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
#!/bin/bash
echo "$OSTYPE"
if [[ "$OSTYPE" == 'msys' ]]; then
echo 'OS is Windows. Setting npm script-shell to bash'
if test -f 'C:/Program Files/git/bin/bash.exe'; then
npm config set script-shell 'C:/Program Files/git/bin/bash.exe'
echo 'script-shell set to C:/Program Files/git/bin/bash.exe'
elif test -f 'C:/Program Files (x86)/git/bin/bash.exe'; then
npm config set script-shell 'C:/Program Files (x86)/git/bin/bash.exe'
echo 'script-shell set to C:/Program Files (x86)/git/bin/bash.exe'
elif test -f 'C:/Windows/System32/bash.exe'; then
npm config set script-shell 'C:/Windows/System32/bash.exe'
echo 'script-shell set to C:/Windows/System32/bash.exe'
else
error_exit 'git is not installed!'
fi
fi
if test -f '.gitignore'; then
git mv .gitignore .gitignore.back
npm run build
git add -- ./lib
git commit -m 'chore: add built files' -- ./lib
git mv .gitignore.back .gitignore
cd ./lib || exit
git ls-files -z | xargs -0 git update-index --assume-unchanged
else
error_exit '.gitignore does not exist!'
fi