2
0
local-npm-registry/0001-Allow-the-user-to-provide-their-own-npm-command-by-m.patch

37 lines
1.5 KiB
Diff
Raw Normal View History

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