Files
MINGW-packages/mingw-w64-nodejs/0013-Revert-to-FHS-installation-paths-on-Windows-tests-no.patch
2022-12-18 13:38:10 +08:00

108 lines
3.8 KiB
Diff

From bcee3d1a11b3cfdb3e2cf970674b10829b9cf293 Mon Sep 17 00:00:00 2001
From: Mateusz Mikula <mati865@gmail.com>
Date: Sat, 24 Jun 2017 13:59:32 +0200
Subject: [PATCH 13/23] Revert to FHS installation paths on Windows (tests not
fixed)
Author: Mateusz Mikula <mati865@gmail.com>
---
deps/npm/bin/npm | 4 ++--
deps/npm/bin/npm.cmd | 4 ++--
deps/npm/lib/config/defaults.js | 7 ++-----
deps/npm/lib/npm.js | 6 ++----
deps/npm/lib/unbuild.js | 1 -
deps/npm/node_modules/bin-links/index.js | 2 +-
6 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/deps/npm/bin/node-gyp-bin/node-gyp b/deps/npm/bin/node-gyp-bin/node-gyp
--- a/deps/npm/bin/node-gyp-bin/node-gyp
+++ b/deps/npm/bin/node-gyp-bin/node-gyp
@@ -1,6 +1,6 @@
#!/usr/bin/env sh
if [ "x$npm_config_node_gyp" = "x" ]; then
- node "`dirname "$0"`/../../node_modules/node-gyp/bin/node-gyp.js" "$@"
+ node "`dirname "$0"`/../../../node_modules/node-gyp/bin/node-gyp.js" "$@"
else
"$npm_config_node_gyp" "$@"
fi
diff --git a/deps/npm/bin/npm b/deps/npm/bin/npm
index 5acd6fb6..dc01687e 100755
--- a/deps/npm/bin/npm
+++ b/deps/npm/bin/npm
@@ -18,7 +18,7 @@
# this path is passed to node.exe, so it needs to match whatever
# kind of paths Node.js thinks it's using, typically win32 paths.
CLI_BASEDIR="$("$NODE_EXE" -p 'require("path").dirname(process.execPath)')"
-NPM_CLI_JS="$CLI_BASEDIR/node_modules/npm/bin/npm-cli.js"
+NPM_CLI_JS="$CLI_BASEDIR/../lib/node_modules/npm/bin/npm-cli.js"
NPM_PREFIX=`"$NODE_EXE" "$NPM_CLI_JS" prefix -g`
if [ $? -ne 0 ]; then
@@ -26,7 +26,7 @@
echo "Could not determine Node.js install directory" >&2
exit 1
fi
-NPM_PREFIX_NPM_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npm-cli.js"
+NPM_PREFIX_NPM_CLI_JS="$NPM_PREFIX/../lib/node_modules/npm/bin/npm-cli.js"
# a path that will fail -f test on any posix bash
NPM_WSL_PATH="/.."
diff --git a/deps/npm/bin/npm.cmd b/deps/npm/bin/npm.cmd
index 880554dc..12507ba1 100644
--- a/deps/npm/bin/npm.cmd
@@ -8,9 +8,9 @@
SET "NODE_EXE=node"
)
-SET "NPM_CLI_JS=%~dp0\node_modules\npm\bin\npm-cli.js"
+SET "NPM_CLI_JS=%~dp0\..\lib\node_modules\npm\bin\npm-cli.js"
FOR /F "delims=" %%F IN ('CALL "%NODE_EXE%" "%NPM_CLI_JS%" prefix -g') DO (
- SET "NPM_PREFIX_NPM_CLI_JS=%%F\node_modules\npm\bin\npm-cli.js"
+ SET "NPM_PREFIX_NPM_CLI_JS=%%F\..\lib\node_modules\npm\bin\npm-cli.js"
)
IF EXIST "%NPM_PREFIX_NPM_CLI_JS%" (
SET "NPM_CLI_JS=%NPM_PREFIX_NPM_CLI_JS%"
diff --git a/deps/npm/bin/npx b/deps/npm/bin/npx
--- a/deps/npm/bin/npx
+++ b/deps/npm/bin/npx
@@ -27,10 +27,10 @@
echo "Could not determine Node.js install directory" >&2
exit 1
fi
-NPM_CLI_JS="$CLI_BASEDIR/node_modules/npm/bin/npm-cli.js"
-NPX_CLI_JS="$CLI_BASEDIR/node_modules/npm/bin/npx-cli.js"
+NPM_CLI_JS="$CLI_BASEDIR/../lib/node_modules/npm/bin/npm-cli.js"
+NPX_CLI_JS="$CLI_BASEDIR/../lib/node_modules/npm/bin/npx-cli.js"
NPM_PREFIX=`"$NODE_EXE" "$NPM_CLI_JS" prefix -g`
-NPM_PREFIX_NPX_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npx-cli.js"
+NPM_PREFIX_NPX_CLI_JS="$NPM_PREFIX/../lib/node_modules/npm/bin/npx-cli.js"
# a path that will fail -f test on any posix bash
NPX_WSL_PATH="/.."
diff --git a/deps/npm/lib/npm.js b/deps/npm/lib/npm.js
index e5871260..ad9ed251 100644
--- a/deps/npm/lib/npm.js
+++ b/deps/npm/lib/npm.js
@@ -406,9 +406,7 @@
}
get globalDir () {
- return process.platform !== 'win32'
- ? resolve(this.globalPrefix, 'lib', 'node_modules')
- : resolve(this.globalPrefix, 'node_modules')
+ return resolve(this.globalPrefix, 'lib', 'node_modules')
}
get localDir () {
@@ -421,7 +419,7 @@
get globalBin () {
const b = this.globalPrefix
- return process.platform !== 'win32' ? resolve(b, 'bin') : b
+ return resolve(b, 'bin')
}
get localBin () {
--
2.17.0.windows.1