@tanstack/cta-engine 0.10.0-alpha.6 → 0.10.0-alpha.9

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/add.js CHANGED
@@ -21,10 +21,7 @@ async function createOptions(json, addOns) {
21
21
  return {
22
22
  ...json,
23
23
  tailwind: true,
24
- chosenAddOns: await finalizeAddOns(json.framework, json.mode, [
25
- ...json.existingAddOns,
26
- ...addOns,
27
- ]),
24
+ chosenAddOns: await finalizeAddOns(json.framework, json.mode, [...json.existingAddOns, ...addOns]),
28
25
  };
29
26
  }
30
27
  async function runCreateApp(options) {
@@ -33,6 +30,7 @@ async function runCreateApp(options) {
33
30
  silent: true,
34
31
  environment,
35
32
  cwd: process.cwd(),
33
+ name: 'create-tsrouter-app',
36
34
  });
37
35
  return output;
38
36
  }
package/dist/cli.js CHANGED
@@ -9,7 +9,7 @@ import { listAddOns } from './add-ons.js';
9
9
  import { DEFAULT_FRAMEWORK, SUPPORTED_FRAMEWORKS } from './constants.js';
10
10
  // import { initAddOn } from './custom-add-on.js'
11
11
  import { createDefaultEnvironment } from './environment.js';
