@tanstack/create 0.61.3 → 0.61.4
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 +16 -0
- package/dist/frameworks/react/project/base/_dot_gitignore +0 -1
- package/dist/frameworks/react/project/base/index.html.ejs +13 -0
- package/dist/frameworks/react/project/base/src/main.tsx.ejs +24 -0
- package/dist/frameworks/react/project/base/src/routes/__root.tsx.ejs +31 -0
- package/dist/frameworks/react/project/base/vite.config.ts.ejs +6 -2
- package/dist/frameworks/solid/project/base/_dot_gitignore +0 -1
- package/dist/frameworks/solid/project/base/index.html.ejs +13 -0
- package/dist/frameworks/solid/project/base/src/main.tsx.ejs +23 -0
- package/dist/frameworks/solid/project/base/src/routes/__root.tsx.ejs +20 -0
- package/dist/frameworks/solid/project/base/vite.config.ts.ejs +6 -2
- package/dist/package-json.js +20 -0
- package/dist/template-file.js +1 -0
- package/dist/types/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/frameworks/react/project/base/_dot_gitignore +0 -1
- package/src/frameworks/react/project/base/index.html.ejs +13 -0
- package/src/frameworks/react/project/base/src/main.tsx.ejs +24 -0
- package/src/frameworks/react/project/base/src/routes/__root.tsx.ejs +31 -0
- package/src/frameworks/react/project/base/vite.config.ts.ejs +6 -2
- package/src/frameworks/solid/project/base/_dot_gitignore +0 -1
- package/src/frameworks/solid/project/base/index.html.ejs +13 -0
- package/src/frameworks/solid/project/base/src/main.tsx.ejs +23 -0
- package/src/frameworks/solid/project/base/src/routes/__root.tsx.ejs +20 -0
- package/src/frameworks/solid/project/base/vite.config.ts.ejs +6 -2
- package/src/package-json.ts +24 -0
- package/src/template-file.ts +1 -0
- package/src/types.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @tanstack/create
|
|
2
2
|
|
|
3
|
+
## 0.61.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Update the React Paraglide Vite plugin strategy to include `baseLocale` alongside `url`, preventing missing-locale routing/rendering errors in generated apps. ([`164522e`](https://github.com/TanStack/cli/commit/164522e444188e83710fc599304132de8cb379e6))
|
|
8
|
+
|
|
9
|
+
- Improve CLI compatibility and scaffold behavior for legacy router-first workflows. ([`2949819`](https://github.com/TanStack/cli/commit/2949819058b4d4b1760be683ef29bfd459ddb28b))
|
|
10
|
+
|
|
11
|
+
- Add safer target directory handling by warning before creating into non-empty folders.
|
|
12
|
+
- Support explicit git initialization control via `--git` and `--no-git`.
|
|
13
|
+
- Restore router-only compatibility mode with file-based routing templates (without Start-dependent add-ons/deployments/starters), while still allowing toolchains.
|
|
14
|
+
- Default `create-tsrouter-app` to router-only compatibility mode.
|
|
15
|
+
- Remove stale `count.txt` ignore entries from base templates.
|
|
16
|
+
|
|
17
|
+
Also expands starter documentation with clearer creation, maintenance, UI usage, and banner guidance.
|
|
18
|
+
|
|
3
19
|
## 0.61.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<% if (!routerOnly) { ignoreFile() } %>
|
|
2
|
+
<!doctype html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title><%= projectName %></title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<% if (!routerOnly) { ignoreFile() } %>
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import ReactDOM from 'react-dom/client'
|
|
4
|
+
import { RouterProvider, createRouter } from '@tanstack/react-router'
|
|
5
|
+
import { routeTree } from './routeTree.gen'
|
|
6
|
+
|
|
7
|
+
const router = createRouter({
|
|
8
|
+
routeTree,
|
|
9
|
+
defaultPreload: 'intent',
|
|
10
|
+
scrollRestoration: true,
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
declare module '@tanstack/react-router' {
|
|
14
|
+
interface Register {
|
|
15
|
+
router: typeof router
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const rootElement = document.getElementById('app')!
|
|
20
|
+
|
|
21
|
+
if (!rootElement.innerHTML) {
|
|
22
|
+
const root = ReactDOM.createRoot(rootElement)
|
|
23
|
+
root.render(<RouterProvider router={router} />)
|
|
24
|
+
}
|
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
<% if (routerOnly) { %>
|
|
2
|
+
import { Outlet, createRootRoute } from '@tanstack/react-router'
|
|
3
|
+
import { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'
|
|
4
|
+
import { TanStackDevtools } from '@tanstack/react-devtools'
|
|
5
|
+
|
|
6
|
+
import '../styles.css'
|
|
7
|
+
|
|
8
|
+
export const Route = createRootRoute({
|
|
9
|
+
component: RootComponent,
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
function RootComponent() {
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<Outlet />
|
|
16
|
+
<TanStackDevtools
|
|
17
|
+
config={{
|
|
18
|
+
position: 'bottom-right',
|
|
19
|
+
}}
|
|
20
|
+
plugins={[
|
|
21
|
+
{
|
|
22
|
+
name: 'TanStack Router',
|
|
23
|
+
render: <TanStackRouterDevtoolsPanel />,
|
|
24
|
+
},
|
|
25
|
+
]}
|
|
26
|
+
/>
|
|
27
|
+
</>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
<% } else { %>
|
|
1
31
|
<% let hasContext = addOnEnabled["apollo-client"] || addOnEnabled["tanstack-query"]; %>
|
|
2
32
|
import {
|
|
3
33
|
HeadContent, Scripts, <% if (hasContext) { %>createRootRouteWithContext<% } else { %>createRootRoute<% } %> } from '@tanstack/react-router'
|
|
@@ -93,3 +123,4 @@ function RootDocument({ children }: { children: React.ReactNode }) {
|
|
|
93
123
|
</html>
|
|
94
124
|
)
|
|
95
125
|
}
|
|
126
|
+
<% } %>
|
|
@@ -4,7 +4,11 @@ import tsconfigPaths from 'vite-tsconfig-paths'
|
|
|
4
4
|
<% if (addOnEnabled.paraglide) { -%>
|
|
5
5
|
import { paraglideVitePlugin } from "@inlang/paraglide-js"
|
|
6
6
|
<% } -%>
|
|
7
|
+
<% if (routerOnly) { %>
|
|
8
|
+
import { tanstackRouter } from '@tanstack/router-plugin/vite'
|
|
9
|
+
<% } else { %>
|
|
7
10
|
import { tanstackStart } from '@tanstack/react-start/plugin/vite';
|
|
11
|
+
<% } %>
|
|
8
12
|
import viteReact from '@vitejs/plugin-react'
|
|
9
13
|
import tailwindcss from "@tailwindcss/vite"
|
|
10
14
|
<% for(const integration of integrations.filter(i => i.type === 'vite-plugin')) { %><%- integrationImportContent(integration) %>
|
|
@@ -14,11 +18,11 @@ const config = defineConfig({
|
|
|
14
18
|
plugins: [devtools(), <% if (addOnEnabled.paraglide) { %>paraglideVitePlugin({
|
|
15
19
|
project: './project.inlang',
|
|
16
20
|
outdir: './src/paraglide',
|
|
17
|
-
strategy: ['url'],
|
|
21
|
+
strategy: ['url', "baseLocale"],
|
|
18
22
|
}), <% } %><% for(const integration of integrations.filter(i => i.type === 'vite-plugin')) { %><%- integrationImportCode(integration) %>,<% } %>
|
|
19
23
|
tsconfigPaths({ projects: ['./tsconfig.json'] }),
|
|
20
24
|
tailwindcss(),
|
|
21
|
-
tanstackStart()
|
|
25
|
+
<% if (routerOnly) { %>tanstackRouter({ target: 'react', autoCodeSplitting: true }),<% } else { %>tanstackStart(),<% } %>
|
|
22
26
|
viteReact(<% if (addOnEnabled.compiler) { %>{
|
|
23
27
|
babel: {
|
|
24
28
|
plugins: ["babel-plugin-react-compiler"],
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<% if (!routerOnly) { ignoreFile() } %>
|
|
2
|
+
<!doctype html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title><%= projectName %></title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<% if (!routerOnly) { ignoreFile() } %>
|
|
2
|
+
import { render } from 'solid-js/web'
|
|
3
|
+
import { RouterProvider, createRouter } from '@tanstack/solid-router'
|
|
4
|
+
import { routeTree } from './routeTree.gen'
|
|
5
|
+
|
|
6
|
+
const router = createRouter({
|
|
7
|
+
routeTree,
|
|
8
|
+
defaultPreload: 'intent',
|
|
9
|
+
defaultPreloadStaleTime: 0,
|
|
10
|
+
scrollRestoration: true,
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
declare module '@tanstack/solid-router' {
|
|
14
|
+
interface Register {
|
|
15
|
+
router: typeof router
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const rootElement = document.getElementById('app')!
|
|
20
|
+
|
|
21
|
+
if (!rootElement.innerHTML) {
|
|
22
|
+
render(() => <RouterProvider router={router} />, rootElement)
|
|
23
|
+
}
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
<% if (routerOnly) { %>
|
|
2
|
+
import { Outlet, createRootRoute } from '@tanstack/solid-router'
|
|
3
|
+
import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'
|
|
4
|
+
|
|
5
|
+
import '../styles.css'
|
|
6
|
+
|
|
7
|
+
export const Route = createRootRoute({
|
|
8
|
+
component: RootComponent,
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
function RootComponent() {
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<Outlet />
|
|
15
|
+
<TanStackRouterDevtools position="bottom-right" />
|
|
16
|
+
</>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
<% } else { %>
|
|
1
20
|
import { HeadContent, Outlet, Scripts, createRootRouteWithContext } from '@tanstack/solid-router'
|
|
2
21
|
import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'
|
|
3
22
|
|
|
@@ -47,3 +66,4 @@ function RootComponent() {
|
|
|
47
66
|
</html>
|
|
48
67
|
);
|
|
49
68
|
}
|
|
69
|
+
<% } %>
|
|
@@ -2,7 +2,11 @@ import { defineConfig } from "vite";
|
|
|
2
2
|
import { devtools } from '@tanstack/devtools-vite'
|
|
3
3
|
import viteTsConfigPaths from 'vite-tsconfig-paths'
|
|
4
4
|
import tailwindcss from "@tailwindcss/vite"
|
|
5
|
+
<% if (routerOnly) { %>
|
|
6
|
+
import { tanstackRouter } from '@tanstack/router-plugin/vite'
|
|
7
|
+
<% } else { %>
|
|
5
8
|
import { tanstackStart } from "@tanstack/solid-start/plugin/vite";
|
|
9
|
+
<% } %>
|
|
6
10
|
import solidPlugin from 'vite-plugin-solid';
|
|
7
11
|
<% for(const integration of integrations.filter(i => i.type === 'vite-plugin')) { %><%- integrationImportContent(integration) %>
|
|
8
12
|
<% } %>
|
|
@@ -15,7 +19,7 @@ export default defineConfig({
|
|
|
15
19
|
projects: ['./tsconfig.json'],
|
|
16
20
|
}),
|
|
17
21
|
tailwindcss(),
|
|
18
|
-
tanstackStart()
|
|
19
|
-
solidPlugin({ ssr: true }),
|
|
22
|
+
<% if (routerOnly) { %>tanstackRouter({ target: 'solid', autoCodeSplitting: true }),<% } else { %>tanstackStart(),<% } %>
|
|
23
|
+
solidPlugin(<% if (!routerOnly) { %>{ ssr: true }<% } %>),
|
|
20
24
|
],
|
|
21
25
|
})
|
package/dist/package-json.js
CHANGED
|
@@ -49,6 +49,7 @@ export function createPackageJSON(options) {
|
|
|
49
49
|
jsx: 'tsx',
|
|
50
50
|
fileRouter: options.mode === 'file-router',
|
|
51
51
|
codeRouter: options.mode === 'code-router',
|
|
52
|
+
routerOnly: options.routerOnly === true,
|
|
52
53
|
addOnEnabled: options.chosenAddOns.reduce((acc, addon) => {
|
|
53
54
|
acc[addon.id] = true;
|
|
54
55
|
return acc;
|
|
@@ -71,6 +72,25 @@ export function createPackageJSON(options) {
|
|
|
71
72
|
if (options.starter) {
|
|
72
73
|
packageJSON = mergePackageJSON(packageJSON, options.starter.packageAdditions);
|
|
73
74
|
}
|
|
75
|
+
if (options.routerOnly) {
|
|
76
|
+
if (options.framework.id === 'react-cra') {
|
|
77
|
+
delete packageJSON.dependencies?.['@tanstack/react-start'];
|
|
78
|
+
delete packageJSON.dependencies?.['@tanstack/react-router-ssr-query'];
|
|
79
|
+
packageJSON.devDependencies = {
|
|
80
|
+
...(packageJSON.devDependencies ?? {}),
|
|
81
|
+
'@tanstack/router-plugin': packageJSON.devDependencies?.['@tanstack/router-plugin'] ?? '^1.132.0',
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (options.framework.id === 'solid') {
|
|
85
|
+
delete packageJSON.dependencies?.['@tanstack/solid-start'];
|
|
86
|
+
delete packageJSON.dependencies?.['@tanstack/solid-router-ssr-query'];
|
|
87
|
+
delete packageJSON.scripts?.start;
|
|
88
|
+
packageJSON.devDependencies = {
|
|
89
|
+
...(packageJSON.devDependencies ?? {}),
|
|
90
|
+
'@tanstack/router-plugin': packageJSON.devDependencies?.['@tanstack/router-plugin'] ?? '^1.133.20',
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
74
94
|
packageJSON.dependencies = sortObject((packageJSON.dependencies ?? {}));
|
|
75
95
|
packageJSON.devDependencies = sortObject((packageJSON.devDependencies ?? {}));
|
|
76
96
|
return packageJSON;
|
package/dist/template-file.js
CHANGED
|
@@ -82,6 +82,7 @@ export function createTemplateFile(environment, options) {
|
|
|
82
82
|
jsx: 'tsx',
|
|
83
83
|
fileRouter: options.mode === 'file-router',
|
|
84
84
|
codeRouter: options.mode === 'code-router',
|
|
85
|
+
routerOnly: options.routerOnly === true,
|
|
85
86
|
addOnEnabled,
|
|
86
87
|
addOnOption: options.addOnOptions,
|
|
87
88
|
addOns: options.chosenAddOns,
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1274,6 +1274,7 @@ export interface Options {
|
|
|
1274
1274
|
chosenAddOns: Array<AddOn>;
|
|
1275
1275
|
addOnOptions: Record<string, Record<string, any>>;
|
|
1276
1276
|
starter?: Starter | undefined;
|
|
1277
|
+
routerOnly?: boolean;
|
|
1277
1278
|
}
|
|
1278
1279
|
export type SerializedOptions = Omit<Options, 'chosenAddOns' | 'starter' | 'framework'> & {
|
|
1279
1280
|
chosenAddOns: Array<string>;
|
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<% if (!routerOnly) { ignoreFile() } %>
|
|
2
|
+
<!doctype html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title><%= projectName %></title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<% if (!routerOnly) { ignoreFile() } %>
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import ReactDOM from 'react-dom/client'
|
|
4
|
+
import { RouterProvider, createRouter } from '@tanstack/react-router'
|
|
5
|
+
import { routeTree } from './routeTree.gen'
|
|
6
|
+
|
|
7
|
+
const router = createRouter({
|
|
8
|
+
routeTree,
|
|
9
|
+
defaultPreload: 'intent',
|
|
10
|
+
scrollRestoration: true,
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
declare module '@tanstack/react-router' {
|
|
14
|
+
interface Register {
|
|
15
|
+
router: typeof router
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const rootElement = document.getElementById('app')!
|
|
20
|
+
|
|
21
|
+
if (!rootElement.innerHTML) {
|
|
22
|
+
const root = ReactDOM.createRoot(rootElement)
|
|
23
|
+
root.render(<RouterProvider router={router} />)
|
|
24
|
+
}
|
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
<% if (routerOnly) { %>
|
|
2
|
+
import { Outlet, createRootRoute } from '@tanstack/react-router'
|
|
3
|
+
import { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'
|
|
4
|
+
import { TanStackDevtools } from '@tanstack/react-devtools'
|
|
5
|
+
|
|
6
|
+
import '../styles.css'
|
|
7
|
+
|
|
8
|
+
export const Route = createRootRoute({
|
|
9
|
+
component: RootComponent,
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
function RootComponent() {
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<Outlet />
|
|
16
|
+
<TanStackDevtools
|
|
17
|
+
config={{
|
|
18
|
+
position: 'bottom-right',
|
|
19
|
+
}}
|
|
20
|
+
plugins={[
|
|
21
|
+
{
|
|
22
|
+
name: 'TanStack Router',
|
|
23
|
+
render: <TanStackRouterDevtoolsPanel />,
|
|
24
|
+
},
|
|
25
|
+
]}
|
|
26
|
+
/>
|
|
27
|
+
</>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
<% } else { %>
|
|
1
31
|
<% let hasContext = addOnEnabled["apollo-client"] || addOnEnabled["tanstack-query"]; %>
|
|
2
32
|
import {
|
|
3
33
|
HeadContent, Scripts, <% if (hasContext) { %>createRootRouteWithContext<% } else { %>createRootRoute<% } %> } from '@tanstack/react-router'
|
|
@@ -93,3 +123,4 @@ function RootDocument({ children }: { children: React.ReactNode }) {
|
|
|
93
123
|
</html>
|
|
94
124
|
)
|
|
95
125
|
}
|
|
126
|
+
<% } %>
|
|
@@ -4,7 +4,11 @@ import tsconfigPaths from 'vite-tsconfig-paths'
|
|
|
4
4
|
<% if (addOnEnabled.paraglide) { -%>
|
|
5
5
|
import { paraglideVitePlugin } from "@inlang/paraglide-js"
|
|
6
6
|
<% } -%>
|
|
7
|
+
<% if (routerOnly) { %>
|
|
8
|
+
import { tanstackRouter } from '@tanstack/router-plugin/vite'
|
|
9
|
+
<% } else { %>
|
|
7
10
|
import { tanstackStart } from '@tanstack/react-start/plugin/vite';
|
|
11
|
+
<% } %>
|
|
8
12
|
import viteReact from '@vitejs/plugin-react'
|
|
9
13
|
import tailwindcss from "@tailwindcss/vite"
|
|
10
14
|
<% for(const integration of integrations.filter(i => i.type === 'vite-plugin')) { %><%- integrationImportContent(integration) %>
|
|
@@ -14,11 +18,11 @@ const config = defineConfig({
|
|
|
14
18
|
plugins: [devtools(), <% if (addOnEnabled.paraglide) { %>paraglideVitePlugin({
|
|
15
19
|
project: './project.inlang',
|
|
16
20
|
outdir: './src/paraglide',
|
|
17
|
-
strategy: ['url'],
|
|
21
|
+
strategy: ['url', "baseLocale"],
|
|
18
22
|
}), <% } %><% for(const integration of integrations.filter(i => i.type === 'vite-plugin')) { %><%- integrationImportCode(integration) %>,<% } %>
|
|
19
23
|
tsconfigPaths({ projects: ['./tsconfig.json'] }),
|
|
20
24
|
tailwindcss(),
|
|
21
|
-
tanstackStart()
|
|
25
|
+
<% if (routerOnly) { %>tanstackRouter({ target: 'react', autoCodeSplitting: true }),<% } else { %>tanstackStart(),<% } %>
|
|
22
26
|
viteReact(<% if (addOnEnabled.compiler) { %>{
|
|
23
27
|
babel: {
|
|
24
28
|
plugins: ["babel-plugin-react-compiler"],
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<% if (!routerOnly) { ignoreFile() } %>
|
|
2
|
+
<!doctype html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title><%= projectName %></title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<% if (!routerOnly) { ignoreFile() } %>
|
|
2
|
+
import { render } from 'solid-js/web'
|
|
3
|
+
import { RouterProvider, createRouter } from '@tanstack/solid-router'
|
|
4
|
+
import { routeTree } from './routeTree.gen'
|
|
5
|
+
|
|
6
|
+
const router = createRouter({
|
|
7
|
+
routeTree,
|
|
8
|
+
defaultPreload: 'intent',
|
|
9
|
+
defaultPreloadStaleTime: 0,
|
|
10
|
+
scrollRestoration: true,
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
declare module '@tanstack/solid-router' {
|
|
14
|
+
interface Register {
|
|
15
|
+
router: typeof router
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const rootElement = document.getElementById('app')!
|
|
20
|
+
|
|
21
|
+
if (!rootElement.innerHTML) {
|
|
22
|
+
render(() => <RouterProvider router={router} />, rootElement)
|
|
23
|
+
}
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
<% if (routerOnly) { %>
|
|
2
|
+
import { Outlet, createRootRoute } from '@tanstack/solid-router'
|
|
3
|
+
import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'
|
|
4
|
+
|
|
5
|
+
import '../styles.css'
|
|
6
|
+
|
|
7
|
+
export const Route = createRootRoute({
|
|
8
|
+
component: RootComponent,
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
function RootComponent() {
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<Outlet />
|
|
15
|
+
<TanStackRouterDevtools position="bottom-right" />
|
|
16
|
+
</>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
<% } else { %>
|
|
1
20
|
import { HeadContent, Outlet, Scripts, createRootRouteWithContext } from '@tanstack/solid-router'
|
|
2
21
|
import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'
|
|
3
22
|
|
|
@@ -47,3 +66,4 @@ function RootComponent() {
|
|
|
47
66
|
</html>
|
|
48
67
|
);
|
|
49
68
|
}
|
|
69
|
+
<% } %>
|
|
@@ -2,7 +2,11 @@ import { defineConfig } from "vite";
|
|
|
2
2
|
import { devtools } from '@tanstack/devtools-vite'
|
|
3
3
|
import viteTsConfigPaths from 'vite-tsconfig-paths'
|
|
4
4
|
import tailwindcss from "@tailwindcss/vite"
|
|
5
|
+
<% if (routerOnly) { %>
|
|
6
|
+
import { tanstackRouter } from '@tanstack/router-plugin/vite'
|
|
7
|
+
<% } else { %>
|
|
5
8
|
import { tanstackStart } from "@tanstack/solid-start/plugin/vite";
|
|
9
|
+
<% } %>
|
|
6
10
|
import solidPlugin from 'vite-plugin-solid';
|
|
7
11
|
<% for(const integration of integrations.filter(i => i.type === 'vite-plugin')) { %><%- integrationImportContent(integration) %>
|
|
8
12
|
<% } %>
|
|
@@ -15,7 +19,7 @@ export default defineConfig({
|
|
|
15
19
|
projects: ['./tsconfig.json'],
|
|
16
20
|
}),
|
|
17
21
|
tailwindcss(),
|
|
18
|
-
tanstackStart()
|
|
19
|
-
solidPlugin({ ssr: true }),
|
|
22
|
+
<% if (routerOnly) { %>tanstackRouter({ target: 'solid', autoCodeSplitting: true }),<% } else { %>tanstackStart(),<% } %>
|
|
23
|
+
solidPlugin(<% if (!routerOnly) { %>{ ssr: true }<% } %>),
|
|
20
24
|
],
|
|
21
25
|
})
|
package/src/package-json.ts
CHANGED
|
@@ -63,6 +63,7 @@ export function createPackageJSON(options: Options) {
|
|
|
63
63
|
jsx: 'tsx',
|
|
64
64
|
fileRouter: options.mode === 'file-router',
|
|
65
65
|
codeRouter: options.mode === 'code-router',
|
|
66
|
+
routerOnly: options.routerOnly === true,
|
|
66
67
|
addOnEnabled: options.chosenAddOns.reduce<Record<string, boolean>>(
|
|
67
68
|
(acc, addon) => {
|
|
68
69
|
acc[addon.id] = true
|
|
@@ -97,6 +98,29 @@ export function createPackageJSON(options: Options) {
|
|
|
97
98
|
)
|
|
98
99
|
}
|
|
99
100
|
|
|
101
|
+
if (options.routerOnly) {
|
|
102
|
+
if (options.framework.id === 'react-cra') {
|
|
103
|
+
delete packageJSON.dependencies?.['@tanstack/react-start']
|
|
104
|
+
delete packageJSON.dependencies?.['@tanstack/react-router-ssr-query']
|
|
105
|
+
packageJSON.devDependencies = {
|
|
106
|
+
...(packageJSON.devDependencies ?? {}),
|
|
107
|
+
'@tanstack/router-plugin':
|
|
108
|
+
packageJSON.devDependencies?.['@tanstack/router-plugin'] ?? '^1.132.0',
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (options.framework.id === 'solid') {
|
|
113
|
+
delete packageJSON.dependencies?.['@tanstack/solid-start']
|
|
114
|
+
delete packageJSON.dependencies?.['@tanstack/solid-router-ssr-query']
|
|
115
|
+
delete packageJSON.scripts?.start
|
|
116
|
+
packageJSON.devDependencies = {
|
|
117
|
+
...(packageJSON.devDependencies ?? {}),
|
|
118
|
+
'@tanstack/router-plugin':
|
|
119
|
+
packageJSON.devDependencies?.['@tanstack/router-plugin'] ?? '^1.133.20',
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
100
124
|
packageJSON.dependencies = sortObject(
|
|
101
125
|
(packageJSON.dependencies ?? {}) as Record<string, string>,
|
|
102
126
|
)
|
package/src/template-file.ts
CHANGED
|
@@ -136,6 +136,7 @@ export function createTemplateFile(environment: Environment, options: Options) {
|
|
|
136
136
|
jsx: 'tsx',
|
|
137
137
|
fileRouter: options.mode === 'file-router',
|
|
138
138
|
codeRouter: options.mode === 'code-router',
|
|
139
|
+
routerOnly: options.routerOnly === true,
|
|
139
140
|
addOnEnabled,
|
|
140
141
|
addOnOption: options.addOnOptions,
|
|
141
142
|
addOns: options.chosenAddOns,
|