-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdist.bash
More file actions
executable file
·71 lines (54 loc) · 1.81 KB
/
dist.bash
File metadata and controls
executable file
·71 lines (54 loc) · 1.81 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
readonly DOMAIN=bp.tali.software
cd "$(dirname $0)"
cd "$(git rev-parse --show-toplevel)"
pkg="blueprint-web"
dsc="Blueprint website configuration"
mtr="$(jq -r .author < package.json)"
ver="$(jq -r .version < package.json)"
rev=${1:-0}
tmpdir=
function cleanup {
set +e
[[ -n "${tmpdir}" ]] && rm -rf "${tmpdir}"
}
trap cleanup EXIT
set -ex
tmpdir="$(mktemp -d blueprint.XXXXXXXXXXXX)"
root="${tmpdir}/root"
export NODE_ENV=production
npm install . || exit 1
# TODO [#12] should lint before building
npx esbuild ./src/app --outdir="${tmpdir}" \
--bundle \
--global-name=App \
--platform=browser \
--minify \
--loader:.bin=binary
npx sass ./src/style/index.scss "${tmpdir}/style.css" \
--no-source-map \
--style=compressed
npx ejs ./src/index.ejs --output-file "${tmpdir}/index.html" \
--data-file ./package.json \
--rm-whitespace --strict \
"domain=${DOMAIN}"
www="${root}/usr/share/blueprint-web/www"
mkdir -p "${www}" "${root}/etc/nginx/sites-available"
install -m 644 "${tmpdir}/app.js" "${www}/bundle.js"
install -m 644 "${tmpdir}/style.css" "${www}/style.css"
install -m 644 "${tmpdir}/index.html" "${www}/index.html"
install -m 644 "resources/icon/16x16.ico" "${www}/favicon.ico"
install -m 644 "resources/icon/160x160.png" "${www}/icon-md.png"
install -m 644 "src/nginx.conf" "${root}/etc/nginx/sites-available/blueprint"
ctl="${root}/DEBIAN/control"
mkdir -p "${root}/DEBIAN"
install -m 755 "src/postinst.bash" "${root}/DEBIAN/postinst"
echo "Package: ${pkg}" > "${ctl}"
echo "Version: ${ver}" >> "${ctl}"
echo "Maintainer: ${mtr}" >> "${ctl}"
echo "Description: ${dsc}" >> "${ctl}"
echo "Architecture: all" >> "${ctl}"
echo "Depends: nginx-core" >> "${ctl}"
deb="dist/${pkg}_${ver}-${rev}_all.deb"
mkdir -p dist
dpkg-deb --root-owner-group -b "${root}" "${deb}"