forked from hossein-zare/react-native-dropdown-picker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_reformat.sh
65 lines (47 loc) · 2.06 KB
/
update_reformat.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
if [ $# -ne 1 ] || [ "$1" != "-y" ]
# if num arguments supplied !== 1 or single argument supplied !== "-y"
# give feedback to user and check they want to run the script
then
echo "This script will automatically update this library's dependencies and reformat its code😃"
echo "In the future, pass a single argument of \"-y\" to assume \"yes\" as the answer to the prompt and run non-interactively."
while [ "$yn" != "Y" ] && [ "$yn" != "y" ] && [ "$yn" != "N" ] && [ "$yn" != "n" ]
do
read -r -p "Do you wish run this script? (y/n): " yn
case $yn in
[Yy]* ) echo "Running script";;
[Nn]* ) echo "Exiting script"; exit 0;;
* ) echo "Please answer y for yes or n for no.";;
esac
done
fi
echo "🚀 Script starting. This library's dependencies will be updated and its code will be reformatted. Go get a coffee or sit back and relax!"
echo "🔄 Step 1 of 2: updating dependencies."
echo "🔄 Updating dependencies, part 1 of 3: pulling from git."
git fetch
git pull
echo "🔄 Updating dependencies, part 2 of 3: updating dependencies of examples subdirectory."
cd examples || exit 1
npx --yes npm-check-updates -u --timeout 400000
npm update
npm audit fix
npm install expo@latest
npx --yes expo install --fix
npx --yes sort-package-json
npm install
npx --yes expo install --check
echo "🔄 Updating dependencies, part 3 of 3: updating dependencies of react-native-dropdown-picker."
cd .. || exit 1
npx --yes npm-check-updates -u --timeout 400000
npm update
npm audit fix
npx --yes sort-package-json
npm install
echo "✍️ Step 2 of 2: Reformatting code."
echo "✍️ Reformatting code, part 1 of 2: starting first pass."
npx eslint --fix . --config .eslintrc.yaml --ignore-path .eslintignore
npx prettier --write . --config .prettierrc.yaml --ignore-path .prettierignore
echo "✍️ Reformatting code, part 2 of 2: starting second pass."
npx eslint --fix . --config .eslintrc.yaml --ignore-path .eslintignore
npx prettier --write . --config .prettierrc.yaml --ignore-path .prettierignore
echo "✅ Done!"