-
Notifications
You must be signed in to change notification settings - Fork 0
/
erase-design-system-integrity
executable file
·53 lines (43 loc) · 1.26 KB
/
erase-design-system-integrity
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
#!/bin/bash
# Check we run from th project root.
if [[ ! -f ./assets/package-lock.json ]]
then
echo "Please execute from the project root."
exit 1
fi
promt1="This script will erase the integrity checksum of node modules related to the studitemps-design-system.
Shall we proceed? (y/n): "
read -p "$promt1" -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo "We did nothing."
exit 1
fi
jq 'delpaths([["packages", "node_modules/bootstrap", "integrity"], ["dependencies", "bootstrap", "integrity"]])' ./assets/package-lock.json > ./assets/tmp.json
if [[ ! $(diff ./assets/tmp.json ./assets/package-lock.json) ]]
then
echo "Nothing to erase."
rm ./assets/tmp.json
exit 0
fi
mv ./assets/tmp.json ./assets/package-lock.json
echo "Problematic integrity checksums erased."
promt2="Shall we add, commit and push the change? (y/n): "
read -p "$promt2" -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo "Okay, we won't. Here is your git status:"
echo
git status
exit 0
fi
# Unstage all files
git reset -- .
# Add erased integrity
git add ./assets/package-lock.json
# Commit changes
git commit -m "Erased faulty integrity checksum of studitemps-design-system"
# Push changes
git push