summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: fd58b7e91cf07ae49528991d03cf8c88c0b6418b (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
# Maintainer: Nek.12 <vaizin.nikita@gmail.com>
pkgname='notion-enhancer'
pkgver=0.8.5
pkgrel=1
pkgdesc="An enhancer/customiser for the all-in-one productivity workspace notion.so"
arch=('any')
url="https://github.com/dragonwocky/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")
noextract=("${pkgname}-${pkgver}.tgz" )
md5sums=('ee7be9e15ed966ab1d6c901aa66ab162')
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"
}