# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ajv-cli
pkgver=6.0.0
pkgrel=0
pkgdesc="Command-line interface for Ajv JSON Validator"
url="https://github.com/jirutka/ajv-cli"
# s390x: rollup throws Error: Unknown node type
arch="noarch !s390x"
license="MIT"
depends="nodejs"
makedepends="npm"
subpackages="$pkgname-doc"
source="https://github.com/jirutka/ajv-cli/archive/v$pkgver/ajv-cli-$pkgver.tar.gz"
# net: downloads packages from npmjs.org
options="net"

prepare() {
	default_prepare

	npm clean-install --no-fund --no-scripts
}

build() {
	npm run bundle
}

check() {
	# NOTE: test-only is broken
	npm run test

	rm -rf node_modules
	node dist/ajv.cjs --version
}

package() {
	install -D -m755 dist/ajv.cjs "$pkgdir"/usr/bin/ajv
	install -D -m644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}

sha512sums="
2ed746b1b5025d080ff3b927e9d2e4296d6d09779ff82cd39781eac65733eef74010aa6eb7ef99e8bee96769aac835658d98660ce622caf65ae2910b7252adcc  ajv-cli-6.0.0.tar.gz
"
