-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·35 lines (25 loc) · 848 Bytes
/
build.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
#!/bin/bash
tempDir="./tmp/"
if [[ -d "$tempDir" ]]; then
rm -r "$tempDir"
fi
mkdir -p "$tempDir"
# get extension name
moduleName=$(jq -r .module ./extension.json)
moduleNameHyphen=$(sed --expression 's/\([A-Z]\)/-\L\1/g' --expression 's/^-//' <<< "$moduleName")
if [[ -f "$moduleNameHyphen.zip" ]]; then
rm "$moduleNameHyphen.zip"
fi
# copy app and client dir
appDestDir="$tempDir/files/application/Espo/Modules/$moduleName"
clientDestDir="$tempDir/files/client/modules/$moduleNameHyphen"
mkdir -p "$appDestDir"
mkdir -p "$clientDestDir"
cp -r "./app/." "$appDestDir/"
cp -r "./vendor/." "$appDestDir/vendor/"
cp -r "./client/." "$clientDestDir/"
# copy scripts and manifest
cp -r "./scripts/." "$tempDir/scripts/"
cp "extension.json" "$tempDir/manifest.json"
(cd "$tempDir"; zip -r "../$moduleNameHyphen.zip" *)
rm -r "$tempDir"