mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 22:18:27 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -66,11 +66,17 @@ function resolveBundledPluginSources(params: {
|
||||
const bundled = new Map<string, BundledPluginSource>();
|
||||
|
||||
for (const candidate of discovery.candidates) {
|
||||
if (candidate.origin !== "bundled") continue;
|
||||
if (candidate.origin !== "bundled") {
|
||||
continue;
|
||||
}
|
||||
const manifest = loadPluginManifest(candidate.rootDir);
|
||||
if (!manifest.ok) continue;
|
||||
if (!manifest.ok) {
|
||||
continue;
|
||||
}
|
||||
const pluginId = manifest.manifest.id;
|
||||
if (bundled.has(pluginId)) continue;
|
||||
if (bundled.has(pluginId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const npmSpec =
|
||||
candidate.packageManifest?.install?.npmSpec?.trim() ||
|
||||
@@ -88,7 +94,9 @@ function resolveBundledPluginSources(params: {
|
||||
}
|
||||
|
||||
function pathsEqual(left?: string, right?: string): boolean {
|
||||
if (!left || !right) return false;
|
||||
if (!left || !right) {
|
||||
return false;
|
||||
}
|
||||
return resolveUserPath(left) === resolveUserPath(right);
|
||||
}
|
||||
|
||||
@@ -100,7 +108,9 @@ function buildLoadPathHelpers(existing: string[]) {
|
||||
|
||||
const addPath = (value: string) => {
|
||||
const normalized = resolveUserPath(value);
|
||||
if (resolved.has(normalized)) return;
|
||||
if (resolved.has(normalized)) {
|
||||
return;
|
||||
}
|
||||
paths.push(value);
|
||||
resolved.add(normalized);
|
||||
changed = true;
|
||||
@@ -108,7 +118,9 @@ function buildLoadPathHelpers(existing: string[]) {
|
||||
|
||||
const removePath = (value: string) => {
|
||||
const normalized = resolveUserPath(value);
|
||||
if (!resolved.has(normalized)) return;
|
||||
if (!resolved.has(normalized)) {
|
||||
return;
|
||||
}
|
||||
paths = paths.filter((entry) => resolveUserPath(entry) !== normalized);
|
||||
resolved = resolveSet();
|
||||
changed = true;
|
||||
@@ -314,13 +326,17 @@ export async function syncPluginsForUpdateChannel(params: {
|
||||
if (params.channel === "dev") {
|
||||
for (const [pluginId, record] of Object.entries(installs)) {
|
||||
const bundledInfo = bundled.get(pluginId);
|
||||
if (!bundledInfo) continue;
|
||||
if (!bundledInfo) {
|
||||
continue;
|
||||
}
|
||||
|
||||
loadHelpers.addPath(bundledInfo.localPath);
|
||||
|
||||
const alreadyBundled =
|
||||
record.source === "path" && pathsEqual(record.sourcePath, bundledInfo.localPath);
|
||||
if (alreadyBundled) continue;
|
||||
if (alreadyBundled) {
|
||||
continue;
|
||||
}
|
||||
|
||||
next = recordPluginInstall(next, {
|
||||
pluginId,
|
||||
@@ -336,15 +352,21 @@ export async function syncPluginsForUpdateChannel(params: {
|
||||
} else {
|
||||
for (const [pluginId, record] of Object.entries(installs)) {
|
||||
const bundledInfo = bundled.get(pluginId);
|
||||
if (!bundledInfo) continue;
|
||||
if (!bundledInfo) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (record.source === "npm") {
|
||||
loadHelpers.removePath(bundledInfo.localPath);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (record.source !== "path") continue;
|
||||
if (!pathsEqual(record.sourcePath, bundledInfo.localPath)) continue;
|
||||
if (record.source !== "path") {
|
||||
continue;
|
||||
}
|
||||
if (!pathsEqual(record.sourcePath, bundledInfo.localPath)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const spec = record.spec ?? bundledInfo.npmSpec;
|
||||
if (!spec) {
|
||||
|
||||
Reference in New Issue
Block a user