#14 Treat only external dependency links as un-bundled
Merged by tomh. Opened by jstanek.
jstanek/nodejs-packaging pr/nodejs.req-bundled-detection  into  master

Download 14.patch

When a previously un-bundled dependency becomes bundled, it is sometimes desirable to keep the actual path in node_modules as a symlink in order to keep RPM happy. In that case, the dependencies might be stored in i.e. node_modules.bundled directory, and the node_modules directory would contain symlinks to them.

This change tweaks the detection of un-bundled dependencies, so that in the above case the symlinks are still treated as bundled.


Real-life example of this situation, taken from the specfile for rh-nodejs8-nodejs from CentOS:

# Since the old version of NPM was unbundled, there are a lot of symlinks in
# it's node_modules directory. We need to keep these as symlinks to ensure we
# can backtrack on this if we decide to.
# Rename the npm node_modules directory to node_modules.bundled
mv %{buildroot}/%{_prefix}/lib/node_modules/npm/node_modules \
   %{buildroot}/%{_prefix}/lib/node_modules/npm/node_modules.bundled
# Recreate all the symlinks
mkdir -p %{buildroot}/%{_prefix}/lib/node_modules/npm/node_modules
FILES=%{buildroot}/%{_prefix}/lib/node_modules/npm/node_modules.bundled/*
for f in $FILES
do
  module=`basename $f`
  ln -s ../node_modules.bundled/$module %{buildroot}%{_prefix}/lib/node_modules/npm/node_modules/$module
done

Note: This is the slight change mentioned in the previous PR. Once this is resolved, I have no further changes planned, and a new release can be made.

Pull-Request has been merged by tomh

Metadata