12
- export function cli() {
12
+ export function cli({ name, forcedMode, forcedAddOns, }) {
13
13
  const program = new Command();
14
14
  program
15
15
  .name('create-tsrouter-app')
@@ -32,7 +32,7 @@ export function cli() {
32
32
  // .action(async () => {
33
33
  // await initAddOn('overlay')
34
34
  // })
35
- program // 104 22
35
+ program
36
36
  .argument('[project-name]', 'name of the project')
37
37
  .option('--no-git', 'do not create a git repository')
38
38
  .option('--target-dir <path>', 'the directory to create the project in')
@@ -42,14 +42,6 @@ export function cli() {
42
42
  }
43
43
  return value;
44
44
  }, DEFAULT_FRAMEWORK)
45
- .option('--template <type>', 'project template (typescript, javascript, file-router)', (value) => {
46
- if (value !== 'typescript' &&
47
- value !== 'javascript' &&
48
- value !== 'file-router') {
49
- throw new InvalidArgumentError(`Invalid template: ${value}. Only the following are allowed: typescript, javascript, file-router`);
50
- }
51
- return value;
52
- })
53
45
  .option(`--package-manager <${SUPPORTED_PACKAGE_MANAGERS.join('|')}>`, `Explicitly tell the CLI to use this package manager`, (value) => {
54
46
  if (!SUPPORTED_PACKAGE_MANAGERS.includes(value)) {
55
47
  throw new InvalidArgumentError(`Invalid package manager: ${value}. The following are allowed: ${SUPPORTED_PACKAGE_MANAGERS.join(', ')}`);
@@ -71,10 +63,20 @@ export function cli() {
71
63
  return addOns;
72
64
  })
73
65
  .option('--list-add-ons', 'list all available add-ons', false)
74
- .option('--overlay [url]', 'add an overlay from a URL', false)
66
+ // .option('--overlay [url]', 'add an overlay from a URL', false)
75
67
  .option('--mcp', 'run the MCP server', false)
76
- .option('--mcp-sse', 'run the MCP server in SSE mode', false)
77
- .action(async (projectName, options) => {
68
+ .option('--mcp-sse', 'run the MCP server in SSE mode', false);
69
+ if (!forcedMode) {
70
+ program.option('--template <type>', 'project template (typescript, javascript, file-router)', (value) => {
71
+ if (value !== 'typescript' &&
72
+ value !== 'javascript' &&
73
+ value !== 'file-router') {
74
+ throw new InvalidArgumentError(`Invalid template: ${value}. Only the following are allowed: typescript, javascript, file-router`);
75
+ }
76
+ return value;
77
+ });
78
+ }
79
+ program.action(async (projectName, options) => {
78
80
  if (options.listAddOns) {
79
81
  await listAddOns(options);
80
82
  }
@@ -87,23 +89,28 @@ export function cli() {
87
89
  projectName,
88
90
  ...options,
89
91
  };
90
- let finalOptions = await normalizeOptions(cliOptions);
92
+ if (forcedMode) {
93
+ cliOptions.template = forcedMode;
94
+ }
95
+ let finalOptions = await normalizeOptions(cliOptions, forcedAddOns);
91
96
  if (finalOptions) {
92
97
  intro(`Creating a new TanStack app in ${projectName}...`);
93
98
  }
94
99
  else {
95
100
  intro("Let's configure your TanStack application");
96
- finalOptions = await promptForOptions(cliOptions);
101
+ finalOptions = await promptForOptions(cliOptions, {
102
+ forcedMode,
103
+ forcedAddOns,
104
+ });
97
105
  }
98
106
  await createApp(finalOptions, {
99
107
  environment: createDefaultEnvironment(),
100
108
  cwd: options.targetDir || undefined,
109
+ name,
101
110
  });
102
111
  }
103
112
  catch (error) {
104
- log.error(error instanceof Error
105
- ? error.message
106
- : 'An unknown error occurred');
113
+ log.error(error instanceof Error ? error.message : 'An unknown error occurred');
107
114
  process.exit(1);
108
115
  }
109
116
  }
@@ -209,7 +209,7 @@ async function copyAddOnFile(environment, content, target, targetPath, templateF
209
209
  }
210
210
  }
211
211
  }
212
- export async function createApp(options, { silent = false, environment, cwd, }) {
212
+ export async function createApp(options, { silent = false, environment, cwd, name = 'create-tsrouter-app', }) {
213
213
  environment.startRun();
214
214
  const templateDirBase = resolve(getTemplatesRoot(), options.framework, 'base');
215
215
  const templateDirRouter = resolve(getTemplatesRoot(), options.framework, options.mode);
@@ -78,9 +78,7 @@ export default (parentRoute: RootRoute) => createRoute({
78
78
  async function createOptions(json) {
79
79
  return {
80
80
  ...json,
81
- chosenAddOns: await finalizeAddOns(json.framework, json.mode, [
82
- ...json.existingAddOns,
83
- ]),
81
+ chosenAddOns: await finalizeAddOns(json.framework, json.mode, [...json.existingAddOns]),
84
82
  };
85
83
  }
86
84
  async function runCreateApp(options) {
@@ -89,6 +87,7 @@ async function runCreateApp(options) {
89
87
  silent: true,
90
88
  environment,
91
89
  cwd: process.cwd(),
90
+ name: 'create-tsrouter-app',
92
91
  });
93
92
  return output;
94
93
  }
package/dist/mcp.js CHANGED
@@ -95,6 +95,7 @@ server.tool('createTanStackReactApplication', {
95
95
  }, {
96
96
  silent: true,
97
97
  environment: createDefaultEnvironment(),
98
+ name: 'create-tsrouter-app',
98
99
  });
99
100
  return {
100
101
  content: [{ type: 'text', text: 'Application created successfully' }],
@@ -173,6 +174,7 @@ server.tool('createTanStackSolidApplication', {
173
174
  }, {
174
175
  silent: true,
175
176
  environment: createDefaultEnvironment(),
177
+ name: 'create-tsrouter-app',
176
178
  });
177
179
  return {
178
180
  content: [{ type: 'text', text: 'Application created successfully' }],
package/dist/options.js CHANGED
@@ -4,7 +4,7 @@ import { DEFAULT_TOOLCHAIN, SUPPORTED_TOOLCHAINS } from './toolchain.js';
4
4
  import { CODE_ROUTER, DEFAULT_FRAMEWORK, FILE_ROUTER } from './constants.js';
5
5
  import { finalizeAddOns, getAllAddOns, loadRemoteAddOn } from './add-ons.js';
6
6
  // If all CLI options are provided, use them directly
7
- export async function normalizeOptions(cliOptions) {
7
+ export async function normalizeOptions(cliOptions, forcedAddOns) {
8
8
  // in some cases, if you use windows/powershell, the argument for addons
9
9
  // if sepparated by comma is not really passed as an array, but as a string
10
10
  // with spaces, We need to normalize this edge case.
@@ -13,6 +13,9 @@ export async function normalizeOptions(cliOptions) {
13
13
  if (parseSeparatedArgs.length > 1) {
14
14
  cliOptions.addOns = parseSeparatedArgs;
15
15
  }
16
+ if (forcedAddOns) {
17
+ cliOptions.addOns = [...cliOptions.addOns, ...forcedAddOns];
18
+ }
16
19
  }
17
20
  if (cliOptions.projectName) {
18
21
  let typescript = cliOptions.template === 'typescript' ||
@@ -101,7 +104,7 @@ async function collectVariables(variables) {
101
104
  }
102
105
  return responses;
103
106
  }
104
- export async function promptForOptions(cliOptions) {
107
+ export async function promptForOptions(cliOptions, { forcedAddOns = [], forcedMode, }) {
105
108
  const options = {};
106
109
  options.framework = cliOptions.framework || DEFAULT_FRAMEWORK;
107
110
  if (options.framework === 'solid') {
@@ -128,7 +131,7 @@ export async function promptForOptions(cliOptions) {
128
131
  options.projectName = value;
129
132
  }
130
133
  // Router type selection
131
- if (!cliOptions.template) {
134
+ if (!cliOptions.template && !forcedMode) {
132
135
  const routerType = await select({
133
136
  message: 'Select the router type:',
134
137
  options: [
@@ -149,6 +152,10 @@ export async function promptForOptions(cliOptions) {
149
152
  }
150
153
  options.mode = routerType;
151
154
  }
155
+ else if (forcedMode) {
156
+ options.mode = forcedMode === 'file-router' ? FILE_ROUTER : CODE_ROUTER;
157
+ options.typescript = options.mode === FILE_ROUTER;
158
+ }
152
159
  else {
153
160
  options.mode =
154
161
  cliOptions.template === 'file-router' ? FILE_ROUTER : CODE_ROUTER;
@@ -234,7 +241,7 @@ export async function promptForOptions(cliOptions) {
234
241
  }
235
242
  options.chosenAddOns = [];
236
243
  if (Array.isArray(cliOptions.addOns)) {
237
- options.chosenAddOns = await finalizeAddOns(options.framework, options.mode, cliOptions.addOns);
244
+ options.chosenAddOns = await finalizeAddOns(options.framework, options.mode, Array.from(new Set([...cliOptions.addOns, ...forcedAddOns])));
238
245
  options.tailwind = true;
239
246
  }
240
247
  else if (cliOptions.addOns) {
@@ -245,7 +252,9 @@ export async function promptForOptions(cliOptions) {
245
252
  if (options.typescript && addOns.length > 0) {
246
253
  const value = await multiselect({
247
254
  message: 'What add-ons would you like for your project:',
248
- options: addOns.map((addOn) => ({
255
+ options: addOns
256
+ .filter((addOn) => !forcedAddOns.includes(addOn.id))
257
+ .map((addOn) => ({
249
258
  value: addOn.id,
250
259
  label: addOn.name,
251
260
  hint: addOn.description,
@@ -264,7 +273,9 @@ export async function promptForOptions(cliOptions) {
264
273
  if (options.typescript && examples.length > 0) {
265
274
  const value = await multiselect({
266
275
  message: 'Would you like any examples?',
267
- options: examples.map((addOn) => ({
276
+ options: examples
277
+ .filter((addOn) => !forcedAddOns.includes(addOn.id))
278
+ .map((addOn) => ({
268
279
  value: addOn.id,
269
280
  label: addOn.name,
270
281
  hint: addOn.description,
@@ -277,11 +288,16 @@ export async function promptForOptions(cliOptions) {
277
288
  }
278
289
  selectedExamples = value;
279
290
  }
280
- if (selectedAddOns.length > 0 || selectedExamples.length > 0) {
281
- options.chosenAddOns = await finalizeAddOns(options.framework, options.mode, [...selectedAddOns, ...selectedExamples]);
291
+ if (selectedAddOns.length > 0 ||
292
+ selectedExamples.length > 0 ||
293
+ forcedAddOns.length > 0) {
294
+ options.chosenAddOns = await finalizeAddOns(options.framework, options.mode, Array.from(new Set([...selectedAddOns, ...selectedExamples, ...forcedAddOns])));
282
295
  options.tailwind = true;
283
296
  }
284
297
  }
298
+ else if (forcedAddOns.length > 0) {
299
+ options.chosenAddOns = await finalizeAddOns(options.framework, options.mode, forcedAddOns);
300
+ }
285
301
  // Collect variables
286
302
  const variables = [];
287
303
  for (const addOn of options.chosenAddOns) {
@@ -1 +1,5 @@
1
- export declare function cli(): void;
1
+ export declare function cli({ name, forcedMode, forcedAddOns, }: {
2
+ name: string;
3
+ forcedMode?: 'typescript' | 'javascript' | 'file-router';
4
+ forcedAddOns?: Array<string>;
5
+ }): void;
@@ -1,6 +1,7 @@
1
1
  import type { Environment, Options } from './types.js';
2
- export declare function createApp(options: Options, { silent, environment, cwd, }: {
2
+ export declare function createApp(options: Options, { silent, environment, cwd, name, }: {
3
3
  silent?: boolean;
4
4
  environment: Environment;
5
5
  cwd?: string;
6
+ name: string;
6
7
  }): Promise<void>;
@@ -1,3 +1,6 @@
1
1
  import type { CliOptions, Options } from './types.js';
2
- export declare function normalizeOptions(cliOptions: CliOptions): Promise<Options | undefined>;
3
- export declare function promptForOptions(cliOptions: CliOptions): Promise<Required<Options>>;
2
+ export declare function normalizeOptions(cliOptions: CliOptions, forcedAddOns?: Array<string>): Promise<Options | undefined>;
3
+ export declare function promptForOptions(cliOptions: CliOptions, { forcedAddOns, forcedMode, }: {
4
+ forcedAddOns?: Array<string>;
5
+ forcedMode?: 'typescript' | 'javascript' | 'file-router';
6
+ }): Promise<Required<Options>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/cta-engine",
3
- "version": "0.10.0-alpha.6",
3
+ "version": "0.10.0-alpha.9",
4
4
  "description": "Tanstack Application Builder Engine",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/add.ts CHANGED
@@ -25,7 +25,7 @@ import { readConfigFile, writeConfigFile } from './config-file.js'
25
25
 
26
26
  import type { PersistedOptions } from './config-file.js'
27
27
 
28
- import type { Options } from './types.js'
28
+ import type { Framework, Options } from './types.js'
29
29
 
30
30
  function isDirectory(path: string) {
31
31
  return statSync(path).isDirectory()
@@ -43,10 +43,11 @@ async function createOptions(
43
43
  return {
44
44
  ...json,
45
45
  tailwind: true,
46
- chosenAddOns: await finalizeAddOns(json.framework!, json.mode!, [
47
- ...json.existingAddOns,
48
- ...addOns,
49
- ]),
46
+ chosenAddOns: await finalizeAddOns(
47
+ json.framework as Framework,
48
+ json.mode as string,
49
+ [...json.existingAddOns, ...addOns],
50
+ ),
50
51
  } as Required<Options>
51
52
  }
52
53
 
@@ -56,6 +57,7 @@ async function runCreateApp(options: Required<Options>) {
56
57
  silent: true,
57
58
  environment,
58
59
  cwd: process.cwd(),
60
+ name: 'create-tsrouter-app',
59
61
  })
60
62
  return output
61
63
  }
package/src/cli.ts CHANGED
@@ -18,7 +18,15 @@ import type { PackageManager } from './package-manager.js'
18
18
  import type { ToolChain } from './toolchain.js'
19
19
  import type { CliOptions, Framework } from './types.js'
20
20
 
21
- export function cli() {
21
+ export function cli({
22
+ name,
23
+ forcedMode,
24
+ forcedAddOns,
25
+ }: {
26
+ name: string
27
+ forcedMode?: 'typescript' | 'javascript' | 'file-router'
28
+ forcedAddOns?: Array<string>
29
+ }) {
22
30
  const program = new Command()
23
31
 
24
32
  program
@@ -46,7 +54,7 @@ export function cli() {
46
54
  // await initAddOn('overlay')
47
55
  // })
48
56
 
49
- program // 104 22
57
+ program
50
58
  .argument('[project-name]', 'name of the project')
51
59
  .option('--no-git', 'do not create a git repository')
52
60
  .option('--target-dir <path>', 'the directory to create the project in')
@@ -65,22 +73,6 @@ export function cli() {
65
73
  },
66
74
  DEFAULT_FRAMEWORK,
67
75
  )
68
- .option<'typescript' | 'javascript' | 'file-router'>(
69
- '--template <type>',
70
- 'project template (typescript, javascript, file-router)',
71
- (value) => {
72
- if (
73
- value !== 'typescript' &&
74
- value !== 'javascript' &&
75
- value !== 'file-router'
76
- ) {
77
- throw new InvalidArgumentError(
78
- `Invalid template: ${value}. Only the following are allowed: typescript, javascript, file-router`,
79
- )
80
- }
81
- return value
82
- },
83
- )
84
76
  .option<PackageManager>(
85
77
  `--package-manager <${SUPPORTED_PACKAGE_MANAGERS.join('|')}>`,
86
78
  `Explicitly tell the CLI to use this package manager`,
@@ -122,42 +114,68 @@ export function cli() {
122
114
  },
123
115
  )
124
116
  .option('--list-add-ons', 'list all available add-ons', false)
125
- .option('--overlay [url]', 'add an overlay from a URL', false)
117
+ // .option('--overlay [url]', 'add an overlay from a URL', false)
126
118
  .option('--mcp', 'run the MCP server', false)
127
119
  .option('--mcp-sse', 'run the MCP server in SSE mode', false)
128
- .action(async (projectName: string, options: CliOptions) => {
129
- if (options.listAddOns) {
130
- await listAddOns(options)
131
- } else if (options.mcp || options.mcpSse) {
132
- await runServer(!!options.mcpSse)
133
- } else {
134
- try {
135
- const cliOptions = {
136
- projectName,
137
- ...options,
138
- } as CliOptions
139
120
 
140
- let finalOptions = await normalizeOptions(cliOptions)
141
- if (finalOptions) {
142
- intro(`Creating a new TanStack app in ${projectName}...`)
143
- } else {
144
- intro("Let's configure your TanStack application")
145
- finalOptions = await promptForOptions(cliOptions)
146
- }
147
- await createApp(finalOptions, {
148
- environment: createDefaultEnvironment(),
149
- cwd: options.targetDir || undefined,
150
- })
151
- } catch (error) {
152
- log.error(
153
- error instanceof Error
154
- ? error.message
155
- : 'An unknown error occurred',
121
+ if (!forcedMode) {
122
+ program.option<'typescript' | 'javascript' | 'file-router'>(
123
+ '--template <type>',
124
+ 'project template (typescript, javascript, file-router)',
125
+ (value) => {
126
+ if (
127
+ value !== 'typescript' &&
128
+ value !== 'javascript' &&
129
+ value !== 'file-router'
130
+ ) {
131
+ throw new InvalidArgumentError(
132
+ `Invalid template: ${value}. Only the following are allowed: typescript, javascript, file-router`,
156
133
  )
157
- process.exit(1)
158
134
  }
135
+ return value
136
+ },
137
+ )
138
+ }
139
+
140
+ program.action(async (projectName: string, options: CliOptions) => {
141
+ if (options.listAddOns) {
142
+ await listAddOns(options)
143
+ } else if (options.mcp || options.mcpSse) {
144
+ await runServer(!!options.mcpSse)
145
+ } else {
146
+ try {
147
+ const cliOptions = {
148
+ projectName,
149
+ ...options,
150
+ } as CliOptions
151
+
152
+ if (forcedMode) {
153
+ cliOptions.template = forcedMode
154
+ }
155
+
156
+ let finalOptions = await normalizeOptions(cliOptions, forcedAddOns)
157
+ if (finalOptions) {
158
+ intro(`Creating a new TanStack app in ${projectName}...`)
159
+ } else {
160
+ intro("Let's configure your TanStack application")
161
+ finalOptions = await promptForOptions(cliOptions, {
162
+ forcedMode,
163
+ forcedAddOns,
164
+ })
165
+ }
166
+ await createApp(finalOptions, {
167
+ environment: createDefaultEnvironment(),
168
+ cwd: options.targetDir || undefined,
169
+ name,
170
+ })
171
+ } catch (error) {
172
+ log.error(
173
+ error instanceof Error ? error.message : 'An unknown error occurred',
174
+ )
175
+ process.exit(1)
159
176
  }
160
- })
177
+ }
178
+ })
161
179
 
162
180
  program.parse()
163
181
  }
package/src/create-app.ts CHANGED
@@ -304,10 +304,12 @@ export async function createApp(
304
304
  silent = false,
305
305
  environment,
306
306
  cwd,
307
+ name = 'create-tsrouter-app',
307
308
  }: {
308
309
  silent?: boolean
309
310
  environment: Environment
310
311
  cwd?: string
312
+ name: string
311
313
  },
312
314
  ) {
313
315
  environment.startRun()
@@ -8,7 +8,7 @@ import { createApp } from './create-app.js'
8
8
  import { readConfigFile } from './config-file.js'
9
9
  import { finalizeAddOns } from './add-ons.js'
10
10
 
11
- import type { Options } from './types.js'
11
+ import type { Framework, Options } from './types.js'
12
12
  import type { PersistedOptions } from './config-file.js'
13
13
 
14
14
  type AddOnMode = 'add-on' | 'overlay'
@@ -106,9 +106,11 @@ async function createOptions(
106
106
  ): Promise<Required<Options>> {
107
107
  return {
108
108
  ...json,
109
- chosenAddOns: await finalizeAddOns(json.framework!, json.mode!, [
110
- ...json.existingAddOns,
111
- ]),
109
+ chosenAddOns: await finalizeAddOns(
110
+ json.framework as Framework,
111
+ json.mode as string,
112
+ [...json.existingAddOns],
113
+ ),
112
114
  } as Required<Options>
113
115
  }
114
116
 
@@ -118,6 +120,7 @@ async function runCreateApp(options: Required<Options>) {
118
120
  silent: true,
119
121
  environment,
120
122
  cwd: process.cwd(),
123
+ name: 'create-tsrouter-app',
121
124
  })
122
125
  return output
123
126
  }
package/src/mcp.ts CHANGED
@@ -114,6 +114,7 @@ server.tool(
114
114
  {
115
115
  silent: true,
116
116
  environment: createDefaultEnvironment(),
117
+ name: 'create-tsrouter-app',
117
118
  },
118
119
  )
119
120
  return {
@@ -209,6 +210,7 @@ server.tool(
209
210
  {
210
211
  silent: true,
211
212
  environment: createDefaultEnvironment(),
213
+ name: 'create-tsrouter-app',
212
214
  },
213
215
  )
214
216
  return {
package/src/options.ts CHANGED
@@ -21,6 +21,7 @@ import type { AddOn, CliOptions, Options, Overlay, Variable } from './types.js'
21
21
  // If all CLI options are provided, use them directly
22
22
  export async function normalizeOptions(
23
23
  cliOptions: CliOptions,
24
+ forcedAddOns?: Array<string>,
24
25
  ): Promise<Options | undefined> {
25
26
  // in some cases, if you use windows/powershell, the argument for addons
26
27
  // if sepparated by comma is not really passed as an array, but as a string
@@ -30,6 +31,9 @@ export async function normalizeOptions(
30
31
  if (parseSeparatedArgs.length > 1) {
31
32
  cliOptions.addOns = parseSeparatedArgs
32
33
  }
34
+ if (forcedAddOns) {
35
+ cliOptions.addOns = [...cliOptions.addOns, ...forcedAddOns]
36
+ }
33
37
  }
34
38
  if (cliOptions.projectName) {
35
39
  let typescript =
@@ -135,6 +139,13 @@ async function collectVariables(
135
139
 
136
140
  export async function promptForOptions(
137
141
  cliOptions: CliOptions,
142
+ {
143
+ forcedAddOns = [],
144
+ forcedMode,
145
+ }: {
146
+ forcedAddOns?: Array<string>
147
+ forcedMode?: 'typescript' | 'javascript' | 'file-router'
148
+ },
138
149
  ): Promise<Required<Options>> {
139
150
  const options = {} as Required<Options>
140
151
 
@@ -166,7 +177,7 @@ export async function promptForOptions(
166
177
  }
167
178
 
168
179
  // Router type selection
169
- if (!cliOptions.template) {
180
+ if (!cliOptions.template && !forcedMode) {
170
181
  const routerType = await select({
171
182
  message: 'Select the router type:',
172
183
  options: [
@@ -186,6 +197,9 @@ export async function promptForOptions(
186
197
  process.exit(0)
187
198
  }
188
199
  options.mode = routerType as typeof CODE_ROUTER | typeof FILE_ROUTER
200
+ } else if (forcedMode) {
201
+ options.mode = forcedMode === 'file-router' ? FILE_ROUTER : CODE_ROUTER
202
+ options.typescript = options.mode === FILE_ROUTER
189
203
  } else {
190
204
  options.mode =
191
205
  cliOptions.template === 'file-router' ? FILE_ROUTER : CODE_ROUTER
@@ -274,7 +288,7 @@ export async function promptForOptions(
274
288
  options.chosenAddOns = await finalizeAddOns(
275
289
  options.framework,
276
290
  options.mode,
277
- cliOptions.addOns,
291
+ Array.from(new Set([...cliOptions.addOns, ...forcedAddOns])),
278
292
  )
279
293
  options.tailwind = true
280
294
  } else if (cliOptions.addOns) {
@@ -285,11 +299,13 @@ export async function promptForOptions(
285
299
  if (options.typescript && addOns.length > 0) {
286
300
  const value = await multiselect({
287
301
  message: 'What add-ons would you like for your project:',
288
- options: addOns.map((addOn) => ({
289
- value: addOn.id,
290
- label: addOn.name,
291
- hint: addOn.description,
292
- })),
302
+ options: addOns
303
+ .filter((addOn) => !forcedAddOns.includes(addOn.id))
304
+ .map((addOn) => ({
305
+ value: addOn.id,
306
+ label: addOn.name,
307
+ hint: addOn.description,
308
+ })),
293
309
  required: false,
294
310
  })
295
311
 
@@ -306,11 +322,13 @@ export async function promptForOptions(
306
322
  if (options.typescript && examples.length > 0) {
307
323
  const value = await multiselect({
308
324
  message: 'Would you like any examples?',
309
- options: examples.map((addOn) => ({
310
- value: addOn.id,
311
- label: addOn.name,
312
- hint: addOn.description,
313
- })),
325
+ options: examples
326
+ .filter((addOn) => !forcedAddOns.includes(addOn.id))
327
+ .map((addOn) => ({
328
+ value: addOn.id,
329
+ label: addOn.name,
330
+ hint: addOn.description,
331
+ })),
314
332
  required: false,
315
333
  })
316
334
 
@@ -321,14 +339,26 @@ export async function promptForOptions(
321
339
  selectedExamples = value
322
340
  }
323
341
 
324
- if (selectedAddOns.length > 0 || selectedExamples.length > 0) {
342
+ if (
343
+ selectedAddOns.length > 0 ||
344
+ selectedExamples.length > 0 ||
345
+ forcedAddOns.length > 0
346
+ ) {
325
347
  options.chosenAddOns = await finalizeAddOns(
326
348
  options.framework,
327
349
  options.mode,
328
- [...selectedAddOns, ...selectedExamples],
350
+ Array.from(
351
+ new Set([...selectedAddOns, ...selectedExamples, ...forcedAddOns]),
352
+ ),
329
353
  )
330
354
  options.tailwind = true
331
355
  }
356
+ } else if (forcedAddOns.length > 0) {
357
+ options.chosenAddOns = await finalizeAddOns(
358
+ options.framework,
359
+ options.mode,
360
+ forcedAddOns,
361
+ )
332
362
  }
333
363
 
334
364
  // Collect variables
package/tsconfig.json CHANGED
@@ -1,8 +1,14 @@
1
1
  {
2
- "extends": "../../tsconfig.json",
3
2
  "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ES2020",
4
5
  "outDir": "./dist",
5
6
  "rootDir": "./src",
7
+ "strict": true,
8
+ "esModuleInterop": true,
9
+ "skipLibCheck": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "moduleResolution": "node",
6
12
  "declaration": true,
7
13
  "declarationDir": "./dist/types"
8
14
  },