# -*- 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           npm 1.0
PortGroup           github 1.0

name                create-dmg-js
version             7.1.0
revision            0

categories          sysutils archivers
license             MIT
maintainers         {i0ntempest @i0ntempest} openmaintainer

description         Create a good-looking DMG for your macOS app in seconds
long_description    ${description}

homepage            https://github.com/sindresorhus/create-dmg

checksums           rmd160  1f0fcc0cf2db45c85238f9afba2e02d05edcf21e \
                    sha256  bd7afbe3af77c8b7920a24e908cfb417c3916c4006962c749b700fd2d6303cf5 \
                    size    1983643

npm.rootname        [join [lrange [split ${name} -] 0 1] -]

post-destroot {
    reinplace "s|error.code === 'ENOENT'|error.code === 'ENOENT' \\\|\\\| error.code === 'EACCES'|" \
        ${destroot}${prefix}/lib/node_modules/${npm.rootname}/compose-icon.js
}

variant dmg_icon description {Enable custom DMG icon based on the app icon} {
    depends_run-append \
                    port:ImageMagick \
                    port:GraphicsMagick
}

# Requires rebuilding if node version changes
platform darwin {
    if {${os.major} <= 20} {
        # 11.0-
        npm.nodejs_version \
                    18
        npm.version 9
    } else {
        npm.nodejs_version \
                    24
        npm.version 11
    }
}
