summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorfenuks2023-06-27 13:46:35 +0200
committerfenuks2023-06-27 13:46:41 +0200
commit4b6eefb03f2b489a2dda3938f9137a7a14142dcf (patch)
tree2ea6e17a5ba31dbdee194f36231a16475c662ff4
downloadaur-4b6eefb03f2b489a2dda3938f9137a7a14142dcf.tar.gz
Initial release
-rw-r--r--.SRCINFO16
-rw-r--r--PKGBUILD44
2 files changed, 60 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..018194ff906c
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,16 @@
+pkgbase = prettier-plugin-xml
+ pkgdesc = Prettier XML Plugin
+ pkgver = 2.2.0
+ pkgrel = 1
+ url = https://github.com/prettier/plugin-xml
+ arch = any
+ license = MIT
+ makedepends = npm
+ makedepends = jq
+ depends = prettier
+ depends = nodejs
+ noextract = plugin-xml-2.2.0.tgz
+ source = https://registry.npmjs.org/@prettier/plugin-xml/-/plugin-xml-2.2.0.tgz
+ sha256sums = 2eaee210ac28e182f06fd50797099d843d85ed78f5abaf1299c5c2861b523409
+
+pkgname = prettier-plugin-xml
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..d2492c3f79df
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,44 @@
+# Maintainer: fenuks, based
+
+pkgname=prettier-plugin-xml
+pkgver=2.2.0
+pkgrel=1
+pkgdesc='Prettier XML Plugin'
+arch=(any)
+url=https://github.com/prettier/plugin-xml
+license=(MIT)
+depends=(prettier nodejs)
+makedepends=(npm jq)
+source=("https://registry.npmjs.org/@${pkgname%%-*}/${pkgname#*-}/-/${pkgname#*-}-${pkgver}.tgz")
+noextract=("${pkgname#*-}-${pkgver}.tgz")
+sha256sums=('2eaee210ac28e182f06fd50797099d843d85ed78f5abaf1299c5c2861b523409')
+
+package() {
+ npm install -g --prefix "${pkgdir}/usr" --no-bin-links \
+ "${srcdir}/${pkgname#*-}-${pkgver}.tgz"
+ install -d "${pkgdir}/usr/share/licenses/${pkgname}"
+ ln -s "../../../lib/node_modules/@${pkgname%%-*}/${pkgname#*-}/LICENSE" \
+ "${pkgdir}/usr/share/licenses/${pkgname}/"
+
+ # `local json tempjson` is unnecessary because commands in pipelines are
+ # executed in their own subshells
+ local mainjson=${pkgdir}/usr/lib/node_modules/@${pkgname%%-*}/${pkgname#*-}/package.json
+ find "${pkgdir}/usr" -type f -name package.json -print0 |
+ while read -rd '' json; do
+ tempjson=$(mktemp)
+ if [ "${json}" = "${mainjson}" ]; then
+ jq 'with_entries(select(.key | test("^_.+") | not))' \
+ "${json}" >"${tempjson}"
+ else
+ jq 'del(._where,.man)' \
+ "${json}" >"${tempjson}"
+ fi
+ cp "${tempjson}" "${json}"
+ done
+
+ # See https://github.com/npm/npm/issues/9359
+ find "${pkgdir}/usr" -type d -exec chmod 755 '{}' +
+
+ # See https://bugs.archlinux.org/task/63396
+ chown -R root:root "${pkgdir}"
+}