@brokkai/mjolnir 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/mj.js +21 -7
- package/package.json +4 -4
package/bin/mj.js
CHANGED
|
@@ -37,6 +37,16 @@ export function nativeBinaryPath(bundleRoot, platform = process.platform) {
|
|
|
37
37
|
return path.join(bundleRoot, "bin", platform === "win32" ? "mj.exe" : "mj");
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
export function installMethodEnvironment(env = process.env) {
|
|
41
|
+
// npx runs come from npm's cache; telling mj which manager launched it
|
|
42
|
+
// lets the update check offer the right upgrade command instead of ever
|
|
43
|
+
// writing into node_modules itself.
|
|
44
|
+
if (env.npm_command === "exec") {
|
|
45
|
+
return { MJOLNIR_MANAGED_BY_NPX: "true" };
|
|
46
|
+
}
|
|
47
|
+
return { MJOLNIR_MANAGED_BY_NPM: "true" };
|
|
48
|
+
}
|
|
49
|
+
|
|
40
50
|
const SIGNAL_EXIT_CODES = {
|
|
41
51
|
SIGHUP: 129,
|
|
42
52
|
SIGINT: 130,
|
|
@@ -51,15 +61,19 @@ export function launch(
|
|
|
51
61
|
exitProcess = process.exit,
|
|
52
62
|
) {
|
|
53
63
|
const bundleBin = path.join(bundleRoot, "bin");
|
|
64
|
+
const childEnv = {
|
|
65
|
+
...process.env,
|
|
66
|
+
PATH: `${bundleBin}${path.delimiter}${process.env.PATH ?? ""}`,
|
|
67
|
+
};
|
|
68
|
+
// npm owns upgrades: replacing files under node_modules would corrupt its
|
|
69
|
+
// package database, so mj delegates the upgrade to whichever manager
|
|
70
|
+
// launched it instead of disabling the update check outright.
|
|
71
|
+
delete childEnv.MJOLNIR_MANAGED_BY_NPM;
|
|
72
|
+
delete childEnv.MJOLNIR_MANAGED_BY_NPX;
|
|
73
|
+
Object.assign(childEnv, installMethodEnvironment(process.env));
|
|
54
74
|
const child = spawnProcess(nativeBinaryPath(bundleRoot, platform), args, {
|
|
55
75
|
stdio: "inherit",
|
|
56
|
-
env:
|
|
57
|
-
...process.env,
|
|
58
|
-
PATH: `${bundleBin}${path.delimiter}${process.env.PATH ?? ""}`,
|
|
59
|
-
// npm owns upgrades. Replacing files under node_modules would corrupt its
|
|
60
|
-
// package database and can leave sibling binaries at different versions.
|
|
61
|
-
MJOLNIR_NO_UPDATE_CHECK: "true",
|
|
62
|
-
},
|
|
76
|
+
env: childEnv,
|
|
63
77
|
});
|
|
64
78
|
const signalHandlers = new Map();
|
|
65
79
|
for (const signal of Object.keys(SIGNAL_EXIT_CODES)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brokkai/mjolnir",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"license": "GPL-3.0-only",
|
|
5
5
|
"repository": "https://github.com/BrokkAi/mjolnir",
|
|
6
6
|
"homepage": "https://mjolnir.brokk.ai/",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"LICENSE"
|
|
20
20
|
],
|
|
21
21
|
"optionalDependencies": {
|
|
22
|
-
"@brokkai/mjolnir-darwin-universal": "2.
|
|
23
|
-
"@brokkai/mjolnir-linux-x64-gnu": "2.
|
|
24
|
-
"@brokkai/mjolnir-linux-arm64-gnu": "2.
|
|
22
|
+
"@brokkai/mjolnir-darwin-universal": "2.6.0",
|
|
23
|
+
"@brokkai/mjolnir-linux-x64-gnu": "2.6.0",
|
|
24
|
+
"@brokkai/mjolnir-linux-arm64-gnu": "2.6.0"
|
|
25
25
|
},
|
|
26
26
|
"engines": {
|
|
27
27
|
"node": ">=18"
|