termi-kids 0.2.1 → 0.2.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/dist/surfaces/buildGame.js +13 -5
- package/package.json +1 -1
|
@@ -54,7 +54,7 @@ async function pickProjectName(idea) {
|
|
|
54
54
|
const suggested = defaultNameForIdea(idea);
|
|
55
55
|
const typed = await p.text({
|
|
56
56
|
message: 'Name your game.',
|
|
57
|
-
|
|
57
|
+
initialValue: suggested,
|
|
58
58
|
defaultValue: suggested,
|
|
59
59
|
validate: (value) => {
|
|
60
60
|
const trimmed = (value ?? '').trim() || suggested;
|
|
@@ -112,16 +112,24 @@ async function obtainPrompt(idea) {
|
|
|
112
112
|
draft = suggestPromptFromAnswers(idea, answers);
|
|
113
113
|
p.note(draft, 'Suggested prompt');
|
|
114
114
|
}
|
|
115
|
+
// clack: initialValue pre-fills the field; defaultValue is only applied
|
|
116
|
+
// AFTER validate. Empty Enter with only defaultValue fails validate, so
|
|
117
|
+
// we pre-fill and also accept empty when a draft already exists.
|
|
115
118
|
const text = await p.text({
|
|
116
119
|
message: path === 'write' ? 'Type your prompt.' : 'Edit the prompt, or press Enter to run it.',
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
initialValue: draft.length > 0 ? draft : undefined,
|
|
121
|
+
defaultValue: draft.length > 0 ? draft : undefined,
|
|
122
|
+
placeholder: draft.length > 0 ? undefined : 'Make a fun browser game where...',
|
|
123
|
+
validate: (value) => {
|
|
124
|
+
const resolved = (value ?? '').trim() || draft.trim();
|
|
125
|
+
return resolved.length > 0 ? undefined : 'Need a prompt to build.';
|
|
126
|
+
},
|
|
120
127
|
});
|
|
121
128
|
if (p.isCancel(text)) {
|
|
122
129
|
return null;
|
|
123
130
|
}
|
|
124
|
-
|
|
131
|
+
const resolved = text.trim() || draft.trim();
|
|
132
|
+
return resolved.length > 0 ? resolved : null;
|
|
125
133
|
}
|
|
126
134
|
function listKidFileSummaries(project) {
|
|
127
135
|
const out = [];
|
package/package.json
CHANGED