From 3b459cd69a396c0b82ee929a98fbdc99a176b89cda64fd9ba24d8cdcc363aba3 Mon Sep 17 00:00:00 2001 From: Avindra Goolcharan Date: Tue, 16 Aug 2022 14:52:01 +0000 Subject: [PATCH] Accepting request 995192 from home:dziobian:gulgul-ultron - Allow the user to override `node` and `npm` commands in PATH. This is useful if one wants to eg. use Electron to run npm. * add 0001-Allow-the-user-to-provide-their-own-npm-command-by-m.patch - Change Requires: npm-default to Requires: npm. npm-default is already prefered by the prjconf, this works with any version of npm, and Fedora does not have npm-default. OBS-URL: https://build.opensuse.org/request/show/995192 OBS-URL: https://build.opensuse.org/package/show/devel:languages:javascript/local-npm-registry?expand=0&rev=5 --- ...o-provide-their-own-npm-command-by-m.patch | 36 +++++++++++++++++++ local-npm-registry.changes | 10 ++++++ local-npm-registry.spec | 5 +-- 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 0001-Allow-the-user-to-provide-their-own-npm-command-by-m.patch diff --git a/0001-Allow-the-user-to-provide-their-own-npm-command-by-m.patch b/0001-Allow-the-user-to-provide-their-own-npm-command-by-m.patch new file mode 100644 index 0000000..da055fe --- /dev/null +++ b/0001-Allow-the-user-to-provide-their-own-npm-command-by-m.patch @@ -0,0 +1,36 @@ +From 3ebbc200b9f03dae3e32d2461b77f99db645df02 Mon Sep 17 00:00:00 2001 +From: Bruno Pitrus +Date: Fri, 12 Aug 2022 16:44:59 +0200 +Subject: [PATCH] Allow the user to provide their own npm command by + manipulating PATH. + +This can be useful to eg. run npm using Electron instead of Node. +--- + src/index.ts | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/index.ts b/src/index.ts +index ee201f3..0232df4 100644 +--- a/dist/index.js ++++ b/dist/index.js +@@ -59,7 +59,7 @@ function setupServerAndGetPort(service:Service, registry:Registry): Promise { +- child_process_1.spawn("/usr/bin/npm", ['config', 'set', 'registry', service.url.toString()], { stdio: 'inherit' }) ++ child_process_1.spawn("npm", ['config', 'set', 'registry', service.url.toString()], { stdio: 'inherit' }) + .on("exit", (code) => { + code === 0 ? accept() : reject(); + }); +@@ -71,7 +71,7 @@ function runNpmInstall(): Promise { + return Promise.reject("npm install skipped"); + } + return new Promise((accept, reject) => { +- child_process_1.spawn("/usr/bin/npm", install_options, { stdio: 'inherit' }) ++ child_process_1.spawn("npm", install_options, { stdio: 'inherit' }) + .on("exit", (code) => { + code === 0 ? accept() : reject("NPM returned code: " + code); + }); +-- +2.37.1.windows.1 + diff --git a/local-npm-registry.changes b/local-npm-registry.changes index 175938e..99f898d 100644 --- a/local-npm-registry.changes +++ b/local-npm-registry.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Mon Aug 15 15:59:04 UTC 2022 - Bruno Pitrus +- Allow the user to override `node` and `npm` commands in PATH. + This is useful if one wants to eg. use Electron to run npm. + * add 0001-Allow-the-user-to-provide-their-own-npm-command-by-m.patch +- Change Requires: npm-default to Requires: npm. + npm-default is already prefered by the prjconf, + this works with any version of npm, + and Fedora does not have npm-default. + ------------------------------------------------------------------- Wed Aug 11 17:06:14 UTC 2021 - Adam Majer diff --git a/local-npm-registry.spec b/local-npm-registry.spec index e83bac6..ab626d5 100644 --- a/local-npm-registry.spec +++ b/local-npm-registry.spec @@ -23,7 +23,8 @@ Summary: Localhost-only version of NPM registry License: GPL-3.0-or-later URL: https://github.com/openSUSE/npm-localhost-proxy Source: https://github.com/openSUSE/npm-localhost-proxy/releases/download/v%{version}/local_npm_registry-v%{version}.tar.gz -Requires: npm-default +Patch0: 0001-Allow-the-user-to-provide-their-own-npm-command-by-m.patch +Requires: npm BuildArch: noarch %description @@ -51,7 +52,7 @@ then exit 0 fi -exec %{_bindir}/node %{_datadir}/%{name}/dist/ "\$@" +exec node %{_datadir}/%{name}/dist/ "\$@" EOF %files