@uniformdev/transformer 1.1.35 → 1.1.36
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 +47 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +42 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -659,6 +659,7 @@ var CompositionConverterService = class {
|
|
|
659
659
|
);
|
|
660
660
|
const contentType = this.generateContentType(component);
|
|
661
661
|
contentTypeMap.set(rootType, contentType);
|
|
662
|
+
this.logger.debug(`Generated content type "${rootType}" with ${contentType.fields.length} field(s): ${contentType.fields.map((f) => f.id).join(", ")}`);
|
|
662
663
|
} catch (error) {
|
|
663
664
|
if (error instanceof ComponentNotFoundError) {
|
|
664
665
|
this.logger.warn(`Component not found: ${rootType} \u2014 skipping content type generation`);
|
|
@@ -694,6 +695,7 @@ var CompositionConverterService = class {
|
|
|
694
695
|
if (isRefType) {
|
|
695
696
|
const contentType = this.generateContentType(component);
|
|
696
697
|
targetContentTypeMap.set(targetType, contentType);
|
|
698
|
+
this.logger.debug(`Generated reference content type "${targetType}" with ${contentType.fields.length} field(s): ${contentType.fields.map((f) => f.id).join(", ")}`);
|
|
697
699
|
}
|
|
698
700
|
if (isBlockType) {
|
|
699
701
|
let blockId = targetType;
|
|
@@ -723,6 +725,7 @@ var CompositionConverterService = class {
|
|
|
723
725
|
blockContentType.id = blockId;
|
|
724
726
|
blockContentType.name = needsRename ? `${blockContentType.name} Block` : blockContentType.name;
|
|
725
727
|
targetContentTypeMap.set(blockId, blockContentType);
|
|
728
|
+
this.logger.debug(`Generated block content type "${blockId}" with ${blockContentType.fields.length} field(s): ${blockContentType.fields.map((f) => f.id).join(", ")}`);
|
|
726
729
|
}
|
|
727
730
|
if (!isBlockType) {
|
|
728
731
|
if (!isRefType) {
|
|
@@ -764,6 +767,7 @@ var CompositionConverterService = class {
|
|
|
764
767
|
}
|
|
765
768
|
} else {
|
|
766
769
|
entry = this.generateEntryFromComposition(composition);
|
|
770
|
+
this.logger.debug(`Generated entry "${entry.entry._id}" from composition "${compositionName}" (${compositionType}) with fields: ${Object.keys(entry.entry.fields).join(", ") || "(none)"}`);
|
|
767
771
|
}
|
|
768
772
|
const refsByType = /* @__PURE__ */ new Map();
|
|
769
773
|
if (componentsToReferences.length > 0 && comp.slots) {
|
|
@@ -781,6 +785,7 @@ var CompositionConverterService = class {
|
|
|
781
785
|
compositionName,
|
|
782
786
|
strict
|
|
783
787
|
);
|
|
788
|
+
this.logger.debug(`Composition "${compositionName}": found ${instances.length} instance(s) of reference type "${refType}"`);
|
|
784
789
|
if (instances.length > 0) {
|
|
785
790
|
refsByType.set(refType, instances);
|
|
786
791
|
if (missingTargetTypes.includes(refType)) {
|
|
@@ -794,6 +799,7 @@ var CompositionConverterService = class {
|
|
|
794
799
|
const refIds = [];
|
|
795
800
|
for (const inst of instances) {
|
|
796
801
|
const existingId = this.findExistingEntryBySourceItem(inst, sourceItemMap);
|
|
802
|
+
this.logger.debug(`Reference instance "${inst.determinisiticId}" (${refType}): ${existingId ? `reusing existing entry "${existingId}"` : `assigned new ID "${inst.determinisiticId}"`}`);
|
|
797
803
|
refIds.push(existingId ?? inst.determinisiticId);
|
|
798
804
|
}
|
|
799
805
|
resolvedRefIds.set(refType, refIds);
|
|
@@ -823,6 +829,7 @@ var CompositionConverterService = class {
|
|
|
823
829
|
compositionName,
|
|
824
830
|
strict
|
|
825
831
|
);
|
|
832
|
+
this.logger.debug(`Composition "${compositionName}": found ${instances.length} instance(s) of block type "${blockType}"`);
|
|
826
833
|
if (instances.length > 0) {
|
|
827
834
|
blocksByType.set(blockType, instances);
|
|
828
835
|
if (missingTargetTypes.includes(blockType)) {
|
|
@@ -879,6 +886,7 @@ var CompositionConverterService = class {
|
|
|
879
886
|
"UPDATE",
|
|
880
887
|
`${entriesDir}/${existingId}.json (${refType}, merged fields from "${this.truncate(compositionName, 50)}")`
|
|
881
888
|
);
|
|
889
|
+
this.logger.debug(`Merging fields [${Object.keys(inst.instance.parameters ?? {}).join(", ") || "(none)"}] into existing reference entry "${existingId}"`);
|
|
882
890
|
if (!whatIf) {
|
|
883
891
|
const existingEntry = await this.fileSystem.readFile(existingEntryPath2);
|
|
884
892
|
if (existingEntry?.entry) {
|
|
@@ -903,6 +911,7 @@ var CompositionConverterService = class {
|
|
|
903
911
|
"WRITE",
|
|
904
912
|
`${entriesDir}/${inst.determinisiticId}.json (${refType} from "${this.truncate(compositionName, 50)}")`
|
|
905
913
|
);
|
|
914
|
+
this.logger.debug(`Writing reference entry "${inst.determinisiticId}" (${refType}) with fields: ${Object.keys(flatEntry.entry.fields).join(", ") || "(none)"}`);
|
|
906
915
|
if (!whatIf) {
|
|
907
916
|
await this.fileSystem.writeFile(flatEntryPath, flatEntry);
|
|
908
917
|
}
|
|
@@ -929,6 +938,7 @@ var CompositionConverterService = class {
|
|
|
929
938
|
},
|
|
930
939
|
localizable: false
|
|
931
940
|
});
|
|
941
|
+
this.logger.debug(`Field "${refType}" (contentReference) added to content type "${contentType.id}"`);
|
|
932
942
|
}
|
|
933
943
|
}
|
|
934
944
|
}
|
|
@@ -951,6 +961,7 @@ var CompositionConverterService = class {
|
|
|
951
961
|
},
|
|
952
962
|
localizable: false
|
|
953
963
|
});
|
|
964
|
+
this.logger.debug(`Field "${resolvedBlockId}" ($block) added to content type "${contentType.id}"`);
|
|
954
965
|
}
|
|
955
966
|
}
|
|
956
967
|
}
|
|
@@ -975,6 +986,7 @@ var CompositionConverterService = class {
|
|
|
975
986
|
"WRITE",
|
|
976
987
|
`${contentTypesDir}/${typeName}.json (${baseFieldCount} fields${extrasInfo})`
|
|
977
988
|
);
|
|
989
|
+
this.logger.debug(`Content type "${typeName}" fields: ${contentType.fields.map((f) => `${f.id}:${f.type}`).join(", ")}`);
|
|
978
990
|
if (!whatIf) {
|
|
979
991
|
await this.fileSystem.writeFile(filePath, contentType);
|
|
980
992
|
}
|
|
@@ -987,6 +999,7 @@ var CompositionConverterService = class {
|
|
|
987
999
|
"WRITE",
|
|
988
1000
|
`${contentTypesDir}/${typeName}.json (${contentType.fields.length} fields)`
|
|
989
1001
|
);
|
|
1002
|
+
this.logger.debug(`Content type "${typeName}" fields: ${contentType.fields.map((f) => `${f.id}:${f.type}`).join(", ")}`);
|
|
990
1003
|
if (!whatIf) {
|
|
991
1004
|
await this.fileSystem.writeFile(filePath, contentType);
|
|
992
1005
|
}
|
|
@@ -1352,6 +1365,7 @@ var PropertyPropagatorService = class {
|
|
|
1352
1365
|
try {
|
|
1353
1366
|
const { component: sourceComponent, filePath: sourceFilePath } = await this.componentService.loadComponent(fullComponentsDir, sourceType, findOptions);
|
|
1354
1367
|
sourceComponents.push({ sourceType, sourceFilePath, sourceComponent });
|
|
1368
|
+
this.logger.debug(`Loaded source component "${sourceType}" from ${sourceFilePath}`);
|
|
1355
1369
|
} catch (error) {
|
|
1356
1370
|
if (error instanceof ComponentNotFoundError) {
|
|
1357
1371
|
this.logger.warn(`Component not found: ${sourceType} (searched: ${fullComponentsDir})`);
|
|
@@ -1362,6 +1376,7 @@ var PropertyPropagatorService = class {
|
|
|
1362
1376
|
}
|
|
1363
1377
|
this.logger.info(`Loading component: ${targetComponentType}`);
|
|
1364
1378
|
const { component: targetComponent, filePath: targetFilePath } = await this.componentService.loadComponent(fullComponentsDir, targetComponentType, findOptions);
|
|
1379
|
+
this.logger.debug(`Loaded target component "${targetComponentType}" from ${targetFilePath}`);
|
|
1365
1380
|
const propertyNames = property.split("|").map((p) => p.trim()).filter((p) => p.length > 0);
|
|
1366
1381
|
const resolvedParams = [];
|
|
1367
1382
|
const resolvedNames = [];
|
|
@@ -1382,6 +1397,8 @@ var PropertyPropagatorService = class {
|
|
|
1382
1397
|
if (!exists) {
|
|
1383
1398
|
resolvedParams.push(param);
|
|
1384
1399
|
resolvedNames.push(param.id);
|
|
1400
|
+
} else {
|
|
1401
|
+
this.logger.debug(`Parameter "${param.id}" already collected from another source \u2014 skipping duplicate`);
|
|
1385
1402
|
}
|
|
1386
1403
|
}
|
|
1387
1404
|
}
|
|
@@ -1420,7 +1437,10 @@ var PropertyPropagatorService = class {
|
|
|
1420
1437
|
targetGroup,
|
|
1421
1438
|
findOptions
|
|
1422
1439
|
);
|
|
1440
|
+
this.logger.debug(`Group "${targetGroup}" (id: ${groupId}) created on component ${targetComponentType}`);
|
|
1423
1441
|
componentModified = true;
|
|
1442
|
+
} else {
|
|
1443
|
+
this.logger.debug(`Group "${targetGroup}" (id: ${groupId}) already exists on ${targetComponentType}`);
|
|
1424
1444
|
}
|
|
1425
1445
|
for (const param of resolvedParams) {
|
|
1426
1446
|
const existingParam = this.componentService.findParameter(
|
|
@@ -1445,6 +1465,7 @@ var PropertyPropagatorService = class {
|
|
|
1445
1465
|
param.id,
|
|
1446
1466
|
findOptions
|
|
1447
1467
|
);
|
|
1468
|
+
this.logger.debug(`Parameter "${param.id}" (type: ${param.type}) added to component ${targetComponentType} in group "${targetGroup}"`);
|
|
1448
1469
|
componentModified = true;
|
|
1449
1470
|
} else {
|
|
1450
1471
|
this.logger.info(`Parameter "${param.id}" already exists on ${targetComponentType}`);
|
|
@@ -1464,7 +1485,10 @@ var PropertyPropagatorService = class {
|
|
|
1464
1485
|
param.id,
|
|
1465
1486
|
findOptions
|
|
1466
1487
|
);
|
|
1488
|
+
this.logger.debug(`Parameter "${param.id}" added to group "${targetGroup}" on ${targetComponentType} (was missing from group)`);
|
|
1467
1489
|
componentModified = true;
|
|
1490
|
+
} else {
|
|
1491
|
+
this.logger.debug(`Parameter "${param.id}" already in group "${targetGroup}" on ${targetComponentType} \u2014 no change`);
|
|
1468
1492
|
}
|
|
1469
1493
|
}
|
|
1470
1494
|
}
|
|
@@ -1477,6 +1501,7 @@ var PropertyPropagatorService = class {
|
|
|
1477
1501
|
compositionTypes,
|
|
1478
1502
|
findOptions
|
|
1479
1503
|
);
|
|
1504
|
+
this.logger.debug(`Found ${compositions.length} composition(s) matching types [${compositionTypes.join(", ")}]`);
|
|
1480
1505
|
let modifiedCompositions = 0;
|
|
1481
1506
|
let propagatedInstances = 0;
|
|
1482
1507
|
for (const { composition, filePath } of compositions) {
|
|
@@ -1487,6 +1512,7 @@ var PropertyPropagatorService = class {
|
|
|
1487
1512
|
findOptions
|
|
1488
1513
|
);
|
|
1489
1514
|
if (instances.length === 0) {
|
|
1515
|
+
this.logger.debug(`Skipping "${filePath}": no instances of ${targetComponentType} found`);
|
|
1490
1516
|
continue;
|
|
1491
1517
|
}
|
|
1492
1518
|
const valuesToPropagate = {};
|
|
@@ -1496,6 +1522,7 @@ var PropertyPropagatorService = class {
|
|
|
1496
1522
|
}
|
|
1497
1523
|
}
|
|
1498
1524
|
if (Object.keys(valuesToPropagate).length === 0) {
|
|
1525
|
+
this.logger.debug(`Skipping "${filePath}": ${instances.length} instance(s) of ${targetComponentType} found but none of [${resolvedNames.join(", ")}] present in root overrides`);
|
|
1499
1526
|
continue;
|
|
1500
1527
|
}
|
|
1501
1528
|
let compositionModified = false;
|
|
@@ -1507,9 +1534,11 @@ var PropertyPropagatorService = class {
|
|
|
1507
1534
|
this.compositionService.setInstanceParameters(instance, clonedValues);
|
|
1508
1535
|
compositionModified = true;
|
|
1509
1536
|
propagatedInstances++;
|
|
1537
|
+
const updatedParamNames = Object.keys(valuesToPropagate).join(", ");
|
|
1510
1538
|
instanceUpdates.push(
|
|
1511
|
-
`${targetComponentType} "${instanceName}": ${
|
|
1539
|
+
`${targetComponentType} "${instanceName}": ${updatedParamNames}`
|
|
1512
1540
|
);
|
|
1541
|
+
this.logger.debug(`Component ${targetComponentType} "${instanceName}": parameters ${updatedParamNames} updated`);
|
|
1513
1542
|
}
|
|
1514
1543
|
if (compositionModified) {
|
|
1515
1544
|
this.logger.action(whatIf, "UPDATE", `composition/${relativePath}`);
|
|
@@ -1532,7 +1561,10 @@ var PropertyPropagatorService = class {
|
|
|
1532
1561
|
if (exists) {
|
|
1533
1562
|
this.logger.action(whatIf, "DELETE", `Parameter "${param.id}" from ${sourceType}`);
|
|
1534
1563
|
modifiedSource = this.componentService.removeParameter(modifiedSource, param.id, findOptions);
|
|
1564
|
+
this.logger.debug(`Parameter "${param.id}" removed from component ${sourceType}`);
|
|
1535
1565
|
sourceComponentModified = true;
|
|
1566
|
+
} else {
|
|
1567
|
+
this.logger.debug(`Parameter "${param.id}" not found on source component "${sourceType}" \u2014 nothing to delete`);
|
|
1536
1568
|
}
|
|
1537
1569
|
}
|
|
1538
1570
|
const beforeGroupCount = modifiedSource.parameters?.filter(
|
|
@@ -1571,6 +1603,8 @@ var PropertyPropagatorService = class {
|
|
|
1571
1603
|
if (!whatIf) {
|
|
1572
1604
|
await this.compositionService.saveComposition(filePath, composition);
|
|
1573
1605
|
}
|
|
1606
|
+
} else {
|
|
1607
|
+
this.logger.debug(`No root overrides matching [${resolvedNames.join(", ")}] in composition/${relativePath}`);
|
|
1574
1608
|
}
|
|
1575
1609
|
}
|
|
1576
1610
|
}
|
|
@@ -1598,9 +1632,16 @@ var PropertyPropagatorService = class {
|
|
|
1598
1632
|
// src/cli/logger.ts
|
|
1599
1633
|
import chalk from "chalk";
|
|
1600
1634
|
var Logger = class {
|
|
1635
|
+
constructor(verbose = false) {
|
|
1636
|
+
this.verbose = verbose;
|
|
1637
|
+
}
|
|
1601
1638
|
info(message) {
|
|
1602
1639
|
console.log(`${chalk.blue("[INFO]")} ${message}`);
|
|
1603
1640
|
}
|
|
1641
|
+
debug(message) {
|
|
1642
|
+
if (!this.verbose) return;
|
|
1643
|
+
console.log(`${chalk.magenta("[DEBUG]")} ${message}`);
|
|
1644
|
+
}
|
|
1604
1645
|
success(message) {
|
|
1605
1646
|
console.log(`${chalk.green("[DONE]")} ${message}`);
|
|
1606
1647
|
}
|
|
@@ -1636,7 +1677,7 @@ function createPropagateRootComponentPropertyCommand() {
|
|
|
1636
1677
|
).option(
|
|
1637
1678
|
"--deleteSourceParameter",
|
|
1638
1679
|
"Delete the original parameters from the source component after propagation"
|
|
1639
|
-
).hook("preAction", (thisCommand) => {
|
|
1680
|
+
).option("--verbose", "Enable verbose output with detailed progress information").hook("preAction", (thisCommand) => {
|
|
1640
1681
|
const opts = thisCommand.opts();
|
|
1641
1682
|
const requiredOptions = [
|
|
1642
1683
|
{ name: "compositionType", flag: "--compositionType" },
|
|
@@ -1659,7 +1700,7 @@ function createPropagateRootComponentPropertyCommand() {
|
|
|
1659
1700
|
targetGroup: opts.targetGroup,
|
|
1660
1701
|
deleteSourceParameter: opts.deleteSourceParameter
|
|
1661
1702
|
};
|
|
1662
|
-
const logger = new Logger();
|
|
1703
|
+
const logger = new Logger(opts.verbose ?? false);
|
|
1663
1704
|
const fileSystem = new FileSystemService();
|
|
1664
1705
|
const componentService = new ComponentService(fileSystem);
|
|
1665
1706
|
const compositionService = new CompositionService(fileSystem);
|
|
@@ -4447,7 +4488,7 @@ function createConvertCompositionsToEntriesCommand() {
|
|
|
4447
4488
|
).option(
|
|
4448
4489
|
"--componentsToBlocks <types>",
|
|
4449
4490
|
"Pipe-separated list of component types to convert into inline blocks (e.g., DetailHero|ArticleDetail)"
|
|
4450
|
-
).hook("preAction", (thisCommand) => {
|
|
4491
|
+
).option("--verbose", "Enable verbose output with detailed progress information").hook("preAction", (thisCommand) => {
|
|
4451
4492
|
const opts = thisCommand.opts();
|
|
4452
4493
|
const requiredOptions = [
|
|
4453
4494
|
{ name: "compositionTypes", flag: "--compositionTypes" }
|
|
@@ -4465,7 +4506,7 @@ function createConvertCompositionsToEntriesCommand() {
|
|
|
4465
4506
|
componentsToReferences: opts.componentsToReferences,
|
|
4466
4507
|
componentsToBlocks: opts.componentsToBlocks
|
|
4467
4508
|
};
|
|
4468
|
-
const logger = new Logger();
|
|
4509
|
+
const logger = new Logger(opts.verbose ?? false);
|
|
4469
4510
|
const fileSystem = new FileSystemService();
|
|
4470
4511
|
const componentService = new ComponentService(fileSystem);
|
|
4471
4512
|
const compositionService = new CompositionService(fileSystem);
|
|
@@ -6033,7 +6074,7 @@ function createRemoveOrphanEntriesCommand() {
|
|
|
6033
6074
|
// package.json
|
|
6034
6075
|
var package_default = {
|
|
6035
6076
|
name: "@uniformdev/transformer",
|
|
6036
|
-
version: "1.1.
|
|
6077
|
+
version: "1.1.36",
|
|
6037
6078
|
description: "CLI tool for transforming Uniform.dev serialization files offline",
|
|
6038
6079
|
type: "module",
|
|
6039
6080
|
bin: {
|