robot-resources 1.8.1 → 1.8.2
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/lib/tool-config.js +15 -2
- package/package.json +1 -1
package/lib/tool-config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { readFileSync, writeFileSync, copyFileSync, mkdirSync, existsSync } from 'node:fs';
|
|
3
|
+
import { readFileSync, writeFileSync, copyFileSync, cpSync, mkdirSync, existsSync, rmSync } from 'node:fs';
|
|
4
4
|
import { homedir } from 'node:os';
|
|
5
5
|
import { join, dirname } from 'node:path';
|
|
6
6
|
import { isOpenClawInstalled, isOpenClawPluginInstalled, getOpenClawAuthMode, isClaudeCodeInstalled, isCursorInstalled } from './detect.js';
|
|
@@ -98,7 +98,11 @@ function registerScraperMcp() {
|
|
|
98
98
|
*
|
|
99
99
|
* The plugin ships as a CLI dependency (@robot-resources/openclaw-plugin).
|
|
100
100
|
* Instead of spawning `openclaw plugins install` (30s npm overhead),
|
|
101
|
-
* we copy
|
|
101
|
+
* we copy files directly. Same destination, same result.
|
|
102
|
+
*
|
|
103
|
+
* Since 0.5.5, the plugin is a thin shim (index.js) that imports the rest
|
|
104
|
+
* of its code from ./lib/*.js — copy the lib/ directory too, or the shim
|
|
105
|
+
* fails to load with MODULE_NOT_FOUND.
|
|
102
106
|
*/
|
|
103
107
|
function installPluginFiles() {
|
|
104
108
|
const require = createRequire(import.meta.url);
|
|
@@ -111,6 +115,15 @@ function installPluginFiles() {
|
|
|
111
115
|
for (const file of ['index.js', 'openclaw.plugin.json', 'package.json']) {
|
|
112
116
|
copyFileSync(join(pluginDir, file), join(targetDir, file));
|
|
113
117
|
}
|
|
118
|
+
|
|
119
|
+
// Copy lib/ recursively. Clear the destination first so files removed in
|
|
120
|
+
// a new version don't linger from a previous install.
|
|
121
|
+
const srcLib = join(pluginDir, 'lib');
|
|
122
|
+
const dstLib = join(targetDir, 'lib');
|
|
123
|
+
if (existsSync(srcLib)) {
|
|
124
|
+
rmSync(dstLib, { recursive: true, force: true });
|
|
125
|
+
cpSync(srcLib, dstLib, { recursive: true });
|
|
126
|
+
}
|
|
114
127
|
}
|
|
115
128
|
|
|
116
129
|
/**
|