mirror of
https://src.fedoraproject.org/rpms/nodejs18.git
synced 2024-11-28 11:06:08 +00:00
Move bundled NPM deps
If a user does `npm -g update npm` (not recommended), they can dangerously clobber their system because it will remove the .bundled directory. This patch moves it to a safer location. Resolves: rhbz#1565256 Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
This commit is contained in:
parent
1e2b51b3b4
commit
e88700c9c2
1 changed files with 8 additions and 3 deletions
11
nodejs.spec
11
nodejs.spec
|
@ -380,16 +380,18 @@ mv %{buildroot}/%{_datadir}/doc/node/gdbinit %{buildroot}/%{_pkgdocdir}/gdbinit
|
|||
# can backtrack on this if we decide to.
|
||||
|
||||
# Rename the npm node_modules directory to node_modules.bundled
|
||||
mkdir -p %{buildroot}/%{_prefix}/lib/node/.bundled
|
||||
mv %{buildroot}/%{_prefix}/lib/node_modules/npm/node_modules \
|
||||
%{buildroot}/%{_prefix}/lib/node_modules/npm/node_modules.bundled
|
||||
%{buildroot}/%{_prefix}/lib/node/.bundled/npm
|
||||
|
||||
# Recreate all the symlinks
|
||||
mkdir -p %{buildroot}/%{_prefix}/lib/node_modules/npm/node_modules
|
||||
FILES=%{buildroot}/%{_prefix}/lib/node_modules/npm/node_modules.bundled/*
|
||||
FILES=%{buildroot}/%{_prefix}/lib/node/.bundled/npm/*
|
||||
for f in $FILES
|
||||
do
|
||||
module=`basename $f`
|
||||
ln -s ../node_modules.bundled/$module %{buildroot}%{_prefix}/lib/node_modules/npm/node_modules/$module
|
||||
ln -s %{_prefix}/lib/node/.bundled/npm/$module \
|
||||
%{buildroot}%{_prefix}/lib/node_modules/npm/node_modules/$module
|
||||
done
|
||||
|
||||
# install NPM docs to mandir
|
||||
|
@ -430,6 +432,8 @@ NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules %{buildroot}/%{_bindir}/node -
|
|||
%files
|
||||
%{_bindir}/node
|
||||
%dir %{_prefix}/lib/node_modules
|
||||
%dir %{_prefix}/lib/node
|
||||
%dir %{_prefix}/lib/node/.bundled
|
||||
%dir %{_datadir}/node
|
||||
%dir %{_datadir}/systemtap
|
||||
%dir %{_datadir}/systemtap/tapset
|
||||
|
@ -463,6 +467,7 @@ NODE_PATH=%{buildroot}%{_prefix}/lib/node_modules %{buildroot}/%{_bindir}/node -
|
|||
%{_bindir}/npm
|
||||
%{_bindir}/npx
|
||||
%{_prefix}/lib/node_modules/npm
|
||||
%{_prefix}/lib/node/.bundled/npm
|
||||
%ghost %{_sysconfdir}/npmrc
|
||||
%ghost %{_sysconfdir}/npmignore
|
||||
%doc %{_mandir}/man*/npm*
|
||||
|
|
Loading…
Reference in a new issue