-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuildProject.bash
More file actions
executable file
·37 lines (28 loc) · 938 Bytes
/
buildProject.bash
File metadata and controls
executable file
·37 lines (28 loc) · 938 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
#!/bin/bash
projectname=$1
if [ -z "$projectname" ]; then
echo "Error: No project name supplied"
exit 1
fi
cd src/projects/$projectname || { echo "Error: Could not change directory to src/projects/$projectname"; exit 1; }
# Run yarn and capture output in case of failure
if ! yarn; then
exit 1
fi
# Run yarn build and capture output in case of failure
output=$(yarn build 2>&1)
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "Error: yarn build failed for project $projectname"
echo "Yarn build error output:"
echo "$output"
exit $exit_code
fi
# if projects directory does not exist, create it
mkdir -p ./../../../build/projects
# if build/$projectname exists, remove it
rm -rf ./../../../build/projects/$projectname
# if build/$projectname does not exist, create it
mkdir -p ./../../../build/projects/$projectname
# copy the build output to the desired location
cp -R build/* ./../../../build/projects/$projectname