create-gen-app 0.1.5 → 0.1.7

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/esm/extract.js CHANGED
@@ -120,7 +120,7 @@ async function loadProjectQuestions(templateDir) {
120
120
  try {
121
121
  const content = fs.readFileSync(jsonPath, "utf8");
122
122
  const questions = JSON.parse(content);
123
- return validateQuestions(questions) ? questions : null;
123
+ return validateQuestions(questions) ? normalizeQuestions(questions) : null;
124
124
  }
125
125
  catch (error) {
126
126
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -132,7 +132,7 @@ async function loadProjectQuestions(templateDir) {
132
132
  try {
133
133
  const module = require(jsPath);
134
134
  const questions = module.default || module;
135
- return validateQuestions(questions) ? questions : null;
135
+ return validateQuestions(questions) ? normalizeQuestions(questions) : null;
136
136
  }
137
137
  catch (error) {
138
138
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -208,6 +208,20 @@ function normalizePlaceholder(entry) {
208
208
  }
209
209
  return entry || null;
210
210
  }
211
+ /**
212
+ * Normalize questions by ensuring all required fields have default values
213
+ * @param questions - Questions object to normalize
214
+ * @returns Normalized questions object
215
+ */
216
+ function normalizeQuestions(questions) {
217
+ return {
218
+ ...questions,
219
+ questions: questions.questions.map((q) => ({
220
+ ...q,
221
+ type: q.type || 'text'
222
+ }))
223
+ };
224
+ }
211
225
  /**
212
226
  * Validate that the questions object has the correct structure
213
227
  * @param obj - Object to validate
package/extract.js CHANGED
@@ -156,7 +156,7 @@ async function loadProjectQuestions(templateDir) {
156
156
  try {
157
157
  const content = fs.readFileSync(jsonPath, "utf8");
158
158
  const questions = JSON.parse(content);
159
- return validateQuestions(questions) ? questions : null;
159
+ return validateQuestions(questions) ? normalizeQuestions(questions) : null;
160
160
  }
161
161
  catch (error) {
162
162
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -168,7 +168,7 @@ async function loadProjectQuestions(templateDir) {
168
168
  try {
169
169
  const module = require(jsPath);
170
170
  const questions = module.default || module;
171
- return validateQuestions(questions) ? questions : null;
171
+ return validateQuestions(questions) ? normalizeQuestions(questions) : null;
172
172
  }
173
173
  catch (error) {
174
174
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -244,6 +244,20 @@ function normalizePlaceholder(entry) {
244
244
  }
245
245
  return entry || null;
246
246
  }
247
+ /**
248
+ * Normalize questions by ensuring all required fields have default values
249
+ * @param questions - Questions object to normalize
250
+ * @returns Normalized questions object
251
+ */
252
+ function normalizeQuestions(questions) {
253
+ return {
254
+ ...questions,
255
+ questions: questions.questions.map((q) => ({
256
+ ...q,
257
+ type: q.type || 'text'
258
+ }))
259
+ };
260
+ }
247
261
  /**
248
262
  * Validate that the questions object has the correct structure
249
263
  * @param obj - Object to validate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-gen-app",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "author": "Dan Lynch <pyramation@gmail.com>",
5
5
  "description": "Clone and customize template repositories with variable replacement",
6
6
  "bin": {
@@ -33,7 +33,7 @@
33
33
  "test:watch": "jest --watch"
34
34
  },
35
35
  "dependencies": {
36
- "inquirerer": "2.1.5",
36
+ "inquirerer": "2.1.7",
37
37
  "minimist": "^1.2.8"
38
38
  },
39
39
  "devDependencies": {
@@ -42,5 +42,5 @@
42
42
  "makage": "0.1.5"
43
43
  },
44
44
  "keywords": [],
45
- "gitHead": "00b9ec9aa30a6cdd61bfc4314974b8f2562ad791"
45
+ "gitHead": "fe43943672d75bc87cda91bea887c999eff46246"
46
46
  }