@axeth/create-cli 2.1.1 → 2.1.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/package.json
CHANGED
package/src/class/AxethCLI.ts
CHANGED
|
@@ -30,17 +30,29 @@ class TemplateGenerators {
|
|
|
30
30
|
for (const [key, value] of Object.entries(config)) {
|
|
31
31
|
const placeholder = `{{${key}}}`;
|
|
32
32
|
let replacementValue: string;
|
|
33
|
+
let isNonStringValue = false;
|
|
33
34
|
|
|
34
35
|
// Determine the proper string representation based on type
|
|
35
36
|
if (Array.isArray(value)) {
|
|
36
37
|
replacementValue = JSON.stringify(value);
|
|
38
|
+
isNonStringValue = true;
|
|
39
|
+
} else if (typeof value === "object" && value !== null) {
|
|
40
|
+
replacementValue = JSON.stringify(value);
|
|
41
|
+
isNonStringValue = true;
|
|
37
42
|
} else if (typeof value === "number") {
|
|
38
43
|
replacementValue = value.toString();
|
|
44
|
+
isNonStringValue = true;
|
|
39
45
|
} else {
|
|
40
46
|
replacementValue = String(value);
|
|
41
47
|
}
|
|
42
48
|
|
|
43
|
-
|
|
49
|
+
// Remove quotes around non-string values: "{{key}}" -> {{key}}
|
|
50
|
+
if (isNonStringValue) {
|
|
51
|
+
populatedContent = populatedContent.split(`"${placeholder}"`).join(replacementValue);
|
|
52
|
+
} else {
|
|
53
|
+
populatedContent = populatedContent.split(placeholder).join(replacementValue);
|
|
54
|
+
}
|
|
55
|
+
|
|
44
56
|
await new Promise((resolve) => setTimeout(resolve, 10)); // Slight delay to ensure responsiveness
|
|
45
57
|
}
|
|
46
58
|
this.registerFile(filePath, populatedContent);
|