@tanstack/cta-cli 0.16.1 → 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 -6
- package/package.json +1 -1
- package/src/cli.ts +9 -6
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,8 +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
|
-
|
|
221
|
-
const addOns = await getAllAddOns(getFrameworkById(options.framework || defaultFramework || 'react-cra'), defaultMode ||
|
|
220
|
+
const addOns = await getAllAddOns(getFrameworkByName(options.framework || defaultFramework || 'React'), defaultMode ||
|
|
222
221
|
convertTemplateToMode(options.template || defaultTemplate));
|
|
223
222
|
for (const addOn of addOns.filter((a) => !forcedAddOns.includes(a.id))) {
|
|
224
223
|
console.log(`${chalk.bold(addOn.id)}: ${addOn.description}`);
|
|
@@ -237,7 +236,7 @@ Remove your node_modules directory and package lock file and re-install.`);
|
|
|
237
236
|
projectName,
|
|
238
237
|
...options,
|
|
239
238
|
};
|
|
240
|
-
cliOptions.framework =
|
|
239
|
+
cliOptions.framework = getFrameworkByName(options.framework || defaultFramework || 'React').id;
|
|
241
240
|
if (defaultMode) {
|
|
242
241
|
cliOptions.template = defaultMode;
|
|
243
242
|
}
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -259,14 +259,18 @@ Remove your node_modules directory and package lock file and re-install.`,
|
|
|
259
259
|
'--framework <type>',
|
|
260
260
|
`project framework (${availableFrameworks.join(', ')})`,
|
|
261
261
|
(value) => {
|
|
262
|
-
if (
|
|
262
|
+
if (
|
|
263
|
+
!availableFrameworks.some(
|
|
264
|
+
(f) => f.toLowerCase() === value.toLowerCase(),
|
|
265
|
+
)
|
|
266
|
+
) {
|
|
263
267
|
throw new InvalidArgumentError(
|
|
264
268
|
`Invalid framework: ${value}. Only the following are allowed: ${availableFrameworks.join(', ')}`,
|
|
265
269
|
)
|
|
266
270
|
}
|
|
267
271
|
return value
|
|
268
272
|
},
|
|
269
|
-
defaultFramework || '
|
|
273
|
+
defaultFramework || 'React',
|
|
270
274
|
)
|
|
271
275
|
}
|
|
272
276
|
|
|
@@ -334,9 +338,8 @@ Remove your node_modules directory and package lock file and re-install.`,
|
|
|
334
338
|
|
|
335
339
|
program.action(async (projectName: string, options: CliOptions) => {
|
|
336
340
|
if (options.listAddOns) {
|
|
337
|
-
console.log(options.framework || defaultFramework || 'react-cra')
|
|
338
341
|
const addOns = await getAllAddOns(
|
|
339
|
-
|
|
342
|
+
getFrameworkByName(options.framework || defaultFramework || 'React')!,
|
|
340
343
|
defaultMode ||
|
|
341
344
|
convertTemplateToMode(options.template || defaultTemplate),
|
|
342
345
|
)
|
|
@@ -356,8 +359,8 @@ Remove your node_modules directory and package lock file and re-install.`,
|
|
|
356
359
|
...options,
|
|
357
360
|
} as CliOptions
|
|
358
361
|
|
|
359
|
-
cliOptions.framework =
|
|
360
|
-
options.framework || defaultFramework || '
|
|
362
|
+
cliOptions.framework = getFrameworkByName(
|
|
363
|
+
options.framework || defaultFramework || 'React',
|
|
361
364
|
)!.id
|
|
362
365
|
|
|
363
366
|
if (defaultMode) {
|