# Template file for 'yarn'
pkgname=yarn
version=1.16.0
revision=1
hostmakedepends="yarn-bin nodejs"
depends="virtual?nodejs-runtime"
short_desc="Fast, reliable, and secure dependency management"
maintainer="Michael Aldridge <maldridge@voidlinux.org>"
license="BSD-2-Clause"
homepage="https://yarnpkg.com/"
distfiles="https://github.com/yarnpkg/${pkgname}/archive/v${version}.tar.gz"
checksum=c36b81ed37960be4dd5eea9d661c66f573759ed691441ed5ef24c61bef03125b

conflicts="yarn-bin>=0"

case "$XBPS_TARGET_MACHINE" in
	i686*) broken="https://build.voidlinux.org/builders/i686_builder/builds/15057/steps/shell_3/logs/stdio"
esac

pre_build() {
	yarn
}

do_build() {
	yarn run build-dist
}

do_install() {
	vmkdir /usr/lib/yarn
	vmkdir /usr/bin
	vcopy dist/lib/v8-compile-cache.js /usr/lib/yarn
	vcopy dist/lib/cli.js /usr/lib/yarn
	vbin dist/bin/yarn.js yarn
	ln -rs ${DESTDIR}/usr/bin/yarn ${DESTDIR}/usr/bin/yarnpkg
}

post_install() {
	vlicense LICENSE
}
