@tanstack/cta-cli 0.16.2 → 0.16.3
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/cli.js +5 -5
- package/package.json +1 -1
- package/src/cli.ts +10 -5
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Command, InvalidArgumentError } from 'commander';
|
|
|
4
4
|
import { intro, log } from '@clack/prompts';
|
|
5
5
|
import chalk from 'chalk';
|
|
6
6
|
import semver from 'semver';
|
|
7
|
-
import { SUPPORTED_PACKAGE_MANAGERS, addToApp, compileAddOn, compileStarter, createApp, createSerializedOptions, getAllAddOns,
|
|
7
|
+
import { SUPPORTED_PACKAGE_MANAGERS, addToApp, compileAddOn, compileStarter, createApp, createSerializedOptions, getAllAddOns, getFrameworkByName, getFrameworks, initAddOn, initStarter, } from '@tanstack/cta-engine';
|
|
8
8
|
import { launchUI } from '@tanstack/cta-ui';
|
|
9
9
|
import { runMCPServer } from './mcp.js';
|
|
10
10
|
import { promptForAddOns, promptForCreateOptions } from './options.js';
|
|
@@ -177,11 +177,11 @@ Remove your node_modules directory and package lock file and re-install.`);
|
|
|
177
177
|
}
|
|
178
178
|
if (!defaultFramework) {
|
|
179
179
|
program.option('--framework <type>', `project framework (${availableFrameworks.join(', ')})`, (value) => {
|
|
180
|
-
if (!availableFrameworks.
|
|
180
|
+
if (!availableFrameworks.some((f) => f.toLowerCase() === value.toLowerCase())) {
|
|
181
181
|
throw new InvalidArgumentError(`Invalid framework: ${value}. Only the following are allowed: ${availableFrameworks.join(', ')}`);
|
|
182
182
|
}
|
|
183
183
|
return value;
|
|
184
|
-
}, defaultFramework || '
|
|
184
|
+
}, defaultFramework || 'React');
|
|
185
185
|
}
|
|
186
186
|
program
|
|
187
187
|
.option('--starter [url]', 'initialize this project from a starter URL', false)
|
|
@@ -217,7 +217,7 @@ Remove your node_modules directory and package lock file and re-install.`);
|
|
|
217
217
|
.option('--ui', 'Add with the UI');
|
|
218
218
|
program.action(async (projectName, options) => {
|
|
219
219
|
if (options.listAddOns) {
|
|
220
|
-
const addOns = await getAllAddOns(
|
|
220
|
+
const addOns = await getAllAddOns(getFrameworkByName(options.framework || defaultFramework || 'React'), defaultMode ||
|
|
221
221
|
convertTemplateToMode(options.template || defaultTemplate));
|
|
222
222
|
for (const addOn of addOns.filter((a) => !forcedAddOns.includes(a.id))) {
|
|
223
223
|
console.log(`${chalk.bold(addOn.id)}: ${addOn.description}`);
|
|
@@ -236,7 +236,7 @@ Remove your node_modules directory and package lock file and re-install.`);
|
|
|
236
236
|
projectName,
|
|
237
237
|
...options,
|
|
238
238
|
};
|
|
239
|
-
cliOptions.framework =
|
|
239
|
+
cliOptions.framework = getFrameworkByName(options.framework || defaultFramework || 'React').id;
|
|
240
240
|
if (defaultMode) {
|
|
241
241
|
cliOptions.template = defaultMode;
|
|
242
242
|
}
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
createSerializedOptions,
|
|
15
15
|
getAllAddOns,
|
|
16
16
|
getFrameworkById,
|
|
17
|
+
getFrameworkByName,
|
|
17
18
|
getFrameworks,
|
|
18
19
|
initAddOn,
|
|
19
20
|
initStarter,
|
|
@@ -258,14 +259,18 @@ Remove your node_modules directory and package lock file and re-install.`,
|
|
|
258
259
|
'--framework <type>',
|
|
259
260
|
`project framework (${availableFrameworks.join(', ')})`,
|
|
260
261
|
(value) => {
|
|
261
|
-
if (
|
|
262
|
+
if (
|
|
263
|
+
!availableFrameworks.some(
|
|
264
|
+
(f) => f.toLowerCase() === value.toLowerCase(),
|
|
265
|
+
)
|
|
266
|
+
) {
|
|
262
267
|
throw new InvalidArgumentError(
|
|
263
268
|
`Invalid framework: ${value}. Only the following are allowed: ${availableFrameworks.join(', ')}`,
|
|
264
269
|
)
|
|
265
270
|
}
|
|
266
271
|
return value
|
|
267
272
|
},
|
|
268
|
-
defaultFramework || '
|
|
273
|
+
defaultFramework || 'React',
|
|
269
274
|
)
|
|
270
275
|
}
|
|
271
276
|
|
|
@@ -334,7 +339,7 @@ Remove your node_modules directory and package lock file and re-install.`,
|
|
|
334
339
|
program.action(async (projectName: string, options: CliOptions) => {
|
|
335
340
|
if (options.listAddOns) {
|
|
336
341
|
const addOns = await getAllAddOns(
|
|
337
|
-
|
|
342
|
+
getFrameworkByName(options.framework || defaultFramework || 'React')!,
|
|
338
343
|
defaultMode ||
|
|
339
344
|
convertTemplateToMode(options.template || defaultTemplate),
|
|
340
345
|
)
|
|
@@ -354,8 +359,8 @@ Remove your node_modules directory and package lock file and re-install.`,
|
|
|
354
359
|
...options,
|
|
355
360
|
} as CliOptions
|
|
356
361
|
|
|
357
|
-
cliOptions.framework =
|
|
358
|
-
options.framework || defaultFramework || '
|
|
362
|
+
cliOptions.framework = getFrameworkByName(
|
|
363
|
+
options.framework || defaultFramework || 'React',
|
|
359
364
|
)!.id
|
|
360
365
|
|
|
361
366
|
if (defaultMode) {
|