-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitch
executable file
·33 lines (33 loc) · 3.57 KB
/
switch
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
#!/usr/bin/env bash
if [ $1 == "event" ]; then
cat package.json | yarn jqn 'u => {u.homepage = "https://hacktj.org/2020v2"; return u;}' --color=false > tmp.$$.json && mv tmp.$$.json package.json
sed 's|<Routes>|<Routes basename="/2020v2">|' src/App.tsx > src/tmp.$$.js && mv src/tmp.$$.js src/App.tsx
cat public/manifest.json | yarn jqn 'u => {u.start_url = "/2020v2"; return u;}' --color=false > tmp.$$.json && mv tmp.$$.json public/manifest.json
cat public/manifest.json | yarn jqn 'u => {u.short_name = "HackTJ 7.5"; return u;}' --color=false > tmp.$$.json && mv tmp.$$.json public/manifest.json
sed 's|<base href="/" />|<base href="/2020v2" />|' public/index.html > public/tmp.$$.html && mv public/tmp.$$.html public/index.html
sed 's|<title>HackTJ</title>|<title>HackTJ 7.5</title>|' public/index.html > public/tmp.$$.html && mv public/tmp.$$.html public/index.html
sed 's|<meta property="og:title" content="HackTJ" />|<meta property="og:title" content="HackTJ 7.5" />|' public/index.html > public/tmp.$$.html && mv public/tmp.$$.html public/index.html
sed 's|<meta property="og:site_name" content="HackTJ" />|<meta property="og:site_name" content="HackTJ 7.5" />|' public/index.html > public/tmp.$$.html && mv public/tmp.$$.html public/index.html
sed 's|<meta name="twitter:title" content="HackTJ" />|<meta name="twitter:title" content="HackTJ 7.5" />|' public/index.html > public/tmp.$$.html && mv public/tmp.$$.html public/index.html
sed 's|<title>HackTJ</title>|<title>HackTJ 7.5</title>|' public/404.html > public/tmp.$$.html && mv public/tmp.$$.html public/404.html
sed 's|var segmentCount = 0;|var segmentCount = 1;|' public/404.html > public/tmp.$$.js && mv public/tmp.$$.js public/404.html
rm -f public/CNAME
git remote set-url origin [email protected]:HackTJ/2020v2.git
elif [ $1 == "homepage" ]; then
cat package.json | yarn jqn 'u => {u.homepage = "https://hacktj.org"; return u;}' --color=false > tmp.$$.json && mv tmp.$$.json package.json
sed 's|<Routes basename="/2020v2">|<Routes>|' src/App.tsx > src/tmp.$$.js && mv src/tmp.$$.js src/App.tsx
cat public/manifest.json | yarn jqn 'u => {u.start_url = "/"; return u;}' --color=false > tmp.$$.json && mv tmp.$$.json public/manifest.json
cat public/manifest.json | yarn jqn 'u => {u.short_name = "HackTJ"; return u;}' --color=false > tmp.$$.json && mv tmp.$$.json public/manifest.json
sed 's|<base href="/2020v2" />|<base href="/" />|' public/index.html > public/tmp.$$.html && mv public/tmp.$$.html public/index.html
sed 's|<title>HackTJ 7.5</title>|<title>HackTJ</title>|' public/index.html > public/tmp.$$.html && mv public/tmp.$$.html public/index.html
sed 's|<meta property="og:title" content="HackTJ 7.5" />|<meta property="og:title" content="HackTJ" />|' public/index.html > public/tmp.$$.html && mv public/tmp.$$.html public/index.html
sed 's|<meta property="og:site_name" content="HackTJ 7.5" />|<meta property="og:site_name" content="HackTJ" />|' public/index.html > public/tmp.$$.html && mv public/tmp.$$.html public/index.html
sed 's|<meta name="twitter:title" content="HackTJ 7.5" />|<meta name="twitter:title" content="HackTJ" />|' public/index.html > public/tmp.$$.html && mv public/tmp.$$.html public/index.html
sed 's|<title>HackTJ 7.5</title>|<title>HackTJ</title>|' public/404.html > public/tmp.$$.html && mv public/tmp.$$.html public/404.html
sed 's|var segmentCount = 1;|var segmentCount = 0;|' public/404.html > public/tmp.$$.js && mv public/tmp.$$.js public/404.html
cp CNAME.homepage public/CNAME
git remote set-url origin [email protected]:HackTJ/hacktj.github.io.git
else
echo "Invalid argument"
exit 128
fi