-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-project.sh
More file actions
43 lines (36 loc) · 912 Bytes
/
Copy pathcreate-project.sh
File metadata and controls
43 lines (36 loc) · 912 Bytes
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
#!/usr/bin/env bash
if [ "$#" -ne 1 ]; then
echo "Must supply a name"
exit 1
fi
FULL_PATH=$(realpath "$1")
TEMPLATE_REPO='git@github.com:ehaynes99/simple-node-typescript-app.git'
NAME=$(basename "$FULL_PATH")
if [[ -e "$FULL_PATH" ]]; then
echo "path already exists: $(realpath "$FULL_PATH")"
read -p "Open with nvim? [Y]/n" -n 1 -r
echo ''
if [[ ! $REPLY =~ ^[Nn]$ ]]; then
cd "$FULL_PATH" || exit
nvim
fi
exit 1
fi
mkdir -p "$FULL_PATH"
cd "$DIR" || (echo "$DIR does not exist" && return)
git clone "$TEMPLATE_REPO" "$FULL_PATH"
cd "$FULL_PATH" || (echo "$FULL_PATH does not exist" && return)
find . -type f -exec perl -pi -e"s/library-example/${NAME}/g" {} +
pnpm i
rm -rf .git
rm -rf ./src/*
touch ./src/index.ts
rm create-project.sh
git init .
git add .
git commit -m"Create project"
read -p "Open with nvim? [Y]/n" -n 1 -r
echo ''
if [[ ! $REPLY =~ ^[Nn]$ ]]; then
nvim
fi