@uniformdev/transformer 1.1.33 → 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 +48 -17
- 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,7 +4766,28 @@ 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
|
|
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
|
+
}
|
|
4770
4791
|
const aggregate = {
|
|
4771
4792
|
compositionsModified: 0,
|
|
4772
4793
|
compositionPatternsModified: 0,
|
|
@@ -4774,20 +4795,28 @@ function createRemoveParameterCommand() {
|
|
|
4774
4795
|
};
|
|
4775
4796
|
try {
|
|
4776
4797
|
for (const componentType of componentTypes) {
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
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
|
+
}
|
|
4791
4820
|
}
|
|
4792
4821
|
logger.success(
|
|
4793
4822
|
`Removed parameter: ${aggregate.compositionsModified} composition(s), ${aggregate.compositionPatternsModified} composition pattern(s), ${aggregate.componentPatternsModified} component pattern(s) updated`
|
|
@@ -4814,6 +4843,7 @@ var FieldRemoverService = class {
|
|
|
4814
4843
|
this.logger = logger;
|
|
4815
4844
|
}
|
|
4816
4845
|
compareIds(id1, id2, strict) {
|
|
4846
|
+
if (id2 === "*") return true;
|
|
4817
4847
|
if (strict) {
|
|
4818
4848
|
return id1 === id2;
|
|
4819
4849
|
}
|
|
@@ -5047,7 +5077,8 @@ function createRemoveFieldCommand() {
|
|
|
5047
5077
|
const fileSystem = new FileSystemService();
|
|
5048
5078
|
const componentService = new ComponentService(fileSystem);
|
|
5049
5079
|
const remover = new FieldRemoverService(fileSystem, componentService, logger);
|
|
5050
|
-
const
|
|
5080
|
+
const rawTypes = options.componentType.split("|").map((t) => t.trim()).filter(Boolean);
|
|
5081
|
+
const componentTypes = rawTypes.includes("*") ? ["*"] : rawTypes;
|
|
5051
5082
|
const aggregate = {
|
|
5052
5083
|
compositionsModified: 0,
|
|
5053
5084
|
compositionPatternsModified: 0,
|
|
@@ -5814,7 +5845,7 @@ function createFlattenBlockFieldCommand() {
|
|
|
5814
5845
|
// package.json
|
|
5815
5846
|
var package_default = {
|
|
5816
5847
|
name: "@uniformdev/transformer",
|
|
5817
|
-
version: "1.1.
|
|
5848
|
+
version: "1.1.34",
|
|
5818
5849
|
description: "CLI tool for transforming Uniform.dev serialization files offline",
|
|
5819
5850
|
type: "module",
|
|
5820
5851
|
bin: {
|