oh-my-customcode 0.23.0 → 0.23.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/dist/cli/index.js +36 -26
- package/dist/index.js +36 -26
- package/package.json +1 -1
- package/templates/manifest.json +2 -2
package/dist/cli/index.js
CHANGED
|
@@ -15139,11 +15139,17 @@ function mergeEntryDoc(existingContent, templateContent) {
|
|
|
15139
15139
|
const hasManagedSections = sections.some((s) => s.type === "managed");
|
|
15140
15140
|
if (!hasManagedSections) {
|
|
15141
15141
|
const wrapped = wrapInManagedMarkers(templateContent);
|
|
15142
|
+
const existingTrimmed = existingContent.trim();
|
|
15143
|
+
const content = existingTrimmed ? `${wrapped}
|
|
15144
|
+
|
|
15145
|
+
${existingTrimmed}` : wrapped;
|
|
15142
15146
|
return {
|
|
15143
|
-
content
|
|
15147
|
+
content,
|
|
15144
15148
|
managedSections: 1,
|
|
15145
|
-
customSections: 0,
|
|
15146
|
-
warnings:
|
|
15149
|
+
customSections: existingTrimmed ? 1 : 0,
|
|
15150
|
+
warnings: existingTrimmed ? [
|
|
15151
|
+
"No managed sections found in existing content. Template inserted as managed section, existing content preserved below."
|
|
15152
|
+
] : ["No managed sections found in existing content, wrapping template entirely"]
|
|
15147
15153
|
};
|
|
15148
15154
|
}
|
|
15149
15155
|
const mergedSections = [];
|
|
@@ -15338,6 +15344,32 @@ async function updateEntryDoc(targetDir, config, options) {
|
|
|
15338
15344
|
info("update.entry_doc_created", { path: layout.entryFile });
|
|
15339
15345
|
}
|
|
15340
15346
|
}
|
|
15347
|
+
async function runFullUpdatePostProcessing(options, result, config) {
|
|
15348
|
+
const isFullUpdate = !options.components || options.components.length === 0;
|
|
15349
|
+
if (isFullUpdate) {
|
|
15350
|
+
const synced = await syncRootLevelFiles(options.targetDir, options);
|
|
15351
|
+
result.syncedRootFiles = synced;
|
|
15352
|
+
const removed = await removeDeprecatedFiles(options.targetDir, options);
|
|
15353
|
+
result.removedDeprecatedFiles = removed;
|
|
15354
|
+
if (!options.dryRun) {
|
|
15355
|
+
await updateEntryDoc(options.targetDir, config, options);
|
|
15356
|
+
}
|
|
15357
|
+
}
|
|
15358
|
+
if (!options.dryRun) {
|
|
15359
|
+
config.version = result.newVersion;
|
|
15360
|
+
config.lastUpdated = new Date().toISOString();
|
|
15361
|
+
await saveConfig(options.targetDir, config);
|
|
15362
|
+
}
|
|
15363
|
+
result.success = true;
|
|
15364
|
+
if (result.previousVersion !== result.newVersion) {
|
|
15365
|
+
success("update.success", { from: result.previousVersion, to: result.newVersion });
|
|
15366
|
+
} else if (result.updatedComponents.length > 0) {
|
|
15367
|
+
success("update.components_synced", {
|
|
15368
|
+
version: result.newVersion,
|
|
15369
|
+
components: result.updatedComponents.join(", ")
|
|
15370
|
+
});
|
|
15371
|
+
}
|
|
15372
|
+
}
|
|
15341
15373
|
async function update(options) {
|
|
15342
15374
|
const result = createUpdateResult();
|
|
15343
15375
|
try {
|
|
@@ -15358,29 +15390,7 @@ async function update(options) {
|
|
|
15358
15390
|
const customizations = resolveCustomizations(manifestCustomizations, configPreserveFiles, options.targetDir);
|
|
15359
15391
|
const components = options.components || getAllUpdateComponents();
|
|
15360
15392
|
await updateAllComponents(options.targetDir, components, updateCheck, customizations, options, result, config);
|
|
15361
|
-
|
|
15362
|
-
const synced = await syncRootLevelFiles(options.targetDir, options);
|
|
15363
|
-
result.syncedRootFiles = synced;
|
|
15364
|
-
}
|
|
15365
|
-
if (!options.components || options.components.length === 0) {
|
|
15366
|
-
const removed = await removeDeprecatedFiles(options.targetDir, options);
|
|
15367
|
-
result.removedDeprecatedFiles = removed;
|
|
15368
|
-
}
|
|
15369
|
-
if (!options.components || options.components.length === 0) {
|
|
15370
|
-
await updateEntryDoc(options.targetDir, config, options);
|
|
15371
|
-
}
|
|
15372
|
-
config.version = result.newVersion;
|
|
15373
|
-
config.lastUpdated = new Date().toISOString();
|
|
15374
|
-
await saveConfig(options.targetDir, config);
|
|
15375
|
-
result.success = true;
|
|
15376
|
-
if (result.previousVersion !== result.newVersion) {
|
|
15377
|
-
success("update.success", { from: result.previousVersion, to: result.newVersion });
|
|
15378
|
-
} else if (result.updatedComponents.length > 0) {
|
|
15379
|
-
success("update.components_synced", {
|
|
15380
|
-
version: result.newVersion,
|
|
15381
|
-
components: result.updatedComponents.join(", ")
|
|
15382
|
-
});
|
|
15383
|
-
}
|
|
15393
|
+
await runFullUpdatePostProcessing(options, result, config);
|
|
15384
15394
|
} catch (err) {
|
|
15385
15395
|
const message = err instanceof Error ? err.message : String(err);
|
|
15386
15396
|
result.error = message;
|
package/dist/index.js
CHANGED
|
@@ -1155,11 +1155,17 @@ function mergeEntryDoc(existingContent, templateContent) {
|
|
|
1155
1155
|
const hasManagedSections = sections.some((s) => s.type === "managed");
|
|
1156
1156
|
if (!hasManagedSections) {
|
|
1157
1157
|
const wrapped = wrapInManagedMarkers(templateContent);
|
|
1158
|
+
const existingTrimmed = existingContent.trim();
|
|
1159
|
+
const content = existingTrimmed ? `${wrapped}
|
|
1160
|
+
|
|
1161
|
+
${existingTrimmed}` : wrapped;
|
|
1158
1162
|
return {
|
|
1159
|
-
content
|
|
1163
|
+
content,
|
|
1160
1164
|
managedSections: 1,
|
|
1161
|
-
customSections: 0,
|
|
1162
|
-
warnings:
|
|
1165
|
+
customSections: existingTrimmed ? 1 : 0,
|
|
1166
|
+
warnings: existingTrimmed ? [
|
|
1167
|
+
"No managed sections found in existing content. Template inserted as managed section, existing content preserved below."
|
|
1168
|
+
] : ["No managed sections found in existing content, wrapping template entirely"]
|
|
1163
1169
|
};
|
|
1164
1170
|
}
|
|
1165
1171
|
const mergedSections = [];
|
|
@@ -1354,6 +1360,32 @@ async function updateEntryDoc(targetDir, config, options) {
|
|
|
1354
1360
|
info("update.entry_doc_created", { path: layout.entryFile });
|
|
1355
1361
|
}
|
|
1356
1362
|
}
|
|
1363
|
+
async function runFullUpdatePostProcessing(options, result, config) {
|
|
1364
|
+
const isFullUpdate = !options.components || options.components.length === 0;
|
|
1365
|
+
if (isFullUpdate) {
|
|
1366
|
+
const synced = await syncRootLevelFiles(options.targetDir, options);
|
|
1367
|
+
result.syncedRootFiles = synced;
|
|
1368
|
+
const removed = await removeDeprecatedFiles(options.targetDir, options);
|
|
1369
|
+
result.removedDeprecatedFiles = removed;
|
|
1370
|
+
if (!options.dryRun) {
|
|
1371
|
+
await updateEntryDoc(options.targetDir, config, options);
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
if (!options.dryRun) {
|
|
1375
|
+
config.version = result.newVersion;
|
|
1376
|
+
config.lastUpdated = new Date().toISOString();
|
|
1377
|
+
await saveConfig(options.targetDir, config);
|
|
1378
|
+
}
|
|
1379
|
+
result.success = true;
|
|
1380
|
+
if (result.previousVersion !== result.newVersion) {
|
|
1381
|
+
success("update.success", { from: result.previousVersion, to: result.newVersion });
|
|
1382
|
+
} else if (result.updatedComponents.length > 0) {
|
|
1383
|
+
success("update.components_synced", {
|
|
1384
|
+
version: result.newVersion,
|
|
1385
|
+
components: result.updatedComponents.join(", ")
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1357
1389
|
async function update(options) {
|
|
1358
1390
|
const result = createUpdateResult();
|
|
1359
1391
|
try {
|
|
@@ -1374,29 +1406,7 @@ async function update(options) {
|
|
|
1374
1406
|
const customizations = resolveCustomizations(manifestCustomizations, configPreserveFiles, options.targetDir);
|
|
1375
1407
|
const components = options.components || getAllUpdateComponents();
|
|
1376
1408
|
await updateAllComponents(options.targetDir, components, updateCheck, customizations, options, result, config);
|
|
1377
|
-
|
|
1378
|
-
const synced = await syncRootLevelFiles(options.targetDir, options);
|
|
1379
|
-
result.syncedRootFiles = synced;
|
|
1380
|
-
}
|
|
1381
|
-
if (!options.components || options.components.length === 0) {
|
|
1382
|
-
const removed = await removeDeprecatedFiles(options.targetDir, options);
|
|
1383
|
-
result.removedDeprecatedFiles = removed;
|
|
1384
|
-
}
|
|
1385
|
-
if (!options.components || options.components.length === 0) {
|
|
1386
|
-
await updateEntryDoc(options.targetDir, config, options);
|
|
1387
|
-
}
|
|
1388
|
-
config.version = result.newVersion;
|
|
1389
|
-
config.lastUpdated = new Date().toISOString();
|
|
1390
|
-
await saveConfig(options.targetDir, config);
|
|
1391
|
-
result.success = true;
|
|
1392
|
-
if (result.previousVersion !== result.newVersion) {
|
|
1393
|
-
success("update.success", { from: result.previousVersion, to: result.newVersion });
|
|
1394
|
-
} else if (result.updatedComponents.length > 0) {
|
|
1395
|
-
success("update.components_synced", {
|
|
1396
|
-
version: result.newVersion,
|
|
1397
|
-
components: result.updatedComponents.join(", ")
|
|
1398
|
-
});
|
|
1399
|
-
}
|
|
1409
|
+
await runFullUpdatePostProcessing(options, result, config);
|
|
1400
1410
|
} catch (err) {
|
|
1401
1411
|
const message = err instanceof Error ? err.message : String(err);
|
|
1402
1412
|
result.error = message;
|
package/package.json
CHANGED
package/templates/manifest.json
CHANGED