plugin-updater 1.2.0 → 1.3.0
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/log.d.ts +1 -1
- package/dist/log.js +7 -24
- package/package.json +4 -2
package/dist/log.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare function getPluginConfig(): Record<string, unknown>;
|
|
2
|
-
export declare
|
|
2
|
+
export declare const writeLog: (message: string, isError?: boolean) => void;
|
package/dist/log.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
// File + console logging delegated to the shared core logger, so plugin-updater's
|
|
2
|
+
// lines get the same `[plugin-updater]` prefix, per-plugin color, and GLOBAL console
|
|
3
|
+
// toggle (config/core.json logConsole / CORE_LOG_CONSOLE) as every other plugin.
|
|
4
|
+
// File logging still respects plugin-updater.json `logging`.
|
|
1
5
|
import fs from "fs";
|
|
2
6
|
import path from "path";
|
|
3
7
|
import { getAppConfigDir, getAppName } from "./env.js";
|
|
4
|
-
|
|
8
|
+
// @ts-ignore — generated bundle, no .d.ts
|
|
9
|
+
import { makeWriteLog } from "../core/dist/index.js";
|
|
5
10
|
let pluginConfig = null;
|
|
6
11
|
export function getPluginConfig() {
|
|
7
12
|
if (pluginConfig !== null)
|
|
@@ -18,26 +23,4 @@ export function getPluginConfig() {
|
|
|
18
23
|
}
|
|
19
24
|
return pluginConfig ?? {};
|
|
20
25
|
}
|
|
21
|
-
export
|
|
22
|
-
const loggingEnabled = getPluginConfig().logging !== false;
|
|
23
|
-
try {
|
|
24
|
-
if (loggingEnabled) {
|
|
25
|
-
const date = new Date();
|
|
26
|
-
const dateStr = date.toISOString().split("T")[0];
|
|
27
|
-
const configDir = getAppConfigDir(getAppName());
|
|
28
|
-
const logsDir = path.join(configDir, "logs", dateStr);
|
|
29
|
-
if (!fs.existsSync(logsDir))
|
|
30
|
-
fs.mkdirSync(logsDir, { recursive: true });
|
|
31
|
-
const logFile = path.join(logsDir, `plugin-updater-${START_TIME}.log`);
|
|
32
|
-
const prefix = isError ? "[ERROR]" : "[INFO]";
|
|
33
|
-
fs.appendFileSync(logFile, `[${date.toISOString()}] ${prefix} ${message}\n`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
catch { /* never crash on log failure */ }
|
|
37
|
-
if (process.env.PLUGIN_UPDATER_LIBRARY_MODE === "1" && process.env.PLUGIN_UPDATER_CLI !== "1")
|
|
38
|
-
return;
|
|
39
|
-
if (isError)
|
|
40
|
-
console.error(message);
|
|
41
|
-
else if (loggingEnabled)
|
|
42
|
-
console.log(message);
|
|
43
|
-
}
|
|
26
|
+
export const writeLog = makeWriteLog("plugin-updater", getAppConfigDir(getAppName()));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plugin-updater",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Plugin lifecycle manager for OpenCode and Claude Code launchers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -31,11 +31,13 @@
|
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "npx esbuild core/src/index.ts --bundle --platform=node --format=esm --outfile=core/dist/index.js && tsc",
|
|
34
|
+
"test": "npm run build && vitest run",
|
|
34
35
|
"prepublishOnly": "npm run build"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"esbuild": "^0.25.12",
|
|
38
39
|
"@types/node": "^22.0.0",
|
|
39
|
-
"typescript": "^5.0.0"
|
|
40
|
+
"typescript": "^5.0.0",
|
|
41
|
+
"vitest": "^3.2.6"
|
|
40
42
|
}
|
|
41
43
|
}
|