summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 40241131bf3592b8008b77d087d84c5e712f5713 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Maintainer: Heddxh <g311571057 at gmail dot com>
# Contributor: tippfehlr <tippfehlr@tippfehlr.eu>
# Contributor: Chewing_Bever
pkgname=fish-lsp
pkgver=1.0.8_4
_pkgver=${pkgver//_/-}
pkgrel=1
pkgdesc="LSP implementation for the fish shell language"
# tree-sitter contains compiled files
arch=('x86_64')
url="https://github.com/ndonfris/fish-lsp"
license=('MIT')
depends=('fish' 'nodejs' 'python')
makedepends=('git' 'yarn') # 'typescript' tsc doesn’t work
provides=($pkgname)
conflicts=(${pkgname}-git)
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${_pkgver}.tar.gz")
sha256sums=('426816e99134dbd5ef0f1fba40f3ca7fdb02792711715af3f8f13b1f07f2abdf')

prepare() {
    cd "${pkgname}-${_pkgver}"
    yarn --frozen-lockfile --ignore-scripts
}

build() {
    cd "${pkgname}-${_pkgver}"
    ./node_modules/.bin/tsc
    ./bin/fish-lsp complete >./fish-lsp.fish
}

package() {
    cd "${pkgname}-${_pkgver}"
    mkdir -p "$pkgdir/usr/bin"
    mkdir -p "$pkgdir/usr/lib/node_modules/fish-lsp"

    rm -r node_modules/@types
    cp -r node_modules out package.json fish_files "$pkgdir/usr/lib/node_modules/fish-lsp"
    # nvim-lspconfig doesn’t work without this symlink
    ln -s /usr/lib/node_modules/fish-lsp/node_modules/@esdmr/tree-sitter-fish/tree-sitter-fish.wasm \
        "$pkgdir/usr/lib/node_modules/fish-lsp/"

    printf "%s\n" "#!/usr/bin/env node" "require('/usr/lib/node_modules/fish-lsp/out/cli');" >"$pkgdir/usr/bin/fish-lsp"
    chmod 755 "$pkgdir/usr/bin/fish-lsp"

    install -Dm644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
    install -Dm644 "fish-lsp.fish" "$pkgdir/usr/share/fish/vendor_completions.d/fish-lsp.fish"
}