[packages/npm] up to 10.9.3
atler
atler at pld-linux.org
Thu Jul 10 13:11:52 CEST 2025
commit 5352c0dacf2ffbc52f9dc11f6aea8ed125dfc5e6
Author: Jan Palus <atler at pld-linux.org>
Date: Thu Jul 10 13:11:33 2025 +0200
up to 10.9.3
cmd-shim-optional.patch | 23 ----------
global-config-path.patch | 11 +++++
link-globalPaths.patch | 106 +++++++++++++++++++++++++++++++----------------
npm.spec | 54 ++++++++----------------
4 files changed, 100 insertions(+), 94 deletions(-)
---
diff --git a/npm.spec b/npm.spec
index 22cda00..5d0fd13 100644
--- a/npm.spec
+++ b/npm.spec
@@ -9,20 +9,20 @@
Summary: A package manager for node.js
Summary(pl.UTF-8): Zarządca pakietów dla node.js
Name: npm
-Version: 6.14.15
-Release: 2
+Version: 10.9.3
+Release: 1
License: Artistic v2.0
Group: Development/Tools
Source0: https://registry.npmjs.org/npm/-/%{name}-%{version}.tgz
-# Source0-md5: 51bb7ac69421253bdf08c7a09b7966bc
+# Source0-md5: 6888d33b9561affd1bcbb4596524a2e7
Patch0: link-globalPaths.patch
-Patch1: cmd-shim-optional.patch
+Patch1: global-config-path.patch
URL: https://www.npmjs.com/
BuildRequires: bash
-BuildRequires: nodejs >= 6
+BuildRequires: nodejs >= 20.5.0
BuildRequires: rpmbuild(macros) >= 1.634
BuildRequires: sed >= 4.0
-Requires: nodejs >= 6
+Requires: nodejs >= 20.5.0
%if %{without bundled_gyp}
Suggests: nodejs-gyp = 5.1.0
Conflicts: nodejs-gyp < 5.1.0
@@ -74,22 +74,13 @@ for i in README.markdown LICENSE \
find node_modules -name $i -print0 | sort -rz | xargs -0r %{__rm} -rv
done
find node_modules -name \*.md -print0 -exec %{__rm} -v {} \;
-%{__rm} lib/fetch-package-metadata.md
-
-%build
-# forces npm to keep config files in /etc instead of /usr/etc
-./configure \
- --globalconfig=%{_sysconfdir}/npmrc \
- --globalignorefile=%{_sysconfdir}/npmignore
-
-cat npmrc
%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT{%{_bindir},%{nodejs_libdir}/npm/bin,/etc/bash_completion.d}
install -d $RPM_BUILD_ROOT%{nodejs_libdir}/npm/bin
-cp -a lib npmrc package.json $RPM_BUILD_ROOT%{nodejs_libdir}/npm
+cp -a lib package.json $RPM_BUILD_ROOT%{nodejs_libdir}/npm
cp -p bin/*.js $RPM_BUILD_ROOT%{nodejs_libdir}/npm/bin
ln -s %{nodejs_libdir}/npm/bin/npm-cli.js $RPM_BUILD_ROOT%{_bindir}/npm
ln -s %{nodejs_libdir}/npm/bin/npx-cli.js $RPM_BUILD_ROOT%{_bindir}/npx
@@ -105,9 +96,8 @@ cp -a docs/content/* $RPM_BUILD_ROOT%{nodejs_libdir}/npm/doc
# ghosted global config files
# TODO: package as files to have file permissions set
-install -d $RPM_BUILD_ROOT%{_sysconfdir}
-cp -p npmrc $RPM_BUILD_ROOT%{_sysconfdir}/npmrc
-touch $RPM_BUILD_ROOT%{_sysconfdir}/npmignore
+install -d $RPM_BUILD_ROOT/etc
+touch $RPM_BUILD_ROOT/etc/npmrc
# install to mandir
install -d $RPM_BUILD_ROOT%{_mandir}
@@ -124,33 +114,25 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
-%doc AUTHORS CHANGELOG.md LICENSE README.md
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/npmrc
-%ghost %{_sysconfdir}/npmignore
+%doc LICENSE README.md
+%config(noreplace) %verify(not md5 mtime size) /etc/npmrc
%attr(755,root,root) %{_bindir}/npm
%attr(755,root,root) %{_bindir}/npx
%dir %{nodejs_libdir}/npm
%{nodejs_libdir}/npm/package.json
-%{nodejs_libdir}/npm/npmrc
%dir %{nodejs_libdir}/npm/bin
%attr(755,root,root) %{nodejs_libdir}/npm/bin/npm-cli.js
+%attr(755,root,root) %{nodejs_libdir}/npm/bin/npm-prefix.js
%attr(755,root,root) %{nodejs_libdir}/npm/bin/npx-cli.js
-%dir %{nodejs_libdir}/npm/lib
-%{nodejs_libdir}/npm/lib/*.js
-%{nodejs_libdir}/npm/lib/auth
-%{nodejs_libdir}/npm/lib/config
-%{nodejs_libdir}/npm/lib/doctor
-%{nodejs_libdir}/npm/lib/install
-%{nodejs_libdir}/npm/lib/search
-%{nodejs_libdir}/npm/lib/utils
+%{nodejs_libdir}/npm/lib
%{nodejs_libdir}/npm/node_modules
# man symlink
%{nodejs_libdir}/npm/man
%dir %{nodejs_libdir}/npm/doc
-%{nodejs_libdir}/npm/doc/cli-commands
+%{nodejs_libdir}/npm/doc/commands
%{nodejs_libdir}/npm/doc/configuring-npm
%{nodejs_libdir}/npm/doc/using-npm
@@ -162,17 +144,17 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man5/npm*.5*
%{_mandir}/man5/package-json.5*
%{_mandir}/man5/package-lock-json.5*
-%{_mandir}/man5/package-locks.5*
-%{_mandir}/man5/shrinkwrap-json.5*
%{_mandir}/man7/config.7*
+%{_mandir}/man7/dependency-selectors.7*
%{_mandir}/man7/developers.7*
-%{_mandir}/man7/disputes.7*
+%{_mandir}/man7/logging.7*
+%{_mandir}/man7/package-spec.7*
%{_mandir}/man7/orgs.7*
%{_mandir}/man7/registry.7*
%{_mandir}/man7/removal.7*
%{_mandir}/man7/scope.7*
%{_mandir}/man7/scripts.7*
-%{_mandir}/man7/semver.7*
+%{_mandir}/man7/workspaces.7*
%files -n bash-completion-%{name}
%defattr(644,root,root,755)
diff --git a/cmd-shim-optional.patch b/cmd-shim-optional.patch
deleted file mode 100644
index 889cf08..0000000
--- a/cmd-shim-optional.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-diff --color -urN npm-6.14.8.orig/node_modules/gentle-fs/lib/bin-link.js npm-6.14.8/node_modules/gentle-fs/lib/bin-link.js
---- npm-6.14.8.orig/node_modules/gentle-fs/lib/bin-link.js 1985-10-26 09:15:00.000000000 +0100
-+++ npm-6.14.8/node_modules/gentle-fs/lib/bin-link.js 2020-09-09 23:11:39.069859423 +0200
-@@ -4,7 +4,7 @@
- // top level global packages
-
- const readCmdShim = require('read-cmd-shim')
--const cmdShim = require('cmd-shim')
-+const cmdShim = (process.platform == "win32") ? require('cmd-shim') : {}
- const {linkIfExists} = require('./link.js')
-
- const binLink = (from, to, opts, cb) => {
-diff --color -urN npm-6.14.8.orig/package.json npm-6.14.8/package.json
---- npm-6.14.8.orig/package.json 1985-10-26 09:15:00.000000000 +0100
-+++ npm-6.14.8/package.json 2020-09-09 22:51:11.189638270 +0200
-@@ -48,7 +48,6 @@
- "ci-info": "^2.0.0",
- "cli-columns": "^3.1.2",
- "cli-table3": "^0.5.1",
-- "cmd-shim": "^3.0.3",
- "columnify": "~1.5.4",
- "config-chain": "^1.1.12",
- "detect-indent": "~5.0.0",
diff --git a/global-config-path.patch b/global-config-path.patch
new file mode 100644
index 0000000..ee266eb
--- /dev/null
+++ b/global-config-path.patch
@@ -0,0 +1,11 @@
+--- npm-10.9.3/node_modules/@npmcli/config/lib/index.js.orig 1985-10-26 09:15:00.000000000 +0100
++++ npm-10.9.3/node_modules/@npmcli/config/lib/index.js 2025-07-10 13:03:57.914526277 +0200
+@@ -290,7 +290,7 @@
+ // define a custom getter, but turn into a normal prop
+ // if we set it. otherwise it can't be set on child objects
+ Object.defineProperty(data, 'globalconfig', {
+- get: () => resolve(this.#get('prefix'), 'etc/npmrc'),
++ get: () => '/etc/npmrc',
+ set (value) {
+ Object.defineProperty(data, 'globalconfig', {
+ value,
diff --git a/link-globalPaths.patch b/link-globalPaths.patch
index 12d3bd5..921303d 100644
--- a/link-globalPaths.patch
+++ b/link-globalPaths.patch
@@ -1,39 +1,75 @@
-diff -ur package.orig/lib/link.js package/lib/link.js
---- package.orig/lib/link.js 1985-10-26 09:15:00.000000000 +0100
-+++ package/lib/link.js 2019-05-20 14:27:13.126000000 +0200
-@@ -8,6 +8,7 @@
- var asyncMap = require('slide').asyncMap
- var chain = require('slide').chain
- var path = require('path')
-+var globalPaths = require('module').globalPaths
- var build = require('./build.js')
- var npa = require('npm-package-arg')
- var usage = require('./utils/usage')
-@@ -98,11 +99,24 @@
- })
- }
+--- npm-10.9.3/lib/commands/link.js.orig 1985-10-26 09:15:00.000000000 +0100
++++ npm-10.9.3/lib/commands/link.js 2025-07-10 12:55:55.539989772 +0200
+@@ -1,10 +1,11 @@
+-const { readdir } = require('node:fs/promises')
++const { readdir, stat } = require('node:fs/promises')
+ const { resolve } = require('node:path')
+ const npa = require('npm-package-arg')
+ const pkgJson = require('@npmcli/package-json')
+ const semver = require('semver')
+ const reifyFinish = require('../utils/reify-finish.js')
+ const ArboristWorkspaceCmd = require('../arborist-cmd.js')
++const globalPaths = require("module").globalPaths
+
+ class Link extends ArboristWorkspaceCmd {
+ static description = 'Symlink a package folder'
+@@ -79,9 +80,31 @@
+ !node.isRoot || args.some(a => npa(a).name === kid),
+ })
-- fs.lstat(pp, function (er, st) {
-- if (er) {
-+ // find pp from globalPaths
-+ asyncMap(globalPaths, function(f, cb) {
-+ f = path.resolve(f, pkg)
-+ fs.lstat(f, function(er, st) {
-+ if (er) {
-+ cb()
-+ } else {
-+ cb(null, f, st)
++ const missing = this.missingArgsFromTree(globals, args)
++ const names = []
++ const globalArgs = [...args]
++
++ for (let i = 0; i < globalPaths.length && missing.length; i++) {
++ if (globalPaths[i] === this.npm.globalDir)
++ continue
++ try {
++ await stat(globalPaths[i])
++ } catch {
++ continue
++ }
++ for (let m = missing.length - 1; m >= 0; m--) {
++ try {
++ await stat(resolve(globalPaths[i], npa(missing[m]).name))
++ names.push({path: globalPaths[i], name: npa(missing[m]).name})
++ globalArgs.splice(globalArgs.indexOf(missing[m]), 1)
++ missing.splice(m, 1)
++ } catch {
+ }
-+ });
-+ }, function(er, f, st) {
-+ pp = f && f[0] || path.resolve(npm.globalDir, pkg)
++ }
++ }
+
-+ if (er) return cb()
-+ if (!f || !f[0]) {
- rp = pp
- return npm.commands.install(t, [pkg], n)
-- } else if (!st.isSymbolicLink()) {
-+ } else if (!st[0].isSymbolicLink()) {
- rp = pp
- next()
+ // any extra arg that is missing from the current
+ // global space should be reified there first
+- const missing = this.missingArgsFromTree(globals, args)
+ if (missing.length) {
+ await globalArb.reify({
+ ...globalOpts,
+@@ -90,14 +113,13 @@
+ }
+
+ // get a list of module names that should be linked in the local prefix
+- const names = []
+- for (const a of args) {
++ for (const a of globalArgs) {
+ const arg = npa(a)
+ if (arg.type === 'directory') {
+ const { content } = await pkgJson.normalize(arg.fetchSpec)
+- names.push(content.name)
++ names.push({path: this.npm.globalDir, name: content.name})
} else {
+- names.push(arg.name)
++ names.push({path: this.npm.globalDir, name: arg.name})
+ }
+ }
+
+@@ -124,7 +146,7 @@
+ ...this.npm.flatOptions,
+ prune: false,
+ path: this.npm.prefix,
+- add: names.map(l => `file:${resolve(globalTop, 'node_modules', l)}`),
++ add: names.map(l => `file:${resolve(l.path, l.name)}`),
+ save,
+ workspaces: this.workspaceNames,
+ })
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/npm.git/commitdiff/5352c0dacf2ffbc52f9dc11f6aea8ed125dfc5e6
More information about the pld-cvs-commit
mailing list