pennyrouter 0.3.36 → 0.3.37
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/package.json +1 -1
- package/src/launch.js +17 -1
package/package.json
CHANGED
package/src/launch.js
CHANGED
|
@@ -274,6 +274,22 @@ async function copyRuntime() {
|
|
|
274
274
|
await cp(join(source, "package.json"), join(destination, "package.json"), { force: true });
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
+
// npx and local installs hoist dependencies above the package, so walk up like Node's resolver.
|
|
278
|
+
async function findInstalledPackage(name) {
|
|
279
|
+
let dir = packageRoot();
|
|
280
|
+
for (;;) {
|
|
281
|
+
const candidate = join(dir, "node_modules", name);
|
|
282
|
+
try {
|
|
283
|
+
if ((await stat(candidate)).isDirectory()) return candidate;
|
|
284
|
+
} catch (error) {
|
|
285
|
+
if (error.code !== "ENOENT") throw error;
|
|
286
|
+
}
|
|
287
|
+
const parent = dirname(dir);
|
|
288
|
+
if (parent === dir) throw new Error(`Could not find installed dependency ${name} from ${packageRoot()}`);
|
|
289
|
+
dir = parent;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
277
293
|
/** Install the bundled, repository-independent Penny Compare tools. */
|
|
278
294
|
export async function installPennyCompare() {
|
|
279
295
|
if (!(process.platform === "darwin" || process.platform === "linux" || process.platform === "win32")) {
|
|
@@ -303,7 +319,7 @@ export async function installPennyCompare() {
|
|
|
303
319
|
for (const name of ["@xterm/addon-fit", "@xterm/xterm", "node-pty", "ws"]) {
|
|
304
320
|
const target = join(modules, name);
|
|
305
321
|
await mkdir(dirname(target), { recursive: true });
|
|
306
|
-
await cp(
|
|
322
|
+
await cp(await findInstalledPackage(name), target, { recursive: true });
|
|
307
323
|
}
|
|
308
324
|
const link = join(pennyBinDir(), "penny-compare.cmd");
|
|
309
325
|
const marker = "@REM PennyRouter-managed compare launcher";
|