blob: 9ef7703752e54d83bcee4725c2056acdc5b5d826 (
plain)
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
71
72
73
74
75
76
77
78
79
80
81
82
|
_electron='electron28'
pkgname=webcord
pkgver=4.6.1
pkgrel=2
pkgdesc='A Discord and SpaceBar Electron-based client implemented without Discord API'
arch=('any')
_repo='WebCord'
url="https://github.com/SpacingBat3/${_repo}"
license=('MIT')
depends=("${_electron}")
makedepends=('npm' 'esbuild')
options=('!strip' '!emptydirs')
_snapshot="${_repo}-${pkgver}"
source=(
"${_snapshot}.tar.gz::${url}/archive/v${pkgver}.tar.gz"
"buildInfo.json"
"webcord.desktop"
"webcord.sh"
)
sha256sums=(
'982edbd64ef19d95c27d765fff900a5f5c6d9b16a516e3346e2a1b5d18f0f99d'
'c803c7227982fad22390a8d6d11f3707171d5e9b1a394731a6a07773eab75b1f'
'5923151d1cc05d7e2ab0cb2103921f5f3985e08e48c74e7aa12003b32c0e2bae'
'2645eafeaae58769f958c7372c3522ec93034b678d4e7ca90ab872b8dbd18ee5'
)
prepare() {
cd "${_snapshot}"
npm ci --omit=dev --ignore-scripts --prefix=.
rm -r "sources/code/build"
rm "sources/assets/icons/app.ic"*
}
build() {
cd "${_snapshot}"
local flags=(
--outbase="sources"
--outdir="app"
--minify
--platform=node
--target=es2022
)
esbuild "sources/code/**/*.ts" \
"${flags[@]}" --format=cjs
esbuild "sources/code/**/*.mts" \
"${flags[@]}" --format=esm --out-extension:".js=.mjs"
}
package() {
local bin="/usr/bin"
local lib="/usr/lib/${pkgname}"
local icons="/usr/share/icons/hicolor/512x512/apps"
install -dm755 "${pkgdir}"{"${bin}","${lib}","${icons}"}
install -Dm644 "${source[1]}" \
-t "${pkgdir}${lib}"
install -Dm644 "${source[2]}" \
-t "${pkgdir}/usr/share/applications"
local exec="${pkgdir}${bin}/${pkgname}"
sed -e "s|@ELECTRON@|${_electron}|;s|@APP_DIR@|${lib}|" "${source[3]}" > "${exec}"
chmod +x "${exec}"
cd "${_snapshot}"
cp -r --parents "package.json" "app" "sources/"{"assets","translations"} "node_modules" \
-t "${pkgdir}${lib}"
install -Dm644 "LICENSE" \
-t "${pkgdir}/usr/share/licenses/${pkgname}"
ln -sT "../sources/translations" "${pkgdir}${lib}/app/translations"
ln -sT "${lib}/sources/assets/icons/app.png" "${pkgdir}${icons}/${pkgname}.png"
}
|