@tanstack/cli 0.59.0 → 0.59.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/CHANGELOG.md +18 -0
- package/dist/cli.js +1 -1
- package/dist/command-line.js +3 -0
- package/dist/options.js +3 -0
- package/dist/ui-prompts.js +6 -3
- package/package.json +3 -3
- package/src/cli.ts +1 -1
- package/src/command-line.ts +3 -0
- package/src/options.ts +3 -0
- package/src/ui-prompts.ts +10 -3
- package/tests/command-line.test.ts +29 -0
- package/tests/ui-prompts.test.ts +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @tanstack/cli
|
|
2
2
|
|
|
3
|
+
## 0.59.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`76a3782`](https://github.com/TanStack/cli/commit/76a3782027c7b89b188b217baa9eaf60f5562090)]:
|
|
8
|
+
- @tanstack/create@0.61.0
|
|
9
|
+
- @tanstack/create-ui@0.59.2
|
|
10
|
+
|
|
11
|
+
## 0.59.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Prevent add-on multiselect options from rendering with pagination markers by showing the full list, which avoids a Clack navigation glitch that could duplicate the second-to-last entry while moving between the bottom options. ([`e384620`](https://github.com/TanStack/cli/commit/e384620ff642be8d4fe78726f0cbe087b9b10556))
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`ab740ed`](https://github.com/TanStack/cli/commit/ab740ed2c5510a3266065aa98c8afe3093ea0034)]:
|
|
18
|
+
- @tanstack/create@0.60.1
|
|
19
|
+
- @tanstack/create-ui@0.59.1
|
|
20
|
+
|
|
3
21
|
## 0.59.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/dist/cli.js
CHANGED
|
@@ -180,7 +180,7 @@ export function cli({ name, appName, forcedAddOns = [], forcedDeployment, defaul
|
|
|
180
180
|
};
|
|
181
181
|
cliOptions.framework = getFrameworkByName(options.framework || defaultFramework || 'React').id;
|
|
182
182
|
let finalOptions;
|
|
183
|
-
if (cliOptions.interactive) {
|
|
183
|
+
if (cliOptions.interactive || cliOptions.addOns === true) {
|
|
184
184
|
cliOptions.addOns = true;
|
|
185
185
|
}
|
|
186
186
|
else {
|
package/dist/command-line.js
CHANGED
|
@@ -84,6 +84,9 @@ export async function normalizeOptions(cliOptions, forcedAddOns, opts) {
|
|
|
84
84
|
]);
|
|
85
85
|
if (cliOptions.addOns && Array.isArray(cliOptions.addOns)) {
|
|
86
86
|
for (const a of cliOptions.addOns) {
|
|
87
|
+
if (a.toLowerCase() === 'start') {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
87
90
|
selectedAddOns.add(a);
|
|
88
91
|
}
|
|
89
92
|
}
|
package/dist/options.js
CHANGED
|
@@ -69,6 +69,9 @@ export async function promptForCreateOptions(cliOptions, { forcedAddOns = [], sh
|
|
|
69
69
|
}
|
|
70
70
|
if (Array.isArray(cliOptions.addOns)) {
|
|
71
71
|
for (const addOn of cliOptions.addOns) {
|
|
72
|
+
if (addOn.toLowerCase() === 'start') {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
72
75
|
addOns.add(addOn);
|
|
73
76
|
}
|
|
74
77
|
}
|
package/dist/ui-prompts.js
CHANGED
|
@@ -50,15 +50,18 @@ export async function selectAddOns(framework, mode, type, message, forcedAddOns
|
|
|
50
50
|
hasShownMultiselectHelp = true;
|
|
51
51
|
}
|
|
52
52
|
if (allowMultiple) {
|
|
53
|
+
const selectableAddOns = addOns.filter((addOn) => !forcedAddOns.includes(addOn.id));
|
|
54
|
+
if (selectableAddOns.length === 0) {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
53
57
|
const value = await multiselect({
|
|
54
58
|
message,
|
|
55
|
-
options:
|
|
56
|
-
.filter((addOn) => !forcedAddOns.includes(addOn.id))
|
|
57
|
-
.map((addOn) => ({
|
|
59
|
+
options: selectableAddOns.map((addOn) => ({
|
|
58
60
|
value: addOn.id,
|
|
59
61
|
label: addOn.name,
|
|
60
62
|
hint: addOn.description,
|
|
61
63
|
})),
|
|
64
|
+
maxItems: selectableAddOns.length,
|
|
62
65
|
required: false,
|
|
63
66
|
});
|
|
64
67
|
if (isCancel(value)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/cli",
|
|
3
|
-
"version": "0.59.
|
|
3
|
+
"version": "0.59.2",
|
|
4
4
|
"description": "TanStack CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"tempy": "^3.1.0",
|
|
39
39
|
"validate-npm-package-name": "^7.0.0",
|
|
40
40
|
"zod": "^3.24.2",
|
|
41
|
-
"@tanstack/create": "0.
|
|
42
|
-
"@tanstack/create-ui": "0.59.
|
|
41
|
+
"@tanstack/create": "0.61.0",
|
|
42
|
+
"@tanstack/create-ui": "0.59.2"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@tanstack/config": "^0.16.2",
|
package/src/cli.ts
CHANGED
|
@@ -280,7 +280,7 @@ export function cli({
|
|
|
280
280
|
)!.id
|
|
281
281
|
|
|
282
282
|
let finalOptions: Options | undefined
|
|
283
|
-
if (cliOptions.interactive) {
|
|
283
|
+
if (cliOptions.interactive || cliOptions.addOns === true) {
|
|
284
284
|
cliOptions.addOns = true
|
|
285
285
|
} else {
|
|
286
286
|
finalOptions = await normalizeOptions(
|
package/src/command-line.ts
CHANGED
package/src/options.ts
CHANGED
package/src/ui-prompts.ts
CHANGED
|
@@ -86,15 +86,22 @@ export async function selectAddOns(
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
if (allowMultiple) {
|
|
89
|
+
const selectableAddOns = addOns.filter(
|
|
90
|
+
(addOn) => !forcedAddOns.includes(addOn.id),
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
if (selectableAddOns.length === 0) {
|
|
94
|
+
return []
|
|
95
|
+
}
|
|
96
|
+
|
|
89
97
|
const value = await multiselect({
|
|
90
98
|
message,
|
|
91
|
-
options:
|
|
92
|
-
.filter((addOn) => !forcedAddOns.includes(addOn.id))
|
|
93
|
-
.map((addOn) => ({
|
|
99
|
+
options: selectableAddOns.map((addOn) => ({
|
|
94
100
|
value: addOn.id,
|
|
95
101
|
label: addOn.name,
|
|
96
102
|
hint: addOn.description,
|
|
97
103
|
})),
|
|
104
|
+
maxItems: selectableAddOns.length,
|
|
98
105
|
required: false,
|
|
99
106
|
})
|
|
100
107
|
|
|
@@ -218,6 +218,35 @@ describe('normalizeOptions', () => {
|
|
|
218
218
|
expect(options?.typescript).toBe(true)
|
|
219
219
|
})
|
|
220
220
|
|
|
221
|
+
it('should ignore legacy start add-on id from exported commands', async () => {
|
|
222
|
+
__testRegisterFramework({
|
|
223
|
+
id: 'react-cra',
|
|
224
|
+
name: 'react',
|
|
225
|
+
getAddOns: () => [
|
|
226
|
+
{
|
|
227
|
+
id: 'tanstack-query',
|
|
228
|
+
name: 'TanStack Query',
|
|
229
|
+
modes: ['file-router'],
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
id: 'nitro',
|
|
233
|
+
name: 'nitro',
|
|
234
|
+
modes: ['file-router'],
|
|
235
|
+
default: true,
|
|
236
|
+
},
|
|
237
|
+
],
|
|
238
|
+
})
|
|
239
|
+
|
|
240
|
+
const options = await normalizeOptions({
|
|
241
|
+
projectName: 'test',
|
|
242
|
+
addOns: ['start', 'tanstack-query'],
|
|
243
|
+
framework: 'react-cra',
|
|
244
|
+
})
|
|
245
|
+
|
|
246
|
+
expect(options?.chosenAddOns.map((a) => a.id)).toContain('tanstack-query')
|
|
247
|
+
expect(options?.chosenAddOns.map((a) => a.id)).not.toContain('start')
|
|
248
|
+
})
|
|
249
|
+
|
|
221
250
|
it('should handle toolchain as an addon', async () => {
|
|
222
251
|
__testRegisterFramework({
|
|
223
252
|
id: 'react-cra',
|
package/tests/ui-prompts.test.ts
CHANGED
|
@@ -57,7 +57,9 @@ describe('selectPackageManager', () => {
|
|
|
57
57
|
describe('selectAddOns', () => {
|
|
58
58
|
it('should show keyboard shortcuts help and select add-ons', async () => {
|
|
59
59
|
const noteSpy = vi.spyOn(clack, 'note').mockImplementation(() => {})
|
|
60
|
-
|
|
60
|
+
const multiselectSpy = vi
|
|
61
|
+
.spyOn(clack, 'multiselect')
|
|
62
|
+
.mockImplementation(async () => ['add-on-1'])
|
|
61
63
|
vi.spyOn(clack, 'isCancel').mockImplementation(() => false)
|
|
62
64
|
|
|
63
65
|
const packageManager = await selectAddOns(
|
|
@@ -83,6 +85,9 @@ describe('selectAddOns', () => {
|
|
|
83
85
|
'Use ↑/↓ to navigate • Space to select/deselect • Enter to confirm',
|
|
84
86
|
'Keyboard Shortcuts',
|
|
85
87
|
)
|
|
88
|
+
expect(multiselectSpy).toHaveBeenCalledWith(
|
|
89
|
+
expect.objectContaining({ maxItems: 1 }),
|
|
90
|
+
)
|
|
86
91
|
})
|
|
87
92
|
|
|
88
93
|
it('should exit on cancel', async () => {
|