@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axeth/create-cli",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "bin": {
@@ -52,7 +52,7 @@ class AxethCLI {
52
52
  initialValue: false
53
53
  });
54
54
 
55
- if (openVSCode) {
55
+ if (openVSCode === true) {
56
56
  spinner.start("Opening VSCode...");
57
57
  await this.runCommand(`code "${projectDir}"`);
58
58
  spinner.stop("VSCode opened.");
@@ -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
- populatedContent = populatedContent.split(placeholder).join(replacementValue);
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);