@ztffn/presentation-generator-plugin 1.0.9 → 1.1.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/bin/index.js +12 -9
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -160,7 +160,7 @@ async function resolveInstallTarget() {
|
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
function writeSettings(settingsPath
|
|
163
|
+
function writeSettings(settingsPath) {
|
|
164
164
|
let settings = {};
|
|
165
165
|
if (fs.existsSync(settingsPath)) {
|
|
166
166
|
try {
|
|
@@ -170,11 +170,13 @@ function writeSettings(settingsPath, installDir) {
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
if (!
|
|
174
|
-
settings.enabledPlugins =
|
|
173
|
+
if (!Array.isArray(settings.enabledPlugins)) {
|
|
174
|
+
settings.enabledPlugins = [];
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
settings.enabledPlugins
|
|
177
|
+
if (!settings.enabledPlugins.includes(PLUGIN_NAME)) {
|
|
178
|
+
settings.enabledPlugins.push(PLUGIN_NAME);
|
|
179
|
+
}
|
|
178
180
|
|
|
179
181
|
fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
|
|
180
182
|
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
@@ -184,9 +186,10 @@ function removeFromSettings(settingsPath) {
|
|
|
184
186
|
if (!fs.existsSync(settingsPath)) return;
|
|
185
187
|
try {
|
|
186
188
|
const settings = JSON.parse(fs.readFileSync(settingsPath, "utf8"));
|
|
187
|
-
if (!
|
|
188
|
-
|
|
189
|
-
|
|
189
|
+
if (!Array.isArray(settings.enabledPlugins)) return;
|
|
190
|
+
const filtered = settings.enabledPlugins.filter((p) => p !== PLUGIN_NAME);
|
|
191
|
+
if (filtered.length !== settings.enabledPlugins.length) {
|
|
192
|
+
settings.enabledPlugins = filtered;
|
|
190
193
|
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
191
194
|
console.log(`Removed entry from ${settingsPath}`);
|
|
192
195
|
}
|
|
@@ -237,7 +240,7 @@ async function install() {
|
|
|
237
240
|
console.log(`\nInstalled v${meta.version} to: ${label}`);
|
|
238
241
|
|
|
239
242
|
console.log("\nRegistering plugin with Claude Code...");
|
|
240
|
-
writeSettings(settingsPath
|
|
243
|
+
writeSettings(settingsPath);
|
|
241
244
|
|
|
242
245
|
const settingsLabel = scope === "project" ? ".claude/settings.json" : "~/.claude/settings.json";
|
|
243
246
|
console.log(`Plugin registered in ${settingsLabel} ✓`);
|
|
@@ -273,7 +276,7 @@ async function update() {
|
|
|
273
276
|
|
|
274
277
|
console.log(`\n${label}: updating v${before || "unknown"} → v${meta.version}...`);
|
|
275
278
|
await downloadAndExtract(meta.version, meta.tarball, installDir);
|
|
276
|
-
writeSettings(settingsPath
|
|
279
|
+
writeSettings(settingsPath);
|
|
277
280
|
console.log(`${label}: updated to v${meta.version} ✓`);
|
|
278
281
|
}
|
|
279
282
|
}
|