mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-09 05:19:32 +08:00
fix(cli): support bundled extension path in dist root
This commit is contained in:
committed by
Peter Steinberger
parent
1008c28f5a
commit
44bbe09bee
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user