Hi,

Just some info: Fedora will drop those gillionish nodejs packages entirely in next version, and endorse the "vendoring"[0]. Debian discussed it too recently [1]

[0] https://fedoraproject.org/wiki/Changes/NodejsLibrariesBundleByDefault
[1] https://lwn.net/SubscriberLink/842319/8adb13e08d0302bd/

shenle

On Mon, Jan 18, 2021 at 12:13 PM Ludwig Nussel <ludwig.nussel@suse.de> wrote:
Dan Čermák wrote:
> do we have any guidelines for packaging applications that require nodejs
> libraries?
>
> The new release of rstudio includes a web based editor written in
> typescript. And as usual, it has a *huge* dependency graph. Would it be
> fine if I just bundle them inside rstudio, because there's no way that
> I'll be able to package the full dependency graph of those node modules.

For those not into Node.js.. huge really means huge in this context. For
cockpit that only uses some Nodejs for minifying js and css at build
time it's 1000+ tarballs. Sometimes four versions of the same module at
the same time. So insane that it's basically impossible to either
package individually, nor to manage manually in any way. The only chance
is to bundle.
I hate packages that have some magic "vendor.tar.gz" that nobody knows
how it was created though.
So I came up with an obs service¹ to handle the nodejs modules. It
manages source lines in the spec file generated from package-lock.json
and also downloads the tarballs. So the package actually refers to
pristine upstream sources and the packager does not have to manually
deal with them.
Downside is that you end up with a package that has more than a thousand
source tarballs. That is only viable when done on server side. Otherwise
you wouldn't see the forest for all the trees anymore. Iow service mode
"enabled" is required, ie can't be included in the distro so far. I'm
trying to figure out ways to get around that atm.
The obs service is deployed on build.opensuse.org already so you can
play with it.

Adam just wrote an npm proxy² so "npm install" can be used offline at
build time. To be integrated. IOW no turnkey solution yet, all WIP.

cu
Ludwig

[1] https://github.com/openSUSE/obs-service-node_modules
[2] https://github.com/openSUSE/npm-localhost-proxy

--
 (o_   Ludwig Nussel
 //\
 V_/_  http://www.suse.com/
SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer
HRB 36809 (AG Nürnberg)