fix(cli): support bundled extension path in dist root

This commit is contained in:
Kelvin Calcano
2026-02-04 15:36:53 -04:00
committed by Peter Steinberger
parent 1008c28f5a
commit 44bbe09bee

View File

@@ -16,10 +16,20 @@ function bundledExtensionRootDir() {
const here = path.dirname(fileURLToPath(import.meta.url));
// `here` is the directory containing this file.
// - In npm installs, that's typically `<packageRoot>/dist/cli`.
// - In source runs/tests, it's typically `<packageRoot>/src/cli`.
// - In transpiled builds, it's typically `<packageRoot>/dist/cli`.
// - In bundled builds, it may be `<packageRoot>/dist`.
// The bundled extension lives at `<packageRoot>/assets/chrome-extension`.
return path.resolve(here, "../../assets/chrome-extension");
//
// Prefer the most common layouts first and fall back if needed.
const candidates = [
path.resolve(here, "../assets/chrome-extension"),
path.resolve(here, "../../assets/chrome-extension"),
];
for (const candidate of candidates) {
if (hasManifest(candidate)) return candidate;
}
return candidates[0]!;
}
function installedExtensionRootDir() {