File: webpack-cli-path.patch

package info (click to toggle)
node-webpack 5.97.1%2Bdfsg1%2B~cs11.18.27-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 59,064 kB
  • sloc: javascript: 185,073; makefile: 16; sh: 6
file content (82 lines) | stat: -rw-r--r-- 2,049 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Description: fix webpack-cli path
Author: Ayoyimika Ajibade <ayoyimikaajibade@gmail.com>
Forwarded: not-needed
Reviewed-By: Yadd <yadd@debian.org>
Last-Update: 2024-08-28

--- a/bin/webpack.js
+++ b/bin/webpack.js
@@ -44,7 +44,7 @@
 	do {
 		try {
 			if (
-				fs.statSync(path.join(dir, "node_modules", packageName)).isDirectory()
+				fs.statSync('/usr/share/nodejs/webpack-cli/').isDirectory()
 			) {
 				return true;
 			}
@@ -75,7 +75,7 @@
  */
 const runCli = cli => {
 	const path = require("path");
-	const pkgPath = require.resolve(`${cli.package}/package.json`);
+  const pkgPath = require.resolve(`/usr/share/nodejs/${cli.package}/package.json`);
 	const pkg = require(pkgPath);
 
 	if (pkg.type === "module" || /\.mjs/i.test(pkg.bin[cli.binName])) {
--- a/webpack-cli/packages/webpack-cli/src/webpack-cli.ts
+++ b/webpack-cli/packages/webpack-cli/src/webpack-cli.ts
@@ -66,6 +66,9 @@
   ? (process.env.WEBPACK_DEV_SERVER_PACKAGE as string)
   : "webpack-dev-server";
 
+// @ts-ignore
+const isDebianManaged = () => Boolean(process.env.DEB_HOST_ARCH)
+
 interface Information {
   Binaries?: string[];
   Browsers?: string[];
@@ -193,7 +196,9 @@
     if (!availableInstallers.length) {
       this.logger.error("No package manager found.");
 
-      process.exit(2);
+      if (!isDebianManaged()) {
+        process.exit(2);
+      }
     }
 
     return availableInstallers;
@@ -248,7 +253,9 @@
     } catch (e) {
       this.logger.error("No package manager found.");
 
-      process.exit(2);
+      if (!isDebianManaged()) {
+        process.exit(2);
+      }
     }
   }
 
@@ -258,7 +265,9 @@
     if (!packageManager) {
       this.logger.error("Can't find package manager");
 
-      process.exit(2);
+      if (!isDebianManaged()) {
+        process.exit(2);
+      }
     }
 
     if (options.preMessage) {
@@ -581,6 +590,10 @@
           skipInstallation = true;
         }
 
+        if (!isDebianManaged()) {
+          skipInstallation = true
+        }
+
         if (skipInstallation) {
           continue;
         }