Re: Guidance on creating a port for an npm installed tool

From: Moin Rahman <bofh_at_freebsd.org>
Date: Fri, 09 Jun 2023 18:15:16 UTC

> On Jun 9, 2023, at 8:11 PM, Patrick M. Hausen <hausen@punkt.de> wrote:
> 
> Hi all,
> 
> is there some general guide on how to go about creating a port
> for anything implemented in node.js and using npm to download
> all sorts of dependencies at build/install time?
> 
> I'd like to see a port of this:
> https://github.com/louislam/uptime-kuma
> 
> Similarly a port of mineos would be awesome.
> 
> Cloning from Github and running npm works and delivers a
> functional installation in ${WRKSRC} ...
> 
> What now?
> 
> I did not find any detailled help in the handbook or by searching.
> There seems to be a general method if all modules are available
> in npm (they have a repository it seems).
> 
> But what with products like these?
> 
> For Go applications there are very convenient tools to get
> all the dependencies into the port Makefile and do it in a clean way.
> 
> Section 6.5.8 here:
> https://docs.freebsd.org/en/books/porters-handbook/special/#building
> 
> So any help with porting these would be greatly appreciated.
> 
> Kind regards,
> Patrick
> -- 
> punkt.de GmbH
> Patrick M. Hausen
> .infrastructure
> 
> Sophienstr. 187
> 76185 Karlsruhe
> 
> Tel. +49 721 9109500
> 
> https://infrastructure.punkt.de
> info@punkt.de
> 
> AG Mannheim 108285
> Geschäftsführer: Jürgen Egeling, Daniel Lienert, Fabian Stein
> 
> 

There is no specific guidelines but so far what have been most useful
is you install the package and then install the npm deps. After that
create a tarball of the npm deps installed and add it as a DISTFILE.

One another approach is just install the dist with node as a RUN_DEPEND
and ask user to install it through a pkg-message.

Kind regards,
Moin