nodejs-packagiing improvements

T.C. Hollingsworth tchollingsworth at
Wed Mar 19 17:19:54 UTC 2014

I've pushed a few new nodejs-packaging features to an "experimental"
branch in the git repository:

The changes include:

- %nodejs_fixdep now supports a --dev argument to affect devDependencies

This is used by the jquery review I recently filed to drop
dependencies on the nonfree jshint library.

- %nodejs_fixdep also supports an --optional argument to affect

I added this for completeness' sake.  We currently don't do anything
with optionalDependencies.  If the plans for soft dependencies come to
fruition and they support automatic population like normal Requires
then we'll probably start doing something with these, but for now we
ignore them.

- %nodejs_symlink_deps now supports a --force argument

This argument overrides failing the build when bundled dependencies
are encountered in node_modules.  This can be used during development
to allow you to mix system-provided and npm-provided modules.  It
should _never_ be used in an official Fedora package.

- %nodejs_symlink_deps now supports --build as an alias for --check

This switch more accurately reflects what it does (i.e. it works in
the build directory not the buildroot directory) and doesn't look so
weird in %build sections.  ;-)

And finally, the biggie:

- Support for the caret (^) operator was added to the dependency generator.

This has been supported in npm for about a year now, but the
dependency generator never knew about it.  It also hasn't really
gained traction in the wild till very recently. (old npm versions that
don't support it are slowly dying out...)

The semantics of this new operator are described in detail here:

Basically, ^1.2.3 is the equivalent of ">1.2.3 <2".  This is much
better for our purposes than the "~1.2.3" form used by many packages,
which translates to ">1.2.3 <1.3".  Undoubtedly many of us will want
to start using it in %nodejs_fixdep for certain recalcitrant packages.

Testing builds of the new nodejs-packaging are available from this copr:

Please try it out and let me know if there's anything broken, any more
improvements you've just been dying to have, etc.


More information about the nodejs mailing list