plugin-updater 1.0.22 → 1.0.25
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/dist/index.d.ts +1 -0
- package/dist/index.js +27 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -18,4 +18,5 @@ export declare function uninstallNpmPlugin(name: string, configDir: string): str
|
|
|
18
18
|
export declare function updateNpmPlugin(name: string, configDir: string, updateInterval?: number): string;
|
|
19
19
|
export declare function updatePluginPublic(pluginName: string, gitUrl: string, branch?: string, commitHash?: string): Promise<void>;
|
|
20
20
|
export declare function earlyLaunch(configDir: string, plugins: Plugin[]): Promise<void>;
|
|
21
|
+
export declare function activate(): Promise<void>;
|
|
21
22
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -276,13 +276,13 @@ async function deployToExecutionDir(pluginName, executionPath, changed, configDi
|
|
|
276
276
|
if (fs.existsSync(packageJsonPath)) {
|
|
277
277
|
try {
|
|
278
278
|
writeLog(`Running npm install for ${pluginName}`);
|
|
279
|
-
execSync("npm install", { cwd: sourceDir, stdio: "
|
|
279
|
+
execSync("npm install", { cwd: sourceDir, stdio: "pipe" });
|
|
280
280
|
writeLog(`Finished npm install for ${pluginName}`);
|
|
281
281
|
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
282
282
|
if (pkg.main)
|
|
283
283
|
entryFile = pkg.main;
|
|
284
284
|
if (pkg.scripts?.build) {
|
|
285
|
-
execSync("npm run build", { cwd: sourceDir, stdio: "
|
|
285
|
+
execSync("npm run build", { cwd: sourceDir, stdio: "pipe" });
|
|
286
286
|
writeLog(`Finished npm run build for ${pluginName}`);
|
|
287
287
|
}
|
|
288
288
|
else {
|
|
@@ -291,7 +291,13 @@ async function deployToExecutionDir(pluginName, executionPath, changed, configDi
|
|
|
291
291
|
}
|
|
292
292
|
catch (error) {
|
|
293
293
|
const err = error;
|
|
294
|
+
const stderr = err.stderr ? err.stderr.toString().trim() : "";
|
|
295
|
+
const stdout = err.stdout ? err.stdout.toString().trim() : "";
|
|
294
296
|
writeLog(`Build/Install failed for ${pluginName}: ${err.message}`, true);
|
|
297
|
+
if (stderr)
|
|
298
|
+
writeLog(`npm stderr: ${stderr}`, true);
|
|
299
|
+
if (stdout)
|
|
300
|
+
writeLog(`npm stdout: ${stdout}`, true);
|
|
295
301
|
}
|
|
296
302
|
}
|
|
297
303
|
}
|
|
@@ -387,4 +393,22 @@ export async function earlyLaunch(configDir, plugins) {
|
|
|
387
393
|
}
|
|
388
394
|
}
|
|
389
395
|
}
|
|
390
|
-
|
|
396
|
+
export async function activate() {
|
|
397
|
+
const isClaude = process.argv.join(" ").includes("claude");
|
|
398
|
+
const appName = isClaude ? "claude" : "opencode";
|
|
399
|
+
const configDir = getAppConfigDir(appName);
|
|
400
|
+
writeLog(`Plugin updater activating for ${appName}`);
|
|
401
|
+
const pluginsJsonPath = path.join(configDir, "config", "plugins.json");
|
|
402
|
+
let gitPlugins = [];
|
|
403
|
+
if (fs.existsSync(pluginsJsonPath)) {
|
|
404
|
+
try {
|
|
405
|
+
gitPlugins = JSON.parse(fs.readFileSync(pluginsJsonPath, "utf-8"));
|
|
406
|
+
writeLog(`Found ${gitPlugins.length} git plugins in plugins.json`);
|
|
407
|
+
}
|
|
408
|
+
catch (e) {
|
|
409
|
+
writeLog(`Failed to parse plugins.json: ${e.message}`, true);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
await earlyLaunch(configDir, gitPlugins);
|
|
413
|
+
}
|
|
414
|
+
activate();
|