@pizzapi/pizza 0.1.32 → 0.1.34-dev.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/pizza.mjs +59 -9
- package/package.json +6 -6
package/bin/pizza.mjs
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
* Pattern borrowed from esbuild, turbo, swc, etc.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { execFileSync } from "node:child_process";
|
|
12
|
+
import { execFileSync, execSync } from "node:child_process";
|
|
13
13
|
import { existsSync } from "node:fs";
|
|
14
|
-
import { join, dirname } from "node:path";
|
|
14
|
+
import { join, dirname, resolve } from "node:path";
|
|
15
15
|
import { createRequire } from "node:module";
|
|
16
16
|
import { fileURLToPath } from "node:url";
|
|
17
17
|
|
|
@@ -33,18 +33,19 @@ if (!pkgName) {
|
|
|
33
33
|
console.error(
|
|
34
34
|
`Error: PizzaPi does not have a prebuilt binary for your platform (${platformKey}).\n` +
|
|
35
35
|
`Supported platforms: ${Object.keys(PLATFORM_PACKAGES).join(", ")}\n\n` +
|
|
36
|
-
`You can build from source: https://github.com/
|
|
36
|
+
`You can build from source: https://github.com/Pizzaface/PizzaPi`,
|
|
37
37
|
);
|
|
38
38
|
process.exit(1);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// Try to find the binary
|
|
42
42
|
function findBinary() {
|
|
43
|
-
const require = createRequire(join(__dirname, ".."));
|
|
44
43
|
const binName = process.platform === "win32" ? "pizza.exe" : "pizza";
|
|
44
|
+
const parts = pkgName.split("/");
|
|
45
45
|
|
|
46
46
|
// Strategy 1: require.resolve the platform package
|
|
47
47
|
try {
|
|
48
|
+
const require = createRequire(join(__dirname, "..", "package.json"));
|
|
48
49
|
const pkgJson = require.resolve(`${pkgName}/package.json`);
|
|
49
50
|
const pkgDir = dirname(pkgJson);
|
|
50
51
|
const binPath = join(pkgDir, "bin", binName);
|
|
@@ -53,7 +54,16 @@ function findBinary() {
|
|
|
53
54
|
// not found via require
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
// Strategy 2:
|
|
57
|
+
// Strategy 2: Sibling scoped package — both packages live under
|
|
58
|
+
// node_modules/@pizzapi/, so the platform package is a sibling of ours.
|
|
59
|
+
// __dirname = .../node_modules/@pizzapi/pizza/bin
|
|
60
|
+
// sibling = .../node_modules/@pizzapi/cli-win32-x64/bin/pizza.exe
|
|
61
|
+
{
|
|
62
|
+
const siblingPath = join(__dirname, "..", "..", parts[1], "bin", binName);
|
|
63
|
+
if (existsSync(siblingPath)) return siblingPath;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Strategy 3: Check common node_modules layouts (hoisted, nested)
|
|
57
67
|
const searchRoots = [
|
|
58
68
|
join(__dirname, "..", "node_modules"),
|
|
59
69
|
join(__dirname, "..", "..", "node_modules"),
|
|
@@ -61,27 +71,67 @@ function findBinary() {
|
|
|
61
71
|
];
|
|
62
72
|
|
|
63
73
|
for (const root of searchRoots) {
|
|
64
|
-
// Scoped package: node_modules/@pizzapi/cli-<platform>/bin/pizzapi
|
|
65
|
-
const parts = pkgName.split("/");
|
|
66
74
|
const binPath = join(root, parts[0], parts[1], "bin", binName);
|
|
67
75
|
if (existsSync(binPath)) return binPath;
|
|
68
76
|
}
|
|
69
77
|
|
|
78
|
+
// Strategy 4: Walk up from __dirname looking for node_modules containing
|
|
79
|
+
// the platform package (covers deeply nested or unusual layouts)
|
|
80
|
+
{
|
|
81
|
+
let dir = resolve(__dirname);
|
|
82
|
+
for (let i = 0; i < 10; i++) {
|
|
83
|
+
const candidate = join(dir, "node_modules", parts[0], parts[1], "bin", binName);
|
|
84
|
+
if (existsSync(candidate)) return candidate;
|
|
85
|
+
const parent = dirname(dir);
|
|
86
|
+
if (parent === dir) break;
|
|
87
|
+
dir = parent;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Strategy 5: Use npm root -g to find global node_modules (global installs)
|
|
92
|
+
try {
|
|
93
|
+
const globalRoot = execSync("npm root -g", { encoding: "utf-8" }).trim();
|
|
94
|
+
if (globalRoot) {
|
|
95
|
+
const binPath = join(globalRoot, parts[0], parts[1], "bin", binName);
|
|
96
|
+
if (existsSync(binPath)) return binPath;
|
|
97
|
+
}
|
|
98
|
+
} catch {
|
|
99
|
+
// npm not available or failed
|
|
100
|
+
}
|
|
101
|
+
|
|
70
102
|
return null;
|
|
71
103
|
}
|
|
72
104
|
|
|
73
105
|
const binaryPath = findBinary();
|
|
74
106
|
|
|
75
107
|
if (!binaryPath) {
|
|
108
|
+
// Collect diagnostic info for troubleshooting
|
|
109
|
+
const diag = [
|
|
110
|
+
` launcher: ${fileURLToPath(import.meta.url)}`,
|
|
111
|
+
` __dirname: ${__dirname}`,
|
|
112
|
+
` platform: ${platformKey}`,
|
|
113
|
+
];
|
|
114
|
+
// Check if the platform package directory exists at all
|
|
115
|
+
const parts = pkgName.split("/");
|
|
116
|
+
const siblingDir = join(__dirname, "..", "..", parts[1]);
|
|
117
|
+
diag.push(` sibling dir exists: ${existsSync(siblingDir)} (${siblingDir})`);
|
|
118
|
+
try {
|
|
119
|
+
const globalRoot = execSync("npm root -g", { encoding: "utf-8" }).trim();
|
|
120
|
+
const globalPkg = join(globalRoot, parts[0], parts[1]);
|
|
121
|
+
diag.push(` global root: ${globalRoot}`);
|
|
122
|
+
diag.push(` global pkg exists: ${existsSync(globalPkg)} (${globalPkg})`);
|
|
123
|
+
} catch {}
|
|
124
|
+
|
|
76
125
|
console.error(
|
|
77
126
|
`Error: Could not find the PizzaPi binary for your platform (${platformKey}).\n\n` +
|
|
78
127
|
`The platform-specific package "${pkgName}" should have been installed\n` +
|
|
79
128
|
`automatically as an optional dependency.\n\n` +
|
|
80
129
|
`Try reinstalling:\n` +
|
|
81
|
-
` npm install pizzapi\n\n` +
|
|
130
|
+
` npm install @pizzapi/pizza\n\n` +
|
|
82
131
|
`If the problem persists, install the platform package directly:\n` +
|
|
83
132
|
` npm install ${pkgName}\n\n` +
|
|
84
|
-
`Or build from source: https://github.com/
|
|
133
|
+
`Or build from source: https://github.com/Pizzaface/PizzaPi\n\n` +
|
|
134
|
+
`Diagnostics:\n${diag.join("\n")}`,
|
|
85
135
|
);
|
|
86
136
|
process.exit(1);
|
|
87
137
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pizzapi/pizza",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.34-dev.0",
|
|
4
4
|
"description": "PizzaPi — a self-hosted web interface and relay server for the pi coding agent. Stream live AI coding sessions to any browser.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"LICENSE"
|
|
14
14
|
],
|
|
15
15
|
"optionalDependencies": {
|
|
16
|
-
"@pizzapi/cli-linux-x64": "0.1.
|
|
17
|
-
"@pizzapi/cli-linux-arm64": "0.1.
|
|
18
|
-
"@pizzapi/cli-darwin-x64": "0.1.
|
|
19
|
-
"@pizzapi/cli-darwin-arm64": "0.1.
|
|
20
|
-
"@pizzapi/cli-win32-x64": "0.1.
|
|
16
|
+
"@pizzapi/cli-linux-x64": "0.1.34-dev.0",
|
|
17
|
+
"@pizzapi/cli-linux-arm64": "0.1.34-dev.0",
|
|
18
|
+
"@pizzapi/cli-darwin-x64": "0.1.34-dev.0",
|
|
19
|
+
"@pizzapi/cli-darwin-arm64": "0.1.34-dev.0",
|
|
20
|
+
"@pizzapi/cli-win32-x64": "0.1.34-dev.0"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=18"
|