-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.sh
executable file
·37 lines (31 loc) · 994 Bytes
/
setup.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
#!/bin/sh
# Prepare a "clean" installation of the boilerplate removing all boilerplate specific code.
# Warning: running this script is destructive and will remove itself.
# Overwrite the package.json with the template package.json
mv package.template.json package.json
mv README.template.md README.md
echo "Removed boilerplate files."
# Setup fresh git history
rm -fr .git
git init
# Fill in project name if argument is given
if [ $1 ]; then
sed -i "" "s/project-name/$1/g" "package.json"
sed -i "" "s/project-name/$1/g" "README.md"
echo "Set project name to $1."
fi
# Fill in and create optional directory if argument is given
if [ $2 ]; then
sed -i "" "s/optional-directory / $2/g" "package.json"
mkdir $2
echo "Created $2 directory."
# Else remove references to optional directory
else
sed -i "" "s/optional-directory //g" "package.json"
fi
# Install dependencies
npm install
echo "Installed npm dependencies."
# Self destruct
rm setup.sh
echo "All done!"