blob: 4aec72ac54c648b22a19bafaaa729d2976944078 (
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
|
# Maintainer: icepie <icepie@nicecode.ai>
pkgname=nicecode-tool
pkgver=1.3.7
pkgrel=1
pkgdesc="NiceCode API configuration tool for Claude, CodeX, and Gemini CLI tools"
arch=('any')
url="https://github.com/icepie/nicecode-tools"
license=('MIT')
provides=('nicecode')
depends=('nodejs>=18.12.0')
makedepends=('npm' 'jq')
source=("https://registry.npmjs.org/$pkgname/-/$pkgname-$pkgver.tgz")
noextract=("$pkgname-$pkgver.tgz")
sha256sums=('8402e51df5d09c21c04d3850967e6194858fca5426a6d843740e82b67bf7eaac')
package() {
npm install -g --prefix "$pkgdir/usr" "$srcdir/$pkgname-$pkgver.tgz"
# Remove references to $pkgdir
find "$pkgdir/usr" -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"
# npm gives ownership of ALL FILES to build user
# https://bugs.archlinux.org/task/63396
chown -R root:root "$pkgdir"
# Install license
install -Dm644 "$pkgdir/usr/lib/node_modules/$pkgname/LICENSE" \
"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
|