Re: npm install, ports and poudriere

From: Emanuel Haupt <ehaupt_at_FreeBSD.org>
Date: Fri, 13 Jan 2023 10:21:03 UTC
Matthias Fechner <idefix@fechner.net> wrote:
> Am 13.01.2023 um 04:30 schrieb Hiroo Ono (小野寛生):
> > I made a port of MongoDB
> > Compasshttps://www.mongodb.com/docs/compass/current/  . As it is an
> > electron app, I need to use "npm install" to build it.
> >
> > npm install does not work without network connection, while
> > poudriere allow network connection only at fetch time.
> > As a result, I need to do bunch of things in fetch mode, and the
> > Makefile became as attached. Is this acceptable as a port?
> > If not, I need to rework the Makefile to do npm install at build
> > time, but that makes the port not officially buildable I think.
> > (though to each of us, there is ALLOW_NETWORKING_PACKAGES option in
> > poudriere.conf)
> 
> there are several frameworks that bring there own dependency
> management with it (go, node,  rust, ...).
> Go also needs to fetch dependencies and maybe it is an idea to do the
> in a post-fetch step.
>
> I and go is doing it be using something similar like this:
> https://cgit.freebsd.org/ports/tree/devel/gitaly/Makefile#n60
> 
> Maybe this can be done in a similar way for npm?

You can query the npm dist tarballs with:

$ npm view jquery dist.tarball
https://registry.npmjs.org/jquery/-/jquery-3.6.3.tgz

Download and unpack it:

$ npm install --prefix $(make -CWRKDIR) wipeclean@1.1.0

I did something similar with games/wipeclean.

Emanuel