@tanstack/cta-cli 0.44.3 → 0.46.0
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/options.js +1 -1
- package/dist/types/ui-prompts.d.ts +1 -1
- package/dist/ui-prompts.js +42 -16
- package/package.json +3 -3
- package/src/options.ts +2 -1
- package/src/ui-prompts.ts +48 -17
package/dist/options.js
CHANGED
|
@@ -86,7 +86,7 @@ export async function promptForCreateOptions(cliOptions, { forcedAddOns = [], fo
|
|
|
86
86
|
for (const addOn of await selectAddOns(options.framework, options.mode, 'add-on', 'What add-ons would you like for your project?', forcedAddOns)) {
|
|
87
87
|
addOns.add(addOn);
|
|
88
88
|
}
|
|
89
|
-
for (const addOn of await selectAddOns(options.framework, options.mode, 'example', 'Would you like
|
|
89
|
+
for (const addOn of await selectAddOns(options.framework, options.mode, 'example', 'Would you like an example?', forcedAddOns, false)) {
|
|
90
90
|
addOns.add(addOn);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -5,7 +5,7 @@ export declare function selectRouterType(): Promise<string>;
|
|
|
5
5
|
export declare function selectTypescript(): Promise<boolean>;
|
|
6
6
|
export declare function selectTailwind(): Promise<boolean>;
|
|
7
7
|
export declare function selectPackageManager(): Promise<PackageManager>;
|
|
8
|
-
export declare function selectAddOns(framework: Framework, mode: string, type: string, message: string, forcedAddOns?: Array<string
|
|
8
|
+
export declare function selectAddOns(framework: Framework, mode: string, type: string, message: string, forcedAddOns?: Array<string>, allowMultiple?: boolean): Promise<Array<string>>;
|
|
9
9
|
export declare function selectGit(): Promise<boolean>;
|
|
10
10
|
export declare function selectToolchain(framework: Framework, toolchain?: string): Promise<string | undefined>;
|
|
11
11
|
export declare function promptForAddOnOptions(addOnIds: Array<string>, framework: Framework): Promise<Record<string, Record<string, any>>>;
|
package/dist/ui-prompts.js
CHANGED
|
@@ -81,7 +81,7 @@ export async function selectPackageManager() {
|
|
|
81
81
|
}
|
|
82
82
|
// Track if we've shown the multiselect help text
|
|
83
83
|
let hasShownMultiselectHelp = false;
|
|
84
|
-
export async function selectAddOns(framework, mode, type, message, forcedAddOns = []) {
|
|
84
|
+
export async function selectAddOns(framework, mode, type, message, forcedAddOns = [], allowMultiple = true) {
|
|
85
85
|
const allAddOns = await getAllAddOns(framework, mode);
|
|
86
86
|
const addOns = allAddOns.filter((addOn) => addOn.type === type);
|
|
87
87
|
if (addOns.length === 0) {
|
|
@@ -92,22 +92,48 @@ export async function selectAddOns(framework, mode, type, message, forcedAddOns
|
|
|
92
92
|
note('Use ↑/↓ to navigate • Space to select/deselect • Enter to confirm', 'Keyboard Shortcuts');
|
|
93
93
|
hasShownMultiselectHelp = true;
|
|
94
94
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
95
|
+
if (allowMultiple) {
|
|
96
|
+
const value = await multiselect({
|
|
97
|
+
message,
|
|
98
|
+
options: addOns
|
|
99
|
+
.filter((addOn) => !forcedAddOns.includes(addOn.id))
|
|
100
|
+
.map((addOn) => ({
|
|
101
|
+
value: addOn.id,
|
|
102
|
+
label: addOn.name,
|
|
103
|
+
hint: addOn.description,
|
|
104
|
+
})),
|
|
105
|
+
required: false,
|
|
106
|
+
});
|
|
107
|
+
if (isCancel(value)) {
|
|
108
|
+
cancel('Operation cancelled.');
|
|
109
|
+
process.exit(0);
|
|
110
|
+
}
|
|
111
|
+
return value;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
const value = await select({
|
|
115
|
+
message,
|
|
116
|
+
options: [
|
|
117
|
+
{
|
|
118
|
+
value: 'none',
|
|
119
|
+
label: 'None',
|
|
120
|
+
},
|
|
121
|
+
...addOns
|
|
122
|
+
.filter((addOn) => !forcedAddOns.includes(addOn.id))
|
|
123
|
+
.map((addOn) => ({
|
|
124
|
+
value: addOn.id,
|
|
125
|
+
label: addOn.name,
|
|
126
|
+
hint: addOn.description,
|
|
127
|
+
})),
|
|
128
|
+
],
|
|
129
|
+
initialValue: 'none',
|
|
130
|
+
});
|
|
131
|
+
if (isCancel(value)) {
|
|
132
|
+
cancel('Operation cancelled.');
|
|
133
|
+
process.exit(0);
|
|
134
|
+
}
|
|
135
|
+
return value === 'none' ? [] : [value];
|
|
109
136
|
}
|
|
110
|
-
return value;
|
|
111
137
|
}
|
|
112
138
|
export async function selectGit() {
|
|
113
139
|
const git = await confirm({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/cta-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.0",
|
|
4
4
|
"description": "Tanstack Application Builder CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"semver": "^7.7.2",
|
|
33
33
|
"validate-npm-package-name": "^7.0.0",
|
|
34
34
|
"zod": "^3.24.2",
|
|
35
|
-
"@tanstack/cta-engine": "0.
|
|
36
|
-
"@tanstack/cta-ui": "0.
|
|
35
|
+
"@tanstack/cta-engine": "0.45.0",
|
|
36
|
+
"@tanstack/cta-ui": "0.45.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/express": "^5.0.1",
|
package/src/options.ts
CHANGED
package/src/ui-prompts.ts
CHANGED
|
@@ -119,6 +119,7 @@ export async function selectAddOns(
|
|
|
119
119
|
type: string,
|
|
120
120
|
message: string,
|
|
121
121
|
forcedAddOns: Array<string> = [],
|
|
122
|
+
allowMultiple: boolean = true,
|
|
122
123
|
): Promise<Array<string>> {
|
|
123
124
|
const allAddOns = await getAllAddOns(framework, mode)
|
|
124
125
|
const addOns = allAddOns.filter((addOn) => addOn.type === type)
|
|
@@ -128,28 +129,58 @@ export async function selectAddOns(
|
|
|
128
129
|
|
|
129
130
|
// Show help text only once
|
|
130
131
|
if (!hasShownMultiselectHelp) {
|
|
131
|
-
note(
|
|
132
|
+
note(
|
|
133
|
+
'Use ↑/↓ to navigate • Space to select/deselect • Enter to confirm',
|
|
134
|
+
'Keyboard Shortcuts',
|
|
135
|
+
)
|
|
132
136
|
hasShownMultiselectHelp = true
|
|
133
137
|
}
|
|
134
138
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
139
|
+
if (allowMultiple) {
|
|
140
|
+
const value = await multiselect({
|
|
141
|
+
message,
|
|
142
|
+
options: addOns
|
|
143
|
+
.filter((addOn) => !forcedAddOns.includes(addOn.id))
|
|
144
|
+
.map((addOn) => ({
|
|
145
|
+
value: addOn.id,
|
|
146
|
+
label: addOn.name,
|
|
147
|
+
hint: addOn.description,
|
|
148
|
+
})),
|
|
149
|
+
required: false,
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
if (isCancel(value)) {
|
|
153
|
+
cancel('Operation cancelled.')
|
|
154
|
+
process.exit(0)
|
|
155
|
+
}
|
|
146
156
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
157
|
+
return value
|
|
158
|
+
} else {
|
|
159
|
+
const value = await select({
|
|
160
|
+
message,
|
|
161
|
+
options: [
|
|
162
|
+
{
|
|
163
|
+
value: 'none',
|
|
164
|
+
label: 'None',
|
|
165
|
+
},
|
|
166
|
+
...addOns
|
|
167
|
+
.filter((addOn) => !forcedAddOns.includes(addOn.id))
|
|
168
|
+
.map((addOn) => ({
|
|
169
|
+
value: addOn.id,
|
|
170
|
+
label: addOn.name,
|
|
171
|
+
hint: addOn.description,
|
|
172
|
+
})),
|
|
173
|
+
],
|
|
174
|
+
initialValue: 'none',
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
if (isCancel(value)) {
|
|
178
|
+
cancel('Operation cancelled.')
|
|
179
|
+
process.exit(0)
|
|
180
|
+
}
|
|
151
181
|
|
|
152
|
-
|
|
182
|
+
return value === 'none' ? [] : [value]
|
|
183
|
+
}
|
|
153
184
|
}
|
|
154
185
|
|
|
155
186
|
export async function selectGit(): Promise<boolean> {
|