@tanstack/create 0.68.1 → 0.68.2
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/CHANGELOG.md +6 -0
- package/dist/create-app.js +22 -0
- package/dist/frameworks/react/project/base/_dot_gitignore +0 -1
- package/dist/frameworks/react/project/base/package.json +1 -0
- package/dist/frameworks/react/project/base/tsr.config.json +3 -0
- package/dist/frameworks/react/project/packages.json +3 -0
- package/dist/frameworks/solid/project/base/_dot_gitignore +0 -1
- package/dist/frameworks/solid/project/base/package.json +1 -0
- package/dist/frameworks/solid/project/base/tsr.config.json +3 -0
- package/dist/frameworks/solid/project/packages.json +3 -0
- package/package.json +1 -1
- package/src/create-app.ts +32 -1
- package/src/frameworks/react/project/base/_dot_gitignore +0 -1
- package/src/frameworks/react/project/base/package.json +1 -0
- package/src/frameworks/react/project/base/tsr.config.json +3 -0
- package/src/frameworks/react/project/packages.json +3 -0
- package/src/frameworks/solid/project/base/_dot_gitignore +0 -1
- package/src/frameworks/solid/project/base/package.json +1 -0
- package/src/frameworks/solid/project/base/tsr.config.json +3 -0
- package/src/frameworks/solid/project/packages.json +3 -0
- package/tests/create-app.test.ts +39 -3
- package/tests/framework-template.test.ts +21 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @tanstack/create
|
|
2
2
|
|
|
3
|
+
## 0.68.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Keep the generated route tree tracked in new React and Solid apps and run route generation once during scaffold. ([#464](https://github.com/TanStack/cli/pull/464))
|
|
8
|
+
|
|
3
9
|
## 0.68.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/create-app.js
CHANGED
|
@@ -202,6 +202,28 @@ async function runCommandsAndInstallDependencies(environment, options) {
|
|
|
202
202
|
}
|
|
203
203
|
await installShadcnComponents(environment, options.targetDir, options);
|
|
204
204
|
await setupIntent(environment, options.targetDir, options);
|
|
205
|
+
if (shouldGenerateRoutes(options)) {
|
|
206
|
+
s.start(`Generating route tree...`);
|
|
207
|
+
const command = getPackageManagerScriptCommand(options.packageManager, [
|
|
208
|
+
'generate-routes',
|
|
209
|
+
]);
|
|
210
|
+
const cmd = formatCommand(command);
|
|
211
|
+
environment.startStep({
|
|
212
|
+
id: 'generate-routes',
|
|
213
|
+
type: 'command',
|
|
214
|
+
message: cmd,
|
|
215
|
+
});
|
|
216
|
+
await environment.execute(command.command, command.args, options.targetDir, {
|
|
217
|
+
inherit: true,
|
|
218
|
+
});
|
|
219
|
+
environment.finishStep('generate-routes', 'Route tree generated');
|
|
220
|
+
s.stop(`Route tree generated`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function shouldGenerateRoutes(options) {
|
|
224
|
+
return (options.install !== false &&
|
|
225
|
+
options.mode === 'file-router' &&
|
|
226
|
+
(options.framework.id === 'react' || options.framework.id === 'solid'));
|
|
205
227
|
}
|
|
206
228
|
async function seedEnvValues(environment, options) {
|
|
207
229
|
const envVarValues = options.envVarValues || {};
|
package/package.json
CHANGED
package/src/create-app.ts
CHANGED
|
@@ -31,7 +31,7 @@ function stripExamplesFromOptions(options: Options): Options {
|
|
|
31
31
|
!isDemoFilePath(route.path) &&
|
|
32
32
|
!(route.url && route.url.startsWith('/demo')),
|
|
33
33
|
)
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
const filteredIntegrations = (addOn.integrations || []).filter(
|
|
36
36
|
(integration) => !isDemoFilePath(integration.path)
|
|
37
37
|
)
|
|
@@ -277,6 +277,37 @@ async function runCommandsAndInstallDependencies(
|
|
|
277
277
|
await installShadcnComponents(environment, options.targetDir, options)
|
|
278
278
|
|
|
279
279
|
await setupIntent(environment, options.targetDir, options)
|
|
280
|
+
|
|
281
|
+
if (shouldGenerateRoutes(options)) {
|
|
282
|
+
s.start(`Generating route tree...`)
|
|
283
|
+
const command = getPackageManagerScriptCommand(options.packageManager, [
|
|
284
|
+
'generate-routes',
|
|
285
|
+
])
|
|
286
|
+
const cmd = formatCommand(command)
|
|
287
|
+
environment.startStep({
|
|
288
|
+
id: 'generate-routes',
|
|
289
|
+
type: 'command',
|
|
290
|
+
message: cmd,
|
|
291
|
+
})
|
|
292
|
+
await environment.execute(
|
|
293
|
+
command.command,
|
|
294
|
+
command.args,
|
|
295
|
+
options.targetDir,
|
|
296
|
+
{
|
|
297
|
+
inherit: true,
|
|
298
|
+
},
|
|
299
|
+
)
|
|
300
|
+
environment.finishStep('generate-routes', 'Route tree generated')
|
|
301
|
+
s.stop(`Route tree generated`)
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function shouldGenerateRoutes(options: Options) {
|
|
306
|
+
return (
|
|
307
|
+
options.install !== false &&
|
|
308
|
+
options.mode === 'file-router' &&
|
|
309
|
+
(options.framework.id === 'react' || options.framework.id === 'solid')
|
|
310
|
+
)
|
|
280
311
|
}
|
|
281
312
|
|
|
282
313
|
async function seedEnvValues(environment: Environment, options: Options) {
|
package/tests/create-app.test.ts
CHANGED
|
@@ -4,8 +4,7 @@ import { resolve } from 'node:path'
|
|
|
4
4
|
import { createApp } from '../src/create-app.js'
|
|
5
5
|
|
|
6
6
|
import { createMemoryEnvironment } from '../src/environment.js'
|
|
7
|
-
import {
|
|
8
|
-
import { AddOn, Options } from '../src/types.js'
|
|
7
|
+
import type { AddOn, Options } from '../src/types.js'
|
|
9
8
|
|
|
10
9
|
const simpleOptions = {
|
|
11
10
|
projectName: 'test',
|
|
@@ -43,7 +42,7 @@ const simpleOptions = {
|
|
|
43
42
|
packageManager: 'pnpm',
|
|
44
43
|
typescript: true,
|
|
45
44
|
tailwind: true,
|
|
46
|
-
mode:
|
|
45
|
+
mode: 'file-router',
|
|
47
46
|
variableValues: {},
|
|
48
47
|
} as unknown as Options
|
|
49
48
|
|
|
@@ -88,6 +87,43 @@ describe('createApp', () => {
|
|
|
88
87
|
expect(output.commands.some(({ command }) => command === 'echo')).toBe(true)
|
|
89
88
|
})
|
|
90
89
|
|
|
90
|
+
it.each(['react', 'solid'])(
|
|
91
|
+
'generates routes for %s file-router apps after install',
|
|
92
|
+
async (frameworkId) => {
|
|
93
|
+
const { environment, output } = createMemoryEnvironment()
|
|
94
|
+
await createApp(environment, {
|
|
95
|
+
...simpleOptions,
|
|
96
|
+
framework: {
|
|
97
|
+
...simpleOptions.framework,
|
|
98
|
+
id: frameworkId,
|
|
99
|
+
},
|
|
100
|
+
install: true,
|
|
101
|
+
} as Options)
|
|
102
|
+
|
|
103
|
+
expect(output.commands).toContainEqual({
|
|
104
|
+
command: 'pnpm',
|
|
105
|
+
args: ['generate-routes'],
|
|
106
|
+
})
|
|
107
|
+
},
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
it('skips route generation when dependency install is skipped', async () => {
|
|
111
|
+
const { environment, output } = createMemoryEnvironment()
|
|
112
|
+
await createApp(environment, {
|
|
113
|
+
...simpleOptions,
|
|
114
|
+
framework: {
|
|
115
|
+
...simpleOptions.framework,
|
|
116
|
+
id: 'react',
|
|
117
|
+
},
|
|
118
|
+
install: false,
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
expect(output.commands).not.toContainEqual({
|
|
122
|
+
command: 'pnpm',
|
|
123
|
+
args: ['generate-routes'],
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
|
|
91
127
|
it('should create an app - with a add-on', async () => {
|
|
92
128
|
const { environment, output } = createMemoryEnvironment()
|
|
93
129
|
await createApp(environment, {
|
|
@@ -7,9 +7,28 @@ describe('framework templates', () => {
|
|
|
7
7
|
it.each([
|
|
8
8
|
['React', createReactFrameworkDefinition],
|
|
9
9
|
['Solid', createSolidFrameworkDefinition],
|
|
10
|
-
])(
|
|
10
|
+
])(
|
|
11
|
+
'%s gitignore does not exclude the generated route tree',
|
|
12
|
+
(_, createDefinition) => {
|
|
13
|
+
const framework = createDefinition()
|
|
14
|
+
|
|
15
|
+
expect(framework.base._dot_gitignore).not.toContain(
|
|
16
|
+
'src/routeTree.gen.ts',
|
|
17
|
+
)
|
|
18
|
+
},
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
it.each([
|
|
22
|
+
['React', createReactFrameworkDefinition],
|
|
23
|
+
['Solid', createSolidFrameworkDefinition],
|
|
24
|
+
])('%s includes route generation tooling', (_, createDefinition) => {
|
|
11
25
|
const framework = createDefinition()
|
|
12
26
|
|
|
13
|
-
expect(framework.base.
|
|
27
|
+
expect(framework.base['package.json']).toContain(
|
|
28
|
+
'"generate-routes": "tsr generate"',
|
|
29
|
+
)
|
|
30
|
+
expect(
|
|
31
|
+
framework.optionalPackages['file-router'].devDependencies,
|
|
32
|
+
).toHaveProperty('@tanstack/router-cli')
|
|
14
33
|
})
|
|
15
34
|
})
|