2
0

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
This commit is contained in:
Avindra Goolcharan 2022-08-16 14:52:01 +00:00 committed by Git OBS Bridge
parent 5a2f13770c
commit 3b459cd69a
3 changed files with 49 additions and 2 deletions

View File

@ -0,0 +1,36 @@
From 3ebbc200b9f03dae3e32d2461b77f99db645df02 Mon Sep 17 00:00:00 2001
From: Bruno Pitrus <brunopitrus@hotmail.com>
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<numb
}
function configureNpmToSpecificLocalhostPort(service, port) {
return new Promise((accept, reject) => {
- 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<void> {
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

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Mon Aug 15 15:59:04 UTC 2022 - Bruno Pitrus <brunopitrus@hotmail.com>
- 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 <adam.majer@suse.de> Wed Aug 11 17:06:14 UTC 2021 - Adam Majer <adam.majer@suse.de>

View File

@ -23,7 +23,8 @@ Summary: Localhost-only version of NPM registry
License: GPL-3.0-or-later License: GPL-3.0-or-later
URL: https://github.com/openSUSE/npm-localhost-proxy 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 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 BuildArch: noarch
%description %description
@ -51,7 +52,7 @@ then
exit 0 exit 0
fi fi
exec %{_bindir}/node %{_datadir}/%{name}/dist/ "\$@" exec node %{_datadir}/%{name}/dist/ "\$@"
EOF EOF
%files %files