@uniformdev/transformer 1.1.32 → 1.1.34
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 +78 -25
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -4766,20 +4766,60 @@ function createRemoveParameterCommand() {
|
|
|
4766
4766
|
const fileSystem = new FileSystemService();
|
|
4767
4767
|
const componentService = new ComponentService(fileSystem);
|
|
4768
4768
|
const remover = new ParameterRemoverService(fileSystem, componentService, logger);
|
|
4769
|
+
const rawTypes = options.componentType.split("|").map((t) => t.trim()).filter(Boolean);
|
|
4770
|
+
const hasWildcard = rawTypes.includes("*");
|
|
4771
|
+
let componentTypes;
|
|
4772
|
+
if (hasWildcard) {
|
|
4773
|
+
const fullComponentsDir = fileSystem.resolvePath(options.rootDir, options.componentsDir);
|
|
4774
|
+
let allFiles = [];
|
|
4775
|
+
try {
|
|
4776
|
+
allFiles = await fileSystem.findFiles(fullComponentsDir, "*.{json,yaml,yml}");
|
|
4777
|
+
} catch {
|
|
4778
|
+
}
|
|
4779
|
+
const allTypeNames = allFiles.map(
|
|
4780
|
+
(f) => fileSystem.getBasename(f).replace(/\.(json|yaml|yml)$/i, "")
|
|
4781
|
+
);
|
|
4782
|
+
const explicit = rawTypes.filter((t) => t !== "*");
|
|
4783
|
+
const seen = new Set(explicit.map((t) => t.toLowerCase()));
|
|
4784
|
+
componentTypes = [
|
|
4785
|
+
...explicit,
|
|
4786
|
+
...allTypeNames.filter((t) => !seen.has(t.toLowerCase()))
|
|
4787
|
+
];
|
|
4788
|
+
} else {
|
|
4789
|
+
componentTypes = rawTypes;
|
|
4790
|
+
}
|
|
4791
|
+
const aggregate = {
|
|
4792
|
+
compositionsModified: 0,
|
|
4793
|
+
compositionPatternsModified: 0,
|
|
4794
|
+
componentPatternsModified: 0
|
|
4795
|
+
};
|
|
4769
4796
|
try {
|
|
4770
|
-
const
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4797
|
+
for (const componentType of componentTypes) {
|
|
4798
|
+
try {
|
|
4799
|
+
const result = await remover.remove({
|
|
4800
|
+
rootDir: options.rootDir,
|
|
4801
|
+
componentsDir: options.componentsDir,
|
|
4802
|
+
compositionsDir: options.compositionsDir,
|
|
4803
|
+
compositionPatternsDir: options.compositionPatternsDir,
|
|
4804
|
+
componentPatternsDir: options.componentPatternsDir,
|
|
4805
|
+
componentType,
|
|
4806
|
+
parameterId: options.parameterId,
|
|
4807
|
+
whatIf: options.whatIf ?? false,
|
|
4808
|
+
strict: options.strict ?? false
|
|
4809
|
+
});
|
|
4810
|
+
aggregate.compositionsModified += result.compositionsModified;
|
|
4811
|
+
aggregate.compositionPatternsModified += result.compositionPatternsModified;
|
|
4812
|
+
aggregate.componentPatternsModified += result.componentPatternsModified;
|
|
4813
|
+
} catch (error) {
|
|
4814
|
+
if (hasWildcard && (error instanceof ComponentNotFoundError || error instanceof PropertyNotFoundError)) {
|
|
4815
|
+
logger.warn(error.message);
|
|
4816
|
+
continue;
|
|
4817
|
+
}
|
|
4818
|
+
throw error;
|
|
4819
|
+
}
|
|
4820
|
+
}
|
|
4781
4821
|
logger.success(
|
|
4782
|
-
`Removed parameter: ${
|
|
4822
|
+
`Removed parameter: ${aggregate.compositionsModified} composition(s), ${aggregate.compositionPatternsModified} composition pattern(s), ${aggregate.componentPatternsModified} component pattern(s) updated`
|
|
4783
4823
|
);
|
|
4784
4824
|
} catch (error) {
|
|
4785
4825
|
if (error instanceof TransformError) {
|
|
@@ -4803,6 +4843,7 @@ var FieldRemoverService = class {
|
|
|
4803
4843
|
this.logger = logger;
|
|
4804
4844
|
}
|
|
4805
4845
|
compareIds(id1, id2, strict) {
|
|
4846
|
+
if (id2 === "*") return true;
|
|
4806
4847
|
if (strict) {
|
|
4807
4848
|
return id1 === id2;
|
|
4808
4849
|
}
|
|
@@ -5036,20 +5077,32 @@ function createRemoveFieldCommand() {
|
|
|
5036
5077
|
const fileSystem = new FileSystemService();
|
|
5037
5078
|
const componentService = new ComponentService(fileSystem);
|
|
5038
5079
|
const remover = new FieldRemoverService(fileSystem, componentService, logger);
|
|
5080
|
+
const rawTypes = options.componentType.split("|").map((t) => t.trim()).filter(Boolean);
|
|
5081
|
+
const componentTypes = rawTypes.includes("*") ? ["*"] : rawTypes;
|
|
5082
|
+
const aggregate = {
|
|
5083
|
+
compositionsModified: 0,
|
|
5084
|
+
compositionPatternsModified: 0,
|
|
5085
|
+
componentPatternsModified: 0
|
|
5086
|
+
};
|
|
5039
5087
|
try {
|
|
5040
|
-
const
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5088
|
+
for (const componentType of componentTypes) {
|
|
5089
|
+
const result = await remover.remove({
|
|
5090
|
+
rootDir: options.rootDir,
|
|
5091
|
+
componentsDir: options.componentsDir,
|
|
5092
|
+
compositionsDir: options.compositionsDir,
|
|
5093
|
+
compositionPatternsDir: options.compositionPatternsDir,
|
|
5094
|
+
componentPatternsDir: options.componentPatternsDir,
|
|
5095
|
+
componentType,
|
|
5096
|
+
parameterId: options.parameterId,
|
|
5097
|
+
whatIf: options.whatIf ?? false,
|
|
5098
|
+
strict: options.strict ?? false
|
|
5099
|
+
});
|
|
5100
|
+
aggregate.compositionsModified += result.compositionsModified;
|
|
5101
|
+
aggregate.compositionPatternsModified += result.compositionPatternsModified;
|
|
5102
|
+
aggregate.componentPatternsModified += result.componentPatternsModified;
|
|
5103
|
+
}
|
|
5051
5104
|
logger.success(
|
|
5052
|
-
`Removed field: ${
|
|
5105
|
+
`Removed field: ${aggregate.compositionsModified} composition(s), ${aggregate.compositionPatternsModified} composition pattern(s), ${aggregate.componentPatternsModified} component pattern(s) updated`
|
|
5053
5106
|
);
|
|
5054
5107
|
} catch (error) {
|
|
5055
5108
|
if (error instanceof TransformError) {
|
|
@@ -5792,7 +5845,7 @@ function createFlattenBlockFieldCommand() {
|
|
|
5792
5845
|
// package.json
|
|
5793
5846
|
var package_default = {
|
|
5794
5847
|
name: "@uniformdev/transformer",
|
|
5795
|
-
version: "1.1.
|
|
5848
|
+
version: "1.1.34",
|
|
5796
5849
|
description: "CLI tool for transforming Uniform.dev serialization files offline",
|
|
5797
5850
|
type: "module",
|
|
5798
5851
|
bin: {
|