forked from eclipse-iofog/edgeops-console
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.sh
More file actions
executable file
·48 lines (38 loc) · 1.18 KB
/
package.sh
File metadata and controls
executable file
·48 lines (38 loc) · 1.18 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
#!/usr/bin/env sh
#
# package.sh — build EdgeOps Console and tarball build/ for Controller embed.
#
set -e
. scripts/utils.sh
VERSION="$(node -p "require('./package.json').version")"
DISTRIBUTION="${VITE_DISTRIBUTION:-$(sh scripts/resolve-distribution.sh | tr -d '[:space:]')}"
DISTRO_NAME="edgeops-console_${DISTRIBUTION}_${VERSION}.tar.gz"
prettyTitle "EdgeOps Console packaging (${DISTRIBUTION})"
echoInfo "Beginning build-only packaging"
if [ -f "${DISTRO_NAME}" ]; then
echoInfo "Removing old artifact"
rm "${DISTRO_NAME}"
fi
echoInfo "Installing dependencies"
if [ -n "${CI}" ]; then
npm ci --legacy-peer-deps
else
npm install --legacy-peer-deps
fi
echoInfo "Building production app (VITE_DISTRIBUTION=${DISTRIBUTION})"
case "${DISTRIBUTION}" in
datasance|iofog)
npm run "build:${DISTRIBUTION}"
;;
*)
echoError "Unknown VITE_DISTRIBUTION: ${DISTRIBUTION} (expected datasance or iofog)"
exit 1
;;
esac
if [ ! -d build ]; then
echoError "build/ directory missing after vite build"
exit 1
fi
echoInfo "Creating tarball '${DISTRO_NAME}'"
tar -czvf "${DISTRO_NAME}" build/
echoInfo "Packaging complete: ${DISTRO_NAME}"