-
Notifications
You must be signed in to change notification settings - Fork 2
/
cleanup.sh
executable file
·48 lines (41 loc) · 1.69 KB
/
cleanup.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
#!/bin/bash
# shellcheck disable=SC2120
### This script will rename your angular project. ~matsta25
# TODO: check for Windows env.
set -o nounset
set -o errexit
old_app_name="angular-starter-app"
new_app_name=$1
has_not_arg() {
echo "No your-app-name supplied. Usage eg.:" &&
echo &&
echo "./cleanup.sh your-app-name" &&
echo &&
exit 1
}
has_arg() {
echo "Finding and replacing strings from $old_app_name to $new_app_name..." &&
find ./ -not -path "./node_modules/*" -type f -exec sed -i "s/$old_app_name/$new_app_name/g" {} + &&
echo "Overwriting README.md file..." && echo "# $new_app_name" >README.md &&
echo "Removing docs directory..." && rm -rf ./docs &&
echo "Removing docs usage in package.json..." && sed "/docs/d" -i ./package.json &&
echo "Removing .gitlab-ci.yml..." && rm ./.gitlab-ci.yml &&
echo "Removing .travis.yml..." && rm ./.travis.yml &&
echo "Removing quick-start-demo.svg..." && rm ./quick-start-demo.svg &&
echo "Removing db.json..." && rm ./db.json &&
echo "Removing examples directory..." && rm -rf ./src/app/examples &&
echo "Removing examples usage in core.module.ts..." && sed "/ExamplesModule/d" -i ./src/app/core/core.module.ts &&
echo "Overwriting home.component.ts file.." && echo "This is home page!" > ./src/app/core/components/home/home.component.html &&
echo "Removing .github/*..." && rm -rf ./.github &&
echo "Removing .CONTRIBUTING.md..." && rm -rf ./CONTRIBUTING.md &&
echo "Removing this cleanup script..." && rm ./cleanup.sh &&
echo &&
echo "Project successfully cleaned from $old_app_name to $new_app_name." &&
echo &&
exit 0
}
if [ "$#" -eq "0" ]; then
has_not_arg
else
has_arg
fi