summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a5b1b568c63c74a58010704fea00c72fac3ed4fe (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
# Maintainer: Nek.12 <vaizin.nikita@gmail.com>
pkgname='notion-enhancer'
pkgver=0.10.2
pkgrel=4
pkgdesc="An enhancer/customiser for the all-in-one productivity workspace notion.so"
arch=('any')
url="https://github.com/notion-enhancer/notion-enhancer"
license=('MIT')
groups=()
depends=('notion-app>=1:2.0.7-3.2'
         'nodejs>=14.8.0-1'
         'asar>=3.0.3-1')
makedepends=('npm' 'jq')
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=$pkgname
source=("https://registry.npmjs.org/notion-enhancer/-/$pkgname-$pkgver.tgz"
        "reapply-notion-enhancer.hook" "reapply-notion-enhancer-2.hook")
noextract=("${pkgname}-${pkgver}.tgz" )
md5sums=('4dbc118072fdc9ffd9af0efd4c0c8997' 'fb1bff2ff2865bf25e8fdc76bf2641a3' 'f0ea114ae5cc18202ccbd9f702ba11b4') #tgz, hook, hook2
package() {
    npm install --ignore-scripts -g --user root --cache "${srcdir}/npm-cache" --prefix "${pkgdir}/usr" "${srcdir}/${pkgname}-${pkgver}.tgz"

    #fix file permissions
    find "${pkgdir}/usr" -type d -exec chmod 755 {} +
    chown -R root:root "${pkgdir}"

    # Remove references to $pkgdir
	find "$pkgdir" -type f -name package.json -print0 | xargs -0 sed -i "/_where/d"

	# Remove references to $srcdir
	local tmppackage="$(mktemp)"
	local pkgjson="$pkgdir/usr/lib/node_modules/$pkgname/package.json"
	jq '.|=with_entries(select(.key|test("_.+")|not))' "$pkgjson" > "$tmppackage"
	mv "$tmppackage" "$pkgjson"
	chmod 644 "$pkgjson"

	#add pacman hooks
	install -Dm 644 "${srcdir}/reapply-notion-enhancer.hook" -t "${pkgdir}/usr/share/libalpm/hooks"
	install -Dm 644 "${srcdir}/reapply-notion-enhancer-2.hook" -t "${pkgdir}/usr/share/libalpm/hooks"
}