maintainer="Hoang Nguyen <folliekazetani@protonmail.com>"
pkgname=typstyle
pkgver=0.12.14
pkgrel=0
pkgdesc="Beautiful and reliable typst code formatter"
url="https://enter-tainer.github.io/typstyle/"
arch="all"
license="Apache-2.0"
makedepends="cargo cargo-auditable openssl-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/Enter-tainer/typstyle/archive/refs/tags/v$pkgver.tar.gz
	skip-sensitive-test.patch
	"

export OPENSSL_NO_VENDOR=1
export PKG_CONFIG_ALL_DYNAMIC=1

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release --bin typstyle
}

check() {
	# Remove the default `consistency` feature in typstyle-tests crate.
	# The feature enables running repo-e2e tests, which easily panic on our builder.
	cargo test --frozen --workspace --no-default-features
}

package() {
	install -Dm755 target/release/typstyle -t "$pkgdir"/usr/bin/
}

sha512sums="
76ed0780e03fcb4b22774fe01ae3d8ba6e47e0330d8c6635ac0d94acf507b199f110581d85e443738b8ffc678554e02deaf5be1bc6f7ad3775e6c23212e24dc9  typstyle-0.12.14.tar.gz
466fedd6eef1fc6bf3408a4836e7271b797131761d046096da94f986c00e897bfcf14416758dd6469a08dbf2884e28a4467b929554422b866317b56d235ee0ce  skip-sensitive-test.patch
"
