# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0

github.setup        lensapp lens 6.3.0 v
github.tarball_from archive
revision            0

homepage            https://k8slens.dev

description         Lens - The Kubernetes IDE

long_description    \
    Lens is the most powerful IDE for people who need to deal with Kubernetes \
    clusters on a daily basis. Ensure your clusters are properly setup and \
    configured. Enjoy increased visibility, real time statistics, log streams \
    and hands-on troubleshooting capabilities.

categories          sysutils
installs_libs       no
license             MIT
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

checksums           rmd160  91ca4e8be00de0df450470157fd7def6134873b5 \
                    sha256  1daafef51300d9dd66aa6a3e8a776f4b837dd818678255876dacd6c54c152859 \
                    size    8661100

depends_build       path:bin/npm:npm8 \
                    path:/bin/node:nodejs16 \
                    port:python310 \
                    port:yarn

build.env-append    PATH=${workpath}/bin:$env(PATH)

build.target        build

use_configure       no
use_parallel_build  no
use_xcode           yes

# Patch package.json to allow using Node versions higher than 14
patchfiles          patch-package.json.diff

post-extract {
    file mkdir ${workpath}/bin
    ln -s ${prefix}/bin/python3.10 ${workpath}/bin/python
}

post-patch {
    reinplace \
        {s|^ELECTRON_BUILDER_EXTRA_ARGS.*|ELECTRON_BUILDER_EXTRA_ARGS = --mac --dir|} \
        ${worksrcpath}/Makefile
}

destroot {
    copy \
        [glob ${worksrcpath}/dist/mac*/OpenLens.app] \
        ${destroot}${applications_dir}/
}

github.livecheck.regex {([0-9.]+)}
