create-start-app 0.9.0 → 0.9.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/README.md +18 -18
- package/dist/create-app.js +6 -6
- package/package.json +1 -1
- package/src/create-app.ts +11 -7
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This CLI application builds Tanstack Router applications that are the functional equivalent of [Create React App](https://create-react-app.dev/).
|
|
4
4
|
|
|
5
|
-
To help accelerate the migration away from `create-react-app` we created the `create-
|
|
5
|
+
To help accelerate the migration away from `create-react-app` we created the `create-start-app` CLI which is a plug-n-play replacement for CRA.
|
|
6
6
|
|
|
7
7
|
## Quick Start
|
|
8
8
|
|
|
@@ -10,17 +10,17 @@ To maintain compatability with `create-react-app` you can build a new applicatio
|
|
|
10
10
|
|
|
11
11
|
| Command | Description |
|
|
12
12
|
| -------------------------------------------------------------------------------- | ------------------------------------------------- |
|
|
13
|
-
| `npx create-
|
|
14
|
-
| `npx create-
|
|
15
|
-
| `npx create-
|
|
16
|
-
| `npx create-
|
|
17
|
-
| `npx create-
|
|
18
|
-
| `npx create-
|
|
13
|
+
| `npx create-start-app@latest my-app` | Create a new app |
|
|
14
|
+
| `npx create-start-app@latest my-app --template file-router` | Create a new file based app |
|
|
15
|
+
| `npx create-start-app@latest my-app --template typescript` | Create a new TypeScript app using the Code Router |
|
|
16
|
+
| `npx create-start-app@latest my-app --tailwind` | Add Tailwind CSS support |
|
|
17
|
+
| `npx create-start-app@latest my-app --framework solid` | Create a Solid app |
|
|
18
|
+
| `npx create-start-app@latest my-app --framework solid --template file-router` | Create a Solid app with file-router |
|
|
19
19
|
|
|
20
20
|
If you don't specify a project name, the CLI will walk you through an interactive setup process:
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
npx create-
|
|
23
|
+
npx create-start-app@latest
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
This will start an interactive CLI that guides you through the setup process, allowing you to choose:
|
|
@@ -38,7 +38,7 @@ This will start an interactive CLI that guides you through the setup process, al
|
|
|
38
38
|
You can also use command line flags to specify your preferences directly:
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
npx create-
|
|
41
|
+
npx create-start-app@latest my-app --template file-router --tailwind --package-manager pnpm
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
Available options:
|
|
@@ -56,7 +56,7 @@ When using flags, the CLI will display which options were provided and only prom
|
|
|
56
56
|
|
|
57
57
|
What you'll get is a Vite application that uses TanStack Router. All the files will still be in the same place as in CRA, but you'll get a fully functional Router setup under in `app/main.tsx`.
|
|
58
58
|
|
|
59
|
-
`create-
|
|
59
|
+
`create-start-app` is everything you loved about CRA but implemented with modern tools and best practices, on top of the popular TanStack set of libraries. Which includes [@tanstack/react-query](https://tanstack.com/query/latest) and [@tanstack/react-router](https://tanstack.com/router/latest).
|
|
60
60
|
|
|
61
61
|
## Routing Options
|
|
62
62
|
|
|
@@ -67,7 +67,7 @@ File Based Routing is the default option when using the interactive CLI. The loc
|
|
|
67
67
|
To explicitly choose File Based Routing, use:
|
|
68
68
|
|
|
69
69
|
```bash
|
|
70
|
-
npx create-
|
|
70
|
+
npx create-start-app@latest my-app --template file-router
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
### Code Based Routing
|
|
@@ -75,7 +75,7 @@ npx create-tsrouter-app@latest my-app --template file-router
|
|
|
75
75
|
If you prefer traditional code-based routing, you can select it in the interactive CLI or specify it by using either the `typescript` or `javascript` template:
|
|
76
76
|
|
|
77
77
|
```bash
|
|
78
|
-
npx create-
|
|
78
|
+
npx create-start-app@latest my-app --template typescript
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
## Additional Configuration
|
|
@@ -107,7 +107,7 @@ Setting this flag to `biome` will configure it as your toolchain of choice, addi
|
|
|
107
107
|
You can enable add-on selection:
|
|
108
108
|
|
|
109
109
|
```bash
|
|
110
|
-
npx create-
|
|
110
|
+
npx create-start-app@latest --add-ons
|
|
111
111
|
```
|
|
112
112
|
|
|
113
113
|
This will prompt you to select the add-ons you want to enable during application creation.
|
|
@@ -115,29 +115,29 @@ This will prompt you to select the add-ons you want to enable during application
|
|
|
115
115
|
You can enable specific add-ons directly by adding a comma separated list of add-on names to the `--add-ons` flag. For example:
|
|
116
116
|
|
|
117
117
|
```bash
|
|
118
|
-
npx create-
|
|
118
|
+
npx create-start-app@latest my-app --add-ons shadcn,tanstack-query
|
|
119
119
|
```
|
|
120
120
|
|
|
121
121
|
You can get a list of all available add-ons by running:
|
|
122
122
|
|
|
123
123
|
```bash
|
|
124
|
-
npx create-
|
|
124
|
+
npx create-start-app@latest --list-add-ons
|
|
125
125
|
```
|
|
126
126
|
|
|
127
127
|
This will display a list of all available add-ons for React that are compatible with the Code Router.
|
|
128
128
|
|
|
129
129
|
```bash
|
|
130
|
-
npx create-
|
|
130
|
+
npx create-start-app@latest --list-add-ons --framework solid --template file-router
|
|
131
131
|
```
|
|
132
132
|
|
|
133
133
|
Will get you a list of all available add-ons for Solid that are compatible with the File Router.
|
|
134
134
|
|
|
135
135
|
## MCP (Model Context Protocol) Support (experimental)
|
|
136
136
|
|
|
137
|
-
You can launch the `create-
|
|
137
|
+
You can launch the `create-start-app` CLI with the `--mcp` flag to enable MCP support. Use this in your MCP enabled IDE to allow the Agent model to generate TanStack Router applications.
|
|
138
138
|
|
|
139
139
|
```bash
|
|
140
|
-
npx create-
|
|
140
|
+
npx create-start-app@latest --mcp
|
|
141
141
|
```
|
|
142
142
|
|
|
143
143
|
Shown below is the configuration for MCP support in Cursor.
|
package/dist/create-app.js
CHANGED
|
@@ -290,7 +290,7 @@ export async function createApp(options, { silent = false, environment, }) {
|
|
|
290
290
|
await copyFilesRecursively(environment, addOnDir, targetDir, async (file, targetFileName) => templateFile(addOnDir, file, targetFileName));
|
|
291
291
|
}
|
|
292
292
|
if (addOn.command) {
|
|
293
|
-
await environment.execute(addOn.command.command, addOn.command.args || [], targetDir);
|
|
293
|
+
await environment.execute(addOn.command.command, addOn.command.args || [], resolve(targetDir));
|
|
294
294
|
}
|
|
295
295
|
s?.stop(`${addOn.name} setup complete`);
|
|
296
296
|
}
|
|
@@ -306,7 +306,7 @@ export async function createApp(options, { silent = false, environment, }) {
|
|
|
306
306
|
}
|
|
307
307
|
if (shadcnComponents.size > 0) {
|
|
308
308
|
s?.start(`Installing shadcn components (${Array.from(shadcnComponents).join(', ')})...`);
|
|
309
|
-
await environment.execute('npx', ['shadcn@canary', 'add', ...shadcnComponents], targetDir);
|
|
309
|
+
await environment.execute('npx', ['shadcn@canary', 'add', '--force', ...shadcnComponents], resolve(targetDir));
|
|
310
310
|
s?.stop(`Installed additional shadcn components`);
|
|
311
311
|
}
|
|
312
312
|
}
|
|
@@ -400,7 +400,7 @@ export async function createApp(options, { silent = false, environment, }) {
|
|
|
400
400
|
await templateFile(templateDirBase, 'README.md.ejs');
|
|
401
401
|
// Install dependencies
|
|
402
402
|
s?.start(`Installing dependencies via ${options.packageManager}...`);
|
|
403
|
-
await environment.execute(options.packageManager, ['install'], targetDir);
|
|
403
|
+
await environment.execute(options.packageManager, ['install'], resolve(targetDir));
|
|
404
404
|
s?.stop(`Installed dependencies`);
|
|
405
405
|
if (warnings.length > 0) {
|
|
406
406
|
if (!silent) {
|
|
@@ -412,17 +412,17 @@ export async function createApp(options, { silent = false, environment, }) {
|
|
|
412
412
|
switch (options.packageManager) {
|
|
413
413
|
case 'pnpm':
|
|
414
414
|
// pnpm automatically forwards extra arguments
|
|
415
|
-
await environment.execute(options.packageManager, ['run', 'check', '--fix'], targetDir);
|
|
415
|
+
await environment.execute(options.packageManager, ['run', 'check', '--fix'], resolve(targetDir));
|
|
416
416
|
break;
|
|
417
417
|
default:
|
|
418
|
-
await environment.execute(options.packageManager, ['run', 'check', '--', '--fix'], targetDir);
|
|
418
|
+
await environment.execute(options.packageManager, ['run', 'check', '--', '--fix'], resolve(targetDir));
|
|
419
419
|
break;
|
|
420
420
|
}
|
|
421
421
|
s?.stop(`Applied toolchain ${options.toolchain}...`);
|
|
422
422
|
}
|
|
423
423
|
if (options.git) {
|
|
424
424
|
s?.start(`Initializing git repository...`);
|
|
425
|
-
await environment.execute('git', ['init'], targetDir);
|
|
425
|
+
await environment.execute('git', ['init'], resolve(targetDir));
|
|
426
426
|
s?.stop(`Initialized git repository`);
|
|
427
427
|
}
|
|
428
428
|
environment.finishRun();
|
package/package.json
CHANGED
package/src/create-app.ts
CHANGED
|
@@ -463,7 +463,7 @@ export async function createApp(
|
|
|
463
463
|
await environment.execute(
|
|
464
464
|
addOn.command.command,
|
|
465
465
|
addOn.command.args || [],
|
|
466
|
-
targetDir,
|
|
466
|
+
resolve(targetDir),
|
|
467
467
|
)
|
|
468
468
|
}
|
|
469
469
|
|
|
@@ -487,8 +487,8 @@ export async function createApp(
|
|
|
487
487
|
)
|
|
488
488
|
await environment.execute(
|
|
489
489
|
'npx',
|
|
490
|
-
['shadcn@canary', 'add', ...shadcnComponents],
|
|
491
|
-
targetDir,
|
|
490
|
+
['shadcn@canary', 'add', '--force', ...shadcnComponents],
|
|
491
|
+
resolve(targetDir),
|
|
492
492
|
)
|
|
493
493
|
s?.stop(`Installed additional shadcn components`)
|
|
494
494
|
}
|
|
@@ -658,7 +658,11 @@ export async function createApp(
|
|
|
658
658
|
|
|
659
659
|
// Install dependencies
|
|
660
660
|
s?.start(`Installing dependencies via ${options.packageManager}...`)
|
|
661
|
-
await environment.execute(
|
|
661
|
+
await environment.execute(
|
|
662
|
+
options.packageManager,
|
|
663
|
+
['install'],
|
|
664
|
+
resolve(targetDir),
|
|
665
|
+
)
|
|
662
666
|
s?.stop(`Installed dependencies`)
|
|
663
667
|
|
|
664
668
|
if (warnings.length > 0) {
|
|
@@ -675,14 +679,14 @@ export async function createApp(
|
|
|
675
679
|
await environment.execute(
|
|
676
680
|
options.packageManager,
|
|
677
681
|
['run', 'check', '--fix'],
|
|
678
|
-
targetDir,
|
|
682
|
+
resolve(targetDir),
|
|
679
683
|
)
|
|
680
684
|
break
|
|
681
685
|
default:
|
|
682
686
|
await environment.execute(
|
|
683
687
|
options.packageManager,
|
|
684
688
|
['run', 'check', '--', '--fix'],
|
|
685
|
-
targetDir,
|
|
689
|
+
resolve(targetDir),
|
|
686
690
|
)
|
|
687
691
|
break
|
|
688
692
|
}
|
|
@@ -691,7 +695,7 @@ export async function createApp(
|
|
|
691
695
|
|
|
692
696
|
if (options.git) {
|
|
693
697
|
s?.start(`Initializing git repository...`)
|
|
694
|
-
await environment.execute('git', ['init'], targetDir)
|
|
698
|
+
await environment.execute('git', ['init'], resolve(targetDir))
|
|
695
699
|
s?.stop(`Initialized git repository`)
|
|
696
700
|
}
|
|
697
701
|
|