-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·48 lines (36 loc) · 913 Bytes
/
test.sh
File metadata and controls
executable file
·48 lines (36 loc) · 913 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
43
44
45
46
47
48
# Exit if any command fails
set -e
# If testProjects directory doesn't exist, create it
if [ ! -d "testProjects" ]; then
mkdir testProjects
fi
cd testProjects
TIMESTAMP=$(date +%s)
PROJECT_NAME="testProject$TIMESTAMP"
# Create a new project
mkdir $PROJECT_NAME
cd $PROJECT_NAME
echo "Creating a new project [$PROJECT_NAME]"
npx ../../src/cli.js -- $@
# Keep prompting if we want to re-run (the npx command) until we say no
while true; do
read -p "Do you want to re-run? (y/n) " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
npx ../../src/cli.js -- $@
else
break
fi
done
# Prompt if we want to clean up
read -p "Do you want to clean up? (y/n) " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Remove the project directory
cd ..
rm -rf $PROJECT_NAME
cd ..
# If testProjects directory is empty, remove it
if [ -z "$(ls -A testProjects)" ]; then
rm -rf testProjects
fi
fi