local-npm-registry/0001-Allow-the-user-to-provide-their-own-npm-command-by-m.patch
Avindra Goolcharan 3b459cd69a 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
2022-08-16 14:52:01 +00:00

37 lines
1.5 KiB
Diff

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