@uniformdev/transformer 1.1.19 → 1.1.20
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 +23 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +22 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -189,7 +189,27 @@ var ComponentService = class {
|
|
|
189
189
|
throw new ComponentNotFoundError(componentType, componentsDir);
|
|
190
190
|
}
|
|
191
191
|
async saveComponent(filePath, component) {
|
|
192
|
-
|
|
192
|
+
const sorted = this.sortComponentArrays(component);
|
|
193
|
+
await this.fileSystem.writeFile(filePath, sorted);
|
|
194
|
+
}
|
|
195
|
+
sortComponentArrays(component) {
|
|
196
|
+
const result = { ...component };
|
|
197
|
+
if (result.parameters) {
|
|
198
|
+
result.parameters = [...result.parameters].sort((a, b) => a.id.localeCompare(b.id));
|
|
199
|
+
}
|
|
200
|
+
if (result.slots) {
|
|
201
|
+
result.slots = [...result.slots].sort((a, b) => a.id.localeCompare(b.id)).map((slot) => {
|
|
202
|
+
if (slot.allowedComponents) {
|
|
203
|
+
return { ...slot, allowedComponents: [...slot.allowedComponents].sort((a, b) => a.localeCompare(b)) };
|
|
204
|
+
}
|
|
205
|
+
return slot;
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
const variants = result.variants;
|
|
209
|
+
if (Array.isArray(variants)) {
|
|
210
|
+
result.variants = [...variants].sort((a, b) => a.id.localeCompare(b.id));
|
|
211
|
+
}
|
|
212
|
+
return result;
|
|
193
213
|
}
|
|
194
214
|
findParameter(component, parameterName, options = {}) {
|
|
195
215
|
const { strict = false } = options;
|
|
@@ -1021,7 +1041,7 @@ function walkAndRegenerate(value, currentPath) {
|
|
|
1021
1041
|
for (const [key, val] of Object.entries(obj)) {
|
|
1022
1042
|
const childPath = `${currentPath}.${key}`;
|
|
1023
1043
|
if (key === "_id" && typeof val === "string" && UUID_PATTERN.test(val)) {
|
|
1024
|
-
result[key] = computeGuidHash(
|
|
1044
|
+
result[key] = computeGuidHash(childPath);
|
|
1025
1045
|
} else {
|
|
1026
1046
|
result[key] = walkAndRegenerate(val, childPath);
|
|
1027
1047
|
}
|
|
@@ -4721,7 +4741,7 @@ function createRemoveFieldCommand() {
|
|
|
4721
4741
|
// package.json
|
|
4722
4742
|
var package_default = {
|
|
4723
4743
|
name: "@uniformdev/transformer",
|
|
4724
|
-
version: "1.1.
|
|
4744
|
+
version: "1.1.20",
|
|
4725
4745
|
description: "CLI tool for transforming Uniform.dev serialization files offline",
|
|
4726
4746
|
type: "module",
|
|
4727
4747
|
bin: {
|