@tanstack/cta-cli 0.35.0 → 0.36.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/cli.js CHANGED
@@ -11,8 +11,8 @@ import { promptForAddOns, promptForCreateOptions } from './options.js';
11
11
  import { normalizeOptions } from './command-line.js';
12
12
  import { createUIEnvironment } from './ui-environment.js';
13
13
  import { convertTemplateToMode } from './utils.js';
14
- // This CLI assumes that all of the registered frameworks have the same set of toolchains, hosts, modes, etc.
15
- export function cli({ name, appName, forcedMode, forcedAddOns = [], defaultTemplate = 'javascript', forcedHost, defaultFramework, craCompatible = false, webBase, showHostingOptions = false, }) {
14
+ // This CLI assumes that all of the registered frameworks have the same set of toolchains, deployments, modes, etc.
15
+ export function cli({ name, appName, forcedMode, forcedAddOns = [], defaultTemplate = 'javascript', forcedDeployment, defaultFramework, craCompatible = false, webBase, showDeploymentOptions = false, }) {
16
16
  const environment = createUIEnvironment(appName, false);
17
17
  const program = new Command();
18
18
  const availableFrameworks = getFrameworks().map((f) => f.name);
@@ -24,11 +24,11 @@ export function cli({ name, appName, forcedMode, forcedAddOns = [], defaultTempl
24
24
  }
25
25
  }
26
26
  }
27
- const hosts = new Set();
27
+ const deployments = new Set();
28
28
  for (const framework of getFrameworks()) {
29
29
  for (const addOn of framework.getAddOns()) {
30
- if (addOn.type === 'host') {
31
- hosts.add(addOn.id);
30
+ if (addOn.type === 'deployment') {
31
+ deployments.add(addOn.id);
32
32
  }
33
33
  }
34
34
  }
@@ -130,7 +130,7 @@ Remove your node_modules directory and package lock file and re-install.`);
130
130
  forcedAddOns,
131
131
  environmentFactory: () => createUIEnvironment(appName, false),
132
132
  webBase,
133
- showHostingOptions,
133
+ showDeploymentOptions,
134
134
  });
135
135
  }
136
136
  else if (parsedAddOns.length < 1) {
@@ -200,10 +200,10 @@ Remove your node_modules directory and package lock file and re-install.`);
200
200
  }
201
201
  return value;
202
202
  });
