Fix installer overwriting package.json and losing openclaw.extensions (#1113)
The update step copies the root package.json over the extension's package.json, wiping the openclaw.extensions field that plugin discovery requires. This causes "plugin not found: claude-mem" after every update. Merge only the version number instead. Fixes #1106
This commit is contained in:
+12
-2
@@ -812,8 +812,18 @@ install_plugin() {
|
|||||||
# Copy plugin/ directory (worker service, hooks, scripts, skills, UI)
|
# Copy plugin/ directory (worker service, hooks, scripts, skills, UI)
|
||||||
cp -R "${repo_root}/plugin" "${extension_dir}/"
|
cp -R "${repo_root}/plugin" "${extension_dir}/"
|
||||||
|
|
||||||
# Copy root package.json (contains the canonical version number)
|
# Merge the canonical version from root package.json into the existing
|
||||||
cp "${repo_root}/package.json" "${extension_dir}/package.json"
|
# extension package.json, preserving the openclaw.extensions field that
|
||||||
|
# plugin discovery requires.
|
||||||
|
local root_version
|
||||||
|
root_version="$(node -e "console.log(require('${repo_root}/package.json').version)")"
|
||||||
|
node -e "
|
||||||
|
const fs = require('fs');
|
||||||
|
const pkgPath = '${extension_dir}/package.json';
|
||||||
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
||||||
|
pkg.version = '${root_version}';
|
||||||
|
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
||||||
|
"
|
||||||
|
|
||||||
success "Core plugin files updated at ${extension_dir}"
|
success "Core plugin files updated at ${extension_dir}"
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user