tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

packaging software using npm



Hi!

I got interested in packaging software that is installed with npm
(usually JavaScript).

By default, npm installs the latest versions of dependencies from the
network. But there is a mode to wire down the particular dependencies
found "right now" (like Cargo.lock for Rust), and npm can also be told
to use a cache. The cache is not very user-friendly, it contains files
that are named according to their hashes.

I've collected the logic in npm.mk which I plan to put into
lang/nodejs/npm.mk after a bit more testing. A proof-of-concept
package for prettier (a JavaScript code formatter) using npm.mk is in
wip/prettier.

If you want to try it out for packaging other software, there's
basically just one extra step compared to other packages - you need to
create the tarball containing the cache for pkgsrc. So start a package
like usual and include npm.mk (currently in
wip/prettier/npm.mk). After a 'make extract' run 'make update-cache' -
this creates an extra 'cache' distfile that needs to be copied into
your distfiles directory (and uploaded to ftp.NetBSD.org, if you're
packaging for the public).

Read npm.mk if you're interested in details, or ask me if details are
unclear.

I've also tried using npm.mk for eslint, but that depends on node-re2,
which contains C++ code including a copy of abseil, which fails to
build on NetBSD without patches, so this (and probably other packages
compiling dependencies) will need more work.

Cheers,
 Thomas


Home | Main Index | Thread Index | Old Index