203
- if (hosts.size > 0) {
204
- program.option(`--host <${Array.from(hosts).join('|')}>`, `Explicitly tell the CLI to use this hosting provider`, (value) => {
205
- if (!hosts.has(value)) {
206
- throw new InvalidArgumentError(`Invalid host: ${value}. The following are allowed: ${Array.from(hosts).join(', ')}`);
203
+ if (deployments.size > 0) {
204
+ program.option(`--deployment <${Array.from(deployments).join('|')}>`, `Explicitly tell the CLI to use this deployment adapter`, (value) => {
205
+ if (!deployments.has(value)) {
206
+ throw new InvalidArgumentError(`Invalid adapter: ${value}. The following are allowed: ${Array.from(deployments).join(', ')}`);
207
207
  }
208
208
  return value;
209
209
  });
@@ -324,10 +324,10 @@ Remove your node_modules directory and package lock file and re-install.`);
324
324
  cliOptions.addOns = true;
325
325
  }
326
326
  else {
327
- finalOptions = await normalizeOptions(cliOptions, defaultMode, forcedAddOns, { forcedHost });
327
+ finalOptions = await normalizeOptions(cliOptions, defaultMode, forcedAddOns, { forcedDeployment });
328
328
  }
329
329
  if (options.ui) {
330
- const optionsFromCLI = await normalizeOptions(cliOptions, defaultMode, forcedAddOns, { disableNameCheck: true, forcedHost });
330
+ const optionsFromCLI = await normalizeOptions(cliOptions, defaultMode, forcedAddOns, { disableNameCheck: true, forcedDeployment });
331
331
  const options = {
332
332
  ...createSerializedOptions(optionsFromCLI),
333
333
  projectName: 'my-app',
@@ -340,7 +340,7 @@ Remove your node_modules directory and package lock file and re-install.`);
340
340
  forcedAddOns,
341
341
  environmentFactory: () => createUIEnvironment(appName, false),
342
342
  webBase,
343
- showHostingOptions,
343
+ showDeploymentOptions,
344
344
  });
345
345
  return;
346
346
  }
@@ -352,7 +352,7 @@ Remove your node_modules directory and package lock file and re-install.`);
352
352
  finalOptions = await promptForCreateOptions(cliOptions, {
353
353
  forcedMode: defaultMode,
354
354
  forcedAddOns,
355
- showHostingOptions,
355
+ showDeploymentOptions,
356
356
  });
357
357
  }
358
358
  if (!finalOptions) {
@@ -41,7 +41,7 @@ export async function normalizeOptions(cliOptions, forcedMode, forcedAddOns, opt
41
41
  starter?.dependsOn ||
42
42
  forcedAddOns ||
43
43
  cliOptions.toolchain ||
44
- cliOptions.host) {
44
+ cliOptions.deployment) {
45
45
  const selectedAddOns = new Set([
46
46
  ...(starter?.dependsOn || []),
47
47
  ...(forcedAddOns || []),
@@ -54,11 +54,11 @@ export async function normalizeOptions(cliOptions, forcedMode, forcedAddOns, opt
54
54
  if (cliOptions.toolchain) {
55
55
  selectedAddOns.add(cliOptions.toolchain);
56
56
  }
57
- if (cliOptions.host) {
58
- selectedAddOns.add(cliOptions.host);
57
+ if (cliOptions.deployment) {
58
+ selectedAddOns.add(cliOptions.deployment);
59
59
  }
60
- if (!cliOptions.host && opts?.forcedHost) {
61
- selectedAddOns.add(opts.forcedHost);
60
+ if (!cliOptions.deployment && opts?.forcedDeployment) {
61
+ selectedAddOns.add(opts.forcedDeployment);
62
62
  }
63
63
  return await finalizeAddOns(framework, mode, Array.from(selectedAddOns));
64
64
  }
package/dist/options.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { intro } from '@clack/prompts';
2
2
  import { finalizeAddOns, getFrameworkById, getPackageManager, populateAddOnOptionsDefaults, readConfigFile, } from '@tanstack/cta-engine';
3
- import { getProjectName, promptForAddOnOptions, selectAddOns, selectGit, selectHost, selectPackageManager, selectRouterType, selectTailwind, selectToolchain, selectTypescript, } from './ui-prompts.js';
4
- export async function promptForCreateOptions(cliOptions, { forcedAddOns = [], forcedMode, showHostingOptions = false, }) {
3
+ import { getProjectName, promptForAddOnOptions, selectAddOns, selectGit, selectDeployment, selectPackageManager, selectRouterType, selectTailwind, selectToolchain, selectTypescript, } from './ui-prompts.js';
4
+ export async function promptForCreateOptions(cliOptions, { forcedAddOns = [], forcedMode, showDeploymentOptions = false, }) {
5
5
  const options = {};
6
6
  options.framework = getFrameworkById(cliOptions.framework || 'react-cra');
7
7
  options.projectName = cliOptions.projectName || (await getProjectName());
@@ -45,17 +45,17 @@ export async function promptForCreateOptions(cliOptions, { forcedAddOns = [], fo
45
45
  }
46
46
  // Toolchain selection
47
47
  const toolchain = await selectToolchain(options.framework, cliOptions.toolchain);
48
- // Host selection
49
- const host = showHostingOptions
50
- ? await selectHost(options.framework, cliOptions.host)
48
+ // Deployment selection
49
+ const deployment = showDeploymentOptions
50
+ ? await selectDeployment(options.framework, cliOptions.deployment)
51
51
  : undefined;
52
52
  // Add-ons selection
53
53
  const addOns = new Set();
54
54
  if (toolchain) {
55
55
  addOns.add(toolchain);
56
56
  }
57
- if (host) {
58
- addOns.add(host);
57
+ if (deployment) {
58
+ addOns.add(deployment);
59
59
  }
60
60
  for (const addOn of forcedAddOns) {
61
61
  addOns.add(addOn);
@@ -1,13 +1,13 @@
1
1
  import type { TemplateOptions } from './types.js';
2
- export declare function cli({ name, appName, forcedMode, forcedAddOns, defaultTemplate, forcedHost, defaultFramework, craCompatible, webBase, showHostingOptions, }: {
2
+ export declare function cli({ name, appName, forcedMode, forcedAddOns, defaultTemplate, forcedDeployment, defaultFramework, craCompatible, webBase, showDeploymentOptions, }: {
3
3
  name: string;
4
4
  appName: string;
5
5
  forcedMode?: string;
6
6
  forcedAddOns?: Array<string>;
7
- forcedHost?: string;
7
+ forcedDeployment?: string;
8
8
  defaultTemplate?: TemplateOptions;
9
9
  defaultFramework?: string;
10
10
  craCompatible?: boolean;
11
11
  webBase?: string;
12
- showHostingOptions?: boolean;
12
+ showDeploymentOptions?: boolean;
13
13
  }): void;
@@ -2,5 +2,5 @@ import type { Options } from '@tanstack/cta-engine';
2
2
  import type { CliOptions } from './types.js';
3
3
  export declare function normalizeOptions(cliOptions: CliOptions, forcedMode?: string, forcedAddOns?: Array<string>, opts?: {
4
4
  disableNameCheck?: boolean;
5
- forcedHost?: string;
5
+ forcedDeployment?: string;
6
6
  }): Promise<Options | undefined>;
@@ -1,8 +1,8 @@
1
1
  import type { Options } from '@tanstack/cta-engine';
2
2
  import type { CliOptions } from './types.js';
3
- export declare function promptForCreateOptions(cliOptions: CliOptions, { forcedAddOns, forcedMode, showHostingOptions, }: {
3
+ export declare function promptForCreateOptions(cliOptions: CliOptions, { forcedAddOns, forcedMode, showDeploymentOptions, }: {
4
4
  forcedAddOns?: Array<string>;
5
5
  forcedMode?: string;
6
- showHostingOptions?: boolean;
6
+ showDeploymentOptions?: boolean;
7
7
  }): Promise<Required<Options> | undefined>;
8
8
  export declare function promptForAddOns(): Promise<Array<string>>;
@@ -6,7 +6,7 @@ export interface CliOptions {
6
6
  tailwind?: boolean;
7
7
  packageManager?: PackageManager;
8
8
  toolchain?: string;
9
- host?: string;
9
+ deployment?: string;
10
10
  projectName?: string;
11
11
  git?: boolean;
12
12
  addOns?: Array<string> | boolean;
@@ -9,4 +9,4 @@ export declare function selectAddOns(framework: Framework, mode: string, type: s
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>>>;
12
- export declare function selectHost(framework: Framework, host?: string): Promise<string | undefined>;
12
+ export declare function selectDeployment(framework: Framework, deployment?: string): Promise<string | undefined>;
@@ -169,35 +169,35 @@ export async function promptForAddOnOptions(addOnIds, framework) {
169
169
  }
170
170
  return addOnOptions;
171
171
  }
172
- export async function selectHost(framework, host) {
173
- const hosts = new Set();
172
+ export async function selectDeployment(framework, deployment) {
173
+ const deployments = new Set();
174
174
  let initialValue = undefined;
175
175
  for (const addOn of framework
176
176
  .getAddOns()
177
177
  .sort((a, b) => a.name.localeCompare(b.name))) {
178
- if (addOn.type === 'host') {
179
- hosts.add(addOn);
180
- if (host && addOn.id === host) {
181
- return host;
178
+ if (addOn.type === 'deployment') {
179
+ deployments.add(addOn);
180
+ if (deployment && addOn.id === deployment) {
181
+ return deployment;
182
182
  }
183
183
  if (addOn.default) {
184
184
  initialValue = addOn.id;
185
185
  }
186
186
  }
187
187
  }
188
- const hp = await select({
189
- message: 'Select hosting provider',
188
+ const dp = await select({
189
+ message: 'Select deployment adapter',
190
190
  options: [
191
- ...Array.from(hosts).map((h) => ({
192
- value: h.id,
193
- label: h.name,
191
+ ...Array.from(deployments).map((d) => ({
192
+ value: d.id,
193
+ label: d.name,
194
194
  })),
195
195
  ],
196
196
  initialValue: initialValue,
197
197
  });
198
- if (isCancel(hp)) {
198
+ if (isCancel(dp)) {
199
199
  cancel('Operation cancelled.');
200
200
  process.exit(0);
201
201
  }
202
- return hp;
202
+ return dp;
203
203
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/cta-cli",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "Tanstack Application Builder CLI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -30,8 +30,8 @@
30
30
  "express": "^4.21.2",
31
31
  "semver": "^7.7.2",
32
32
  "zod": "^3.24.2",
33
- "@tanstack/cta-engine": "0.35.0",
34
- "@tanstack/cta-ui": "0.35.0"
33
+ "@tanstack/cta-engine": "0.36.0",
34
+ "@tanstack/cta-ui": "0.36.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@tanstack/config": "^0.16.2",
package/src/cli.ts CHANGED
@@ -32,7 +32,7 @@ import { convertTemplateToMode } from './utils.js'
32
32
  import type { CliOptions, TemplateOptions } from './types.js'
33
33
  import type { Options, PackageManager } from '@tanstack/cta-engine'
34
34
 
35
- // This CLI assumes that all of the registered frameworks have the same set of toolchains, hosts, modes, etc.
35
+ // This CLI assumes that all of the registered frameworks have the same set of toolchains, deployments, modes, etc.
36
36
 
37
37
  export function cli({
38
38
  name,
@@ -40,22 +40,22 @@ export function cli({
40
40
  forcedMode,
41
41
  forcedAddOns = [],
42
42
  defaultTemplate = 'javascript',
43
- forcedHost,
43
+ forcedDeployment,
44
44
  defaultFramework,
45
45
  craCompatible = false,
46
46
  webBase,
47
- showHostingOptions = false,
47
+ showDeploymentOptions = false,
48
48
  }: {
49
49
  name: string
50
50
  appName: string
51
51
  forcedMode?: string
52
52
  forcedAddOns?: Array<string>
53
- forcedHost?: string
53
+ forcedDeployment?: string
54
54
  defaultTemplate?: TemplateOptions
55
55
  defaultFramework?: string
56
56
  craCompatible?: boolean
57
57
  webBase?: string
58
- showHostingOptions?: boolean
58
+ showDeploymentOptions?: boolean
59
59
  }) {
60
60
  const environment = createUIEnvironment(appName, false)
61
61
 
@@ -72,11 +72,11 @@ export function cli({
72
72
  }
73
73
  }
74
74
 
75
- const hosts = new Set<string>()
75
+ const deployments = new Set<string>()
76
76
  for (const framework of getFrameworks()) {
77
77
  for (const addOn of framework.getAddOns()) {
78
- if (addOn.type === 'host') {
79
- hosts.add(addOn.id)
78
+ if (addOn.type === 'deployment') {
79
+ deployments.add(addOn.id)
80
80
  }
81
81
  }
82
82
  }
@@ -202,7 +202,7 @@ Remove your node_modules directory and package lock file and re-install.`,
202
202
  forcedAddOns,
203
203
  environmentFactory: () => createUIEnvironment(appName, false),
204
204
  webBase,
205
- showHostingOptions,
205
+ showDeploymentOptions,
206
206
  })
207
207
  } else if (parsedAddOns.length < 1) {
208
208
  const addOns = await promptForAddOns()
@@ -308,15 +308,15 @@ Remove your node_modules directory and package lock file and re-install.`,
308
308
  },
309
309
  )
310
310
 
311
- if (hosts.size > 0) {
311
+ if (deployments.size > 0) {
312
312
  program.option<string>(
313
- `--host <${Array.from(hosts).join('|')}>`,
314
- `Explicitly tell the CLI to use this hosting provider`,
313
+ `--deployment <${Array.from(deployments).join('|')}>`,
314
+ `Explicitly tell the CLI to use this deployment adapter`,
315
315
  (value) => {
316
- if (!hosts.has(value)) {
316
+ if (!deployments.has(value)) {
317
317
  throw new InvalidArgumentError(
318
- `Invalid host: ${value}. The following are allowed: ${Array.from(
319
- hosts,
318
+ `Invalid adapter: ${value}. The following are allowed: ${Array.from(
319
+ deployments,
320
320
  ).join(', ')}`,
321
321
  )
322
322
  }
@@ -485,7 +485,7 @@ Remove your node_modules directory and package lock file and re-install.`,
485
485
  cliOptions,
486
486
  defaultMode,
487
487
  forcedAddOns,
488
- { forcedHost },
488
+ { forcedDeployment },
489
489
  )
490
490
  }
491
491
 
@@ -494,7 +494,7 @@ Remove your node_modules directory and package lock file and re-install.`,
494
494
  cliOptions,
495
495
  defaultMode,
496
496
  forcedAddOns,
497
- { disableNameCheck: true, forcedHost },
497
+ { disableNameCheck: true, forcedDeployment },
498
498
  )
499
499
  const options = {
500
500
  ...createSerializedOptions(optionsFromCLI!),
@@ -508,7 +508,7 @@ Remove your node_modules directory and package lock file and re-install.`,
508
508
  forcedAddOns,
509
509
  environmentFactory: () => createUIEnvironment(appName, false),
510
510
  webBase,
511
- showHostingOptions,
511
+ showDeploymentOptions,
512
512
  })
513
513
  return
514
514
  }
@@ -520,7 +520,7 @@ Remove your node_modules directory and package lock file and re-install.`,
520
520
  finalOptions = await promptForCreateOptions(cliOptions, {
521
521
  forcedMode: defaultMode,
522
522
  forcedAddOns,
523
- showHostingOptions,
523
+ showDeploymentOptions,
524
524
  })
525
525
  }
526
526
 
@@ -19,7 +19,7 @@ export async function normalizeOptions(
19
19
  forcedAddOns?: Array<string>,
20
20
  opts?: {
21
21
  disableNameCheck?: boolean
22
- forcedHost?: string
22
+ forcedDeployment?: string
23
23
  },
24
24
  ): Promise<Options | undefined> {
25
25
  const projectName = (cliOptions.projectName ?? '').trim()
@@ -77,7 +77,7 @@ export async function normalizeOptions(
77
77
  starter?.dependsOn ||
78
78
  forcedAddOns ||
79
79
  cliOptions.toolchain ||
80
- cliOptions.host
80
+ cliOptions.deployment
81
81
  ) {
82
82
  const selectedAddOns = new Set<string>([
83
83
  ...(starter?.dependsOn || []),
@@ -91,12 +91,12 @@ export async function normalizeOptions(
91
91
  if (cliOptions.toolchain) {
92
92
  selectedAddOns.add(cliOptions.toolchain)
93
93
  }
94
- if (cliOptions.host) {
95
- selectedAddOns.add(cliOptions.host)
94
+ if (cliOptions.deployment) {
95
+ selectedAddOns.add(cliOptions.deployment)
96
96
  }
97
97
 
98
- if (!cliOptions.host && opts?.forcedHost) {
99
- selectedAddOns.add(opts.forcedHost)
98
+ if (!cliOptions.deployment && opts?.forcedDeployment) {
99
+ selectedAddOns.add(opts.forcedDeployment)
100
100
  }
101
101
 
102
102
  return await finalizeAddOns(framework, mode, Array.from(selectedAddOns))
package/src/options.ts CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  promptForAddOnOptions,
14
14
  selectAddOns,
15
15
  selectGit,
16
- selectHost,
16
+ selectDeployment,
17
17
  selectPackageManager,
18
18
  selectRouterType,
19
19
  selectTailwind,
@@ -30,11 +30,11 @@ export async function promptForCreateOptions(
30
30
  {
31
31
  forcedAddOns = [],
32
32
  forcedMode,
33
- showHostingOptions = false,
33
+ showDeploymentOptions = false,
34
34
  }: {
35
35
  forcedAddOns?: Array<string>
36
36
  forcedMode?: string
37
- showHostingOptions?: boolean
37
+ showDeploymentOptions?: boolean
38
38
  },
39
39
  ): Promise<Required<Options> | undefined> {
40
40
  const options = {} as Required<Options>
@@ -89,9 +89,9 @@ export async function promptForCreateOptions(
89
89
  cliOptions.toolchain,
90
90
  )
91
91
 
92
- // Host selection
93
- const host = showHostingOptions
94
- ? await selectHost(options.framework, cliOptions.host)
92
+ // Deployment selection
93
+ const deployment = showDeploymentOptions
94
+ ? await selectDeployment(options.framework, cliOptions.deployment)
95
95
  : undefined
96
96
 
97
97
  // Add-ons selection
@@ -100,8 +100,8 @@ export async function promptForCreateOptions(
100
100
  if (toolchain) {
101
101
  addOns.add(toolchain)
102
102
  }
103
- if (host) {
104
- addOns.add(host)
103
+ if (deployment) {
104
+ addOns.add(deployment)
105
105
  }
106
106
 
107
107
  for (const addOn of forcedAddOns) {
package/src/types.ts CHANGED
@@ -8,7 +8,7 @@ export interface CliOptions {
8
8
  tailwind?: boolean
9
9
  packageManager?: PackageManager
10
10
  toolchain?: string
11
- host?: string
11
+ deployment?: string
12
12
  projectName?: string
13
13
  git?: boolean
14
14
  addOns?: Array<string> | boolean
package/src/ui-prompts.ts CHANGED
@@ -232,19 +232,19 @@ export async function promptForAddOnOptions(
232
232
  return addOnOptions
233
233
  }
234
234
 
235
- export async function selectHost(
235
+ export async function selectDeployment(
236
236
  framework: Framework,
237
- host?: string,
237
+ deployment?: string,
238
238
  ): Promise<string | undefined> {
239
- const hosts = new Set<AddOn>()
239
+ const deployments = new Set<AddOn>()
240
240
  let initialValue: string | undefined = undefined
241
241
  for (const addOn of framework
242
242
  .getAddOns()
243
243
  .sort((a, b) => a.name.localeCompare(b.name))) {
244
- if (addOn.type === 'host') {
245
- hosts.add(addOn)
246
- if (host && addOn.id === host) {
247
- return host
244
+ if (addOn.type === 'deployment') {
245
+ deployments.add(addOn)
246
+ if (deployment && addOn.id === deployment) {
247
+ return deployment
248
248
  }
249
249
  if (addOn.default) {
250
250
  initialValue = addOn.id
@@ -252,21 +252,21 @@ export async function selectHost(
252
252
  }
253
253
  }
254
254
 
255
- const hp = await select({
256
- message: 'Select hosting provider',
255
+ const dp = await select({
256
+ message: 'Select deployment adapter',
257
257
  options: [
258
- ...Array.from(hosts).map((h) => ({
259
- value: h.id,
260
- label: h.name,
258
+ ...Array.from(deployments).map((d) => ({
259
+ value: d.id,
260
+ label: d.name,
261
261
  })),
262
262
  ],
263
263
  initialValue: initialValue,
264
264
  })
265
265
 
266
- if (isCancel(hp)) {
266
+ if (isCancel(dp)) {
267
267
  cancel('Operation cancelled.')
268
268
  process.exit(0)
269
269
  }
270
270
 
271
- return hp
271
+ return dp
272
272
  }
@@ -102,7 +102,7 @@ describe('normalizeOptions', () => {
102
102
  const options = await normalizeOptions({
103
103
  projectName: 'test',
104
104
  starter: 'https://github.com/cta-dev/cta-starter-solid',
105
- host: 'nitro',
105
+ deployment: 'nitro',
106
106
  })
107
107
  expect(options?.mode).toBe('file-router')
108
108
  expect(options?.tailwind).toBe(true)