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

From: Pete Wright <pete_at_nomadlogic.org>
Date: Fri, 09 Jun 2023 18:38:20 UTC

On 6/9/23 11:11, Patrick M. Hausen 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.

i've had to build node/js code in the past internally and i've found 
that whole ecosystem is awkward at best to work with (ports or not).

i did poke around the ports tree just now and found www/hedgedoc which 
makes use of yarn for building, it may be worth taking a look at that 
Makefile for inspiration.  for my internal pkgs i did something similar 
that is in the "do-build" section iirc.

-pete

-- 
Pete Wright
pete@nomadlogic.org
@nomadlogicLA