-
Notifications
You must be signed in to change notification settings - Fork 0
/
PKGBUILD
91 lines (78 loc) · 3.31 KB
/
PKGBUILD
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
83
84
85
86
87
88
89
90
91
#!/bin/bash
# Disable various shellcheck rules that produce false positives in this file.
# Repository rules should be added to the .shellcheckrc file located in the
# repository root directory, see https://github.com/koalaman/shellcheck/wiki
# and https://archiv8.github.io for further information.
# shellcheck disable=SC2034,SC2154
# ToDo: Add files: User documentation
# ToDo: Add files: Tooling
# ToDo: Ensure license is installed
# ToDo: Ensure name change from nodejs-lerna to just lerna works
# FixMe: Namcap warnings and errors
# Maintainer: Ross Clark <[email protected]>
# Contributor: Ross Clark <[email protected]>
_langname="nodejs"
_relname="lerna"
_repo="https://registry.npmjs.org"
# pkgbase=
pkgname="${_relname}"
pkgver=5.1.6
pkgrel=1
#epoch=
pkgdesc="A tool that assists in managing JavaScript projects with multiple packages."
arch=("any")
url="https://lerna.org"
license=("MIT")
# groups
depends=("nodejs")
# optdepends=()
makedepends=("npm" "jq")
# checkdepends=()
provides=("nodejs-lerna")
conflicts=("nodejs-lerna")
replaces=("nodejs-lerna")
# backup=()
# options=()
# install=
# changelog="CHANGELOG.md"
source=(
"$_repo/$_relname/-/$_relname-$pkgver.tgz"
# "CHANGELOG.md"
# "README.md"
)
noextract=("$_relname-$pkgver.tgz")
# validpgpkeys=()
sha512sums=('7a22e3dc8bab6c46acd6b1ad9ed5b809fdbfeb2f743adda841a536c2fe2ea36ac77fa1915d40446749eb138cac78394db6c4bf1fb6ea7ebbe50186f73d6506d4')
package() {
# Ensure cache is set when install is run in order to avoid littering user's home directory
printf "\e[1;32m==>\e[0m \e[38;5;248mBuilding nodejs package... \e[0m\n"
printf " This may take some time depending on the size of the package and number of dependencies to download... \e[0m\n"
npm install --cache "$srcdir/npm-cache" -g --prefix "$pkgdir"/usr "$srcdir"/$_relname-$pkgver.tgz
# Fix incorrect user / group as highlighted by namcap
printf "\e[1;32m==>\e[0m \e[38;5;248mCorrecting possible ownership issues\e[0m\n"
while IFS= read -r fsitem; do
chown -h root:root "$fsitem"
done < <(find "$pkgdir" -not -group root -not -user root)
# Non-deterministic race in npm gives 777 permissions to random directories.
# See https://github.com/npm/npm/issues/9359 for details.
printf "\e[1;32m==>\e[0m \e[38;5;248mCorrecting possible permission issues on directories\e[0m\n"
find "$pkgdir/usr" -type d -exec chmod 755 '{}' +
# Remove references to $pkgdir
printf "\e[1;32m==>\e[0m \e[38;5;248mRemoving references to \$pkgdir\e[0m\n"
find "$pkgdir" -type f -name package.json -print0 | xargs -0 sed -i "/_where/d"
# Remove references to $srcdir
printf "\e[1;32m==>\e[0m \e[38;5;248mRemoving references to \$srcdir \e[0m\n"
local tmppackage="$(mktemp)"
local pkgjson="$pkgdir/usr/lib/node_modules/$_relname/package.json"
jq '.|=with_entries(select(.key|test("_.+")|not))' "$pkgjson" > "$tmppackage"
mv "$tmppackage" "$pkgjson"
chmod 644 "$pkgjson"
# Install license
# install -dm755 "${pkgdir}/usr/share/licenses/${pkgname}"
# ln -s ../../../lib/node_modules/eslint/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
# Create Archiv8 documentation folder
# install -dvm 755 "$pkgdir/usr/share/doc/$pkgname/packaging/"
# Install Archiv8 Documentation
# install -Dm 644 "CHANGELOG.md" "$pkgdir/usr/share/doc/$pkgname/packaging/CHANGELOG.md"
# install -Dm 644 "README.md" "$pkgdir/usr/share/doc/$pkgname/packaging/README.md"
}