48 lines
1.5 KiB
Bash
48 lines
1.5 KiB
Bash
name='yarn'
|
|
version='1.22.22'
|
|
release='5'
|
|
desc='Fast, reliable, and secure dependency management.'
|
|
homepage='https://classic.yarnpkg.com/'
|
|
maintainer="Евгений Храмов <xpamych@yandex.ru>"
|
|
architectures=('all')
|
|
license=('BSD-2-Clause')
|
|
provides=('yarn')
|
|
conflicts=('yarn' 'yarn-git' 'yarnpkg')
|
|
|
|
deps=('nodejs')
|
|
build_deps=('git'
|
|
'jq'
|
|
'ripgrep'
|
|
'yarnpkg')
|
|
|
|
sources=("git+https://github.com/${name}pkg/$name.git#tag=v$version")
|
|
checksums=('SKIP')
|
|
|
|
build() {
|
|
cd $srcdir/$name
|
|
yarn --frozen-lockfile
|
|
yarn build
|
|
}
|
|
|
|
package() {
|
|
install -d "$pkgdir"/{usr/bin,/usr/lib/node_modules/$name/bin}
|
|
ln -s /usr/lib/node_modules/$name/bin/$name.js "$pkgdir"/usr/bin/$name
|
|
ln -s /usr/lib/node_modules/$name/bin/$name.js "$pkgdir"/usr/bin/${name}pkg
|
|
|
|
cd $name
|
|
# Prune unnecessary packages
|
|
cp package.json{,.bak}
|
|
read -ra devDependencies < <(jq -r '.devDependencies | keys | join(" ")' package.json)
|
|
yarn remove --frozen-lockfile "${devDependencies[@]}"
|
|
mv package.json{.bak,}
|
|
|
|
# Import userland punycode
|
|
readarray -t punycode_importers < <(rg -t js -l "require\('punycode'\)" node_modules)
|
|
sed -i "s,require('punycode'),require('punycode/')," "${punycode_importers[@]}"
|
|
|
|
cp -r lib node_modules package.json "$pkgdir"/usr/lib/node_modules/$name
|
|
install -t "$pkgdir"/usr/lib/node_modules/$name/bin bin/$name.js
|
|
install -Dm644 -t "$pkgdir"/usr/share/doc/$name README.md
|
|
install -Dm644 -t "$pkgdir"/usr/share/licenses/$name LICENSE
|
|
}
|