-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSETUP
More file actions
executable file
·48 lines (37 loc) · 1.61 KB
/
SETUP
File metadata and controls
executable file
·48 lines (37 loc) · 1.61 KB
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
#Run this to switch from the template project to your node project
script_path="$( cd "$( dirname "$0" )" && pwd )"
cd "$script_path"
if [[ -z "$1" || -z "$2" || -z "$3" || -z "$4" ]]; then
echo "usage: $0 project_name \"description here\" \"git_remote\" author_email [license_name]"
echo "example: $0 rainbow-alligator \"Because alligators like glitter, too\" \"git@github.com:Oakleon/rainbow-alligator.git\" rainbowdev@example.com MIT"
echo ""
echo "Currently ssh authentication to github is assumed, you must change this afterwards if you do not want to use ssh authentication"
exit 99
fi
unset NODE_ENV
npm install
PROJECTNAME="$1"
DESCRIPTION="$2"
AUTHOREMAIL="$4"
LICENSENAME="$5"
#Just get the git base url, allowing various input styles
git_ssh_url=${3#*://}
git_ssh_url=${git_ssh_url#git@}
git_ssh_url=${git_ssh_url%.git}
GITBASEURL="$(echo -n $git_ssh_url | tr ':' '/')"
sed -i "" "s/PROJECTNAMEHERE/$PROJECTNAME/g" "$script_path/README.md"
sed -i "" "s/PROJECTNAMEHERE/$PROJECTNAME/g" "$script_path/package.json"
sed -i "" "s|DESCRIPTIONHERE|$DESCRIPTION|g" "$script_path/package.json"
sed -i "" "s|GITBASEURLHERE|$GITBASEURL|g" "$script_path/package.json"
sed -i "" "s/AUTHOREMAILHERE/$AUTHOREMAIL/g" "$script_path/package.json"
if [ -n "$LICENSENAME" ]; then
sed -i "" "s/LICENSEHERE/$LICENSENAME/g" "$script_path/package.json"
else
sed -i "" "s/LICENSEHERE/UNLICENSED/g" "$script_path/package.json"
fi
git remote remove origin
git remote add origin "$git_ssh_url"
git rm SETUP
git commit -a -m "Initial $PROJECTNAME project commit"
echo "Git commit complete. git push at your leisure."