@tanstack/cta-framework-react-cra 0.41.2 → 0.43.1
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/add-ons/drizzle/assets/drizzle.config.ts.ejs +1 -1
- package/add-ons/drizzle/assets/src/db/index.ts.ejs +5 -22
- package/add-ons/drizzle/assets/src/db/schema.ts.ejs +6 -6
- package/add-ons/drizzle/package.json.ejs +7 -9
- package/add-ons/module-federation/package.json +1 -1
- package/add-ons/prisma/package.json.ejs +1 -1
- package/add-ons/start/assets/src/router.tsx.ejs +0 -7
- package/dist/index.js +0 -3
- package/dist/types/index.d.ts +0 -2
- package/hosts/cloudflare/package.json +1 -1
- package/hosts/netlify/assets/netlify.toml +3 -2
- package/hosts/netlify/package.json +2 -2
- package/package.json +9 -4
- package/src/index.ts +0 -5
- package/tests/snapshots/react-cra/cr-ts-start-tanstack-query-npm.json +1 -1
- package/dist/checksum.js +0 -3
- package/dist/types/checksum.d.ts +0 -1
- package/src/checksum.ts +0 -3
|
@@ -1,27 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { drizzle } from 'drizzle-orm/node-postgres';
|
|
4
|
-
import { Pool } from 'pg';
|
|
1
|
+
import { drizzle } from <% if (addOnOption.drizzle.database === 'postgresql') { %>
|
|
2
|
+
'drizzle-orm/node-postgres';
|
|
5
3
|
<% } else if (addOnOption.drizzle.database === 'mysql') {%>
|
|
6
|
-
|
|
7
|
-
import mysql from 'mysql2/promise';
|
|
4
|
+
'drizzle-orm/mysql2';
|
|
8
5
|
<% } else if (addOnOption.drizzle.database === 'sqlite') {%>
|
|
9
|
-
|
|
10
|
-
import Database from 'better-sqlite3';
|
|
6
|
+
'drizzle-orm/better-sqlite3';
|
|
11
7
|
<% } %>
|
|
12
8
|
import * as schema from './schema.ts'
|
|
13
9
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<% if (addOnOption.drizzle.database === 'sqlite') { %>
|
|
17
|
-
const sqlite = new Database(process.env.DATABASE_URL!);
|
|
18
|
-
export const db = drizzle(sqlite, { schema });
|
|
19
|
-
<% } else if (addOnOption.drizzle.database === 'postgresql') { %>
|
|
20
|
-
const pool = new Pool({
|
|
21
|
-
connectionString: process.env.DATABASE_URL!,
|
|
22
|
-
});
|
|
23
|
-
export const db = drizzle(pool, { schema });
|
|
24
|
-
<% } else if (addOnOption.drizzle.database === 'mysql') { %>
|
|
25
|
-
const connection = await mysql.createConnection(process.env.DATABASE_URL!);
|
|
26
|
-
export const db = drizzle(connection, { schema });
|
|
27
|
-
<% } %>
|
|
10
|
+
export const db = drizzle(process.env.DATABASE_URL!, { schema<% if (addOnOption.drizzle.database === 'mysql') {%>, mode: 'default'<% } %>});
|
|
@@ -3,8 +3,8 @@ import { pgTable, serial, text, timestamp } from
|
|
|
3
3
|
'drizzle-orm/pg-core';
|
|
4
4
|
|
|
5
5
|
export const todos = pgTable('todos', {
|
|
6
|
-
id: serial(
|
|
7
|
-
title: text(
|
|
6
|
+
id: serial().primaryKey(),
|
|
7
|
+
title: text().notNull(),
|
|
8
8
|
createdAt: timestamp('created_at').defaultNow(),
|
|
9
9
|
});
|
|
10
10
|
<% } else if (addOnOption.drizzle.database === 'mysql') {
|
|
@@ -13,8 +13,8 @@ import { mysqlTable, int, text, timestamp } from
|
|
|
13
13
|
'drizzle-orm/mysql-core';
|
|
14
14
|
|
|
15
15
|
export const todos = mysqlTable('todos', {
|
|
16
|
-
id: int(
|
|
17
|
-
title: text(
|
|
16
|
+
id: int().primaryKey().autoincrement(),
|
|
17
|
+
title: text().notNull(),
|
|
18
18
|
createdAt: timestamp('created_at', { mode: 'date' }).defaultNow(),
|
|
19
19
|
});
|
|
20
20
|
<% } else if (addOnOption.drizzle.database === 'sqlite') {
|
|
@@ -24,9 +24,9 @@ import { sqliteTable, integer, text } from
|
|
|
24
24
|
import { sql } from 'drizzle-orm';
|
|
25
25
|
|
|
26
26
|
export const todos = sqliteTable('todos', {
|
|
27
|
-
id: integer(
|
|
27
|
+
id: integer({ mode: 'number' }).primaryKey({
|
|
28
28
|
autoIncrement: true }),
|
|
29
|
-
title: text(
|
|
29
|
+
title: text().notNull(),
|
|
30
30
|
createdAt: integer('created_at', { mode: 'timestamp' }).default(sql`(unixepoch())`),
|
|
31
31
|
});
|
|
32
32
|
<% } %>
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"drizzle-orm": "^0.
|
|
4
|
-
"drizzle-kit": "^0.
|
|
5
|
-
"pg": "^8.
|
|
6
|
-
"mysql2": "^3.
|
|
7
|
-
"better-sqlite3": "^
|
|
3
|
+
"drizzle-orm": "^0.45.0",
|
|
4
|
+
"drizzle-kit": "^0.31.8"<% if (addOnOption.drizzle.database === 'postgresql') { %>,
|
|
5
|
+
"pg": "^8.16.3"<% } %><% if (addOnOption.drizzle.database === 'mysql') { %>,
|
|
6
|
+
"mysql2": "^3.15.3"<% } %><% if (addOnOption.drizzle.database === 'sqlite') { %>,
|
|
7
|
+
"better-sqlite3": "^12.5.0"<% } %>
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
10
|
"dotenv": "^16.0.0",
|
|
11
|
-
"tsx": "^4.0.0"
|
|
12
|
-
<% if (addOnOption.drizzle.database === '
|
|
13
|
-
"@types/pg": "^8.10.0"<% } %><% if (addOnOption.drizzle.database === 'mysql') { %>
|
|
14
|
-
"@types/mysql2": "^3.6.0"<% } %><% if (addOnOption.drizzle.database === 'sqlite') { %>
|
|
11
|
+
"tsx": "^4.0.0"<% if (addOnOption.drizzle.database === 'postgresql') { %>,
|
|
12
|
+
"@types/pg": "^8.15.6"<% } %><% if (addOnOption.drizzle.database === 'sqlite') { %>,
|
|
15
13
|
"@types/better-sqlite3": "^7.6.0"<% } %>
|
|
16
14
|
},
|
|
17
15
|
"scripts": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"tsx": "^4.20.6"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {<% if (addOnOption.prisma.database === 'postgres') { %>
|
|
14
|
-
"post-cta-init": "npx create-db@latest",<% } %>
|
|
14
|
+
"post-cta-init": "npx create-db@latest --user-agent tanstack/tsrouter",<% } %>
|
|
15
15
|
"db:generate": "dotenv -e .env.local -- prisma generate",
|
|
16
16
|
"db:push": "dotenv -e .env.local -- prisma db push",
|
|
17
17
|
"db:migrate": "dotenv -e .env.local -- prisma migrate dev",
|
|
@@ -18,13 +18,6 @@ export const getRouter = () => {
|
|
|
18
18
|
routeTree,
|
|
19
19
|
context: { ...rqContext },
|
|
20
20
|
defaultPreload: "intent",
|
|
21
|
-
Wrap: (props: { children: React.ReactNode }) => {
|
|
22
|
-
return (
|
|
23
|
-
<TanstackQuery.Provider {...rqContext}>
|
|
24
|
-
{props.children}
|
|
25
|
-
</TanstackQuery.Provider>
|
|
26
|
-
);
|
|
27
|
-
},
|
|
28
21
|
})
|
|
29
22
|
|
|
30
23
|
setupRouterSsrQueryIntegration({router, queryClient: rqContext.queryClient})
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { dirname, join } from 'node:path';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
3
|
import { registerFramework, scanAddOnDirectories, scanProjectDirectory, } from '@tanstack/cta-engine';
|
|
4
|
-
import { contentChecksum } from './checksum.js';
|
|
5
4
|
export function createFrameworkDefinition() {
|
|
6
5
|
const baseDirectory = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
7
6
|
const addOns = scanAddOnDirectories([
|
|
@@ -32,10 +31,8 @@ export function createFrameworkDefinition() {
|
|
|
32
31
|
forceTypescript: true,
|
|
33
32
|
},
|
|
34
33
|
},
|
|
35
|
-
contentChecksum,
|
|
36
34
|
};
|
|
37
35
|
}
|
|
38
36
|
export function register() {
|
|
39
37
|
registerFramework(createFrameworkDefinition());
|
|
40
38
|
}
|
|
41
|
-
export { contentChecksum };
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/cta-framework-react-cra",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.1",
|
|
4
4
|
"description": "CTA Framework for React (Create React App)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/types/index.d.ts",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/TanStack/create-tsrouter-app.git"
|
|
10
|
+
"url": "git+https://github.com/TanStack/create-tsrouter-app.git"
|
|
11
11
|
},
|
|
12
12
|
"homepage": "https://tanstack.com/router",
|
|
13
13
|
"funding": {
|
|
@@ -23,12 +23,17 @@
|
|
|
23
23
|
"author": "Jack Herrington <jherr@pobox.com>",
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@tanstack/cta-engine": "0.
|
|
26
|
+
"@tanstack/cta-engine": "0.43.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^24.6.0",
|
|
30
30
|
"typescript": "^5.6.3",
|
|
31
31
|
"vitest": "^3.1.1"
|
|
32
32
|
},
|
|
33
|
-
"scripts": {
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc",
|
|
35
|
+
"dev": "tsc --watch",
|
|
36
|
+
"test": "eslint ./src && vitest run",
|
|
37
|
+
"test:watch": "vitest"
|
|
38
|
+
}
|
|
34
39
|
}
|
package/src/index.ts
CHANGED
|
@@ -7,8 +7,6 @@ import {
|
|
|
7
7
|
scanProjectDirectory,
|
|
8
8
|
} from '@tanstack/cta-engine'
|
|
9
9
|
|
|
10
|
-
import { contentChecksum } from './checksum.js'
|
|
11
|
-
|
|
12
10
|
import type { FrameworkDefinition } from '@tanstack/cta-engine'
|
|
13
11
|
|
|
14
12
|
export function createFrameworkDefinition(): FrameworkDefinition {
|
|
@@ -47,12 +45,9 @@ export function createFrameworkDefinition(): FrameworkDefinition {
|
|
|
47
45
|
forceTypescript: true,
|
|
48
46
|
},
|
|
49
47
|
},
|
|
50
|
-
contentChecksum,
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
50
|
|
|
54
51
|
export function register() {
|
|
55
52
|
registerFramework(createFrameworkDefinition())
|
|
56
53
|
}
|
|
57
|
-
|
|
58
|
-
export { contentChecksum }
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"/src/data/demo.punk-songs.ts": "import { createServerFn } from '@tanstack/react-start'\n\nexport const getPunkSongs = createServerFn({\n method: 'GET',\n}).handler(async () => [\n { id: 1, name: 'Teenage Dirtbag', artist: 'Wheatus' },\n { id: 2, name: 'Smells Like Teen Spirit', artist: 'Nirvana' },\n { id: 3, name: 'The Middle', artist: 'Jimmy Eat World' },\n { id: 4, name: 'My Own Worst Enemy', artist: 'Lit' },\n { id: 5, name: 'Fat Lip', artist: 'Sum 41' },\n { id: 6, name: 'All the Small Things', artist: 'blink-182' },\n { id: 7, name: 'Beverly Hills', artist: 'Weezer' },\n])\n",
|
|
10
10
|
"/src/integrations/tanstack-query/devtools.tsx": "import { ReactQueryDevtoolsPanel } from '@tanstack/react-query-devtools'\n\nexport default {\n name: 'Tanstack Query',\n render: <ReactQueryDevtoolsPanel />,\n}\n",
|
|
11
11
|
"/src/integrations/tanstack-query/root-provider.tsx": "import { QueryClient, QueryClientProvider } from '@tanstack/react-query'\n\nexport function getContext() {\n const queryClient = new QueryClient()\n return {\n queryClient,\n }\n}\n\nexport function Provider({\n children,\n queryClient,\n}: {\n children: React.ReactNode\n queryClient: QueryClient\n}) {\n return (\n <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>\n )\n}\n",
|
|
12
|
-
"/src/router.tsx": "import { createRouter } from '@tanstack/react-router'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'\nimport * as TanstackQuery from './integrations/tanstack-query/root-provider'\n\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\n\n// Create a new router instance\nexport const getRouter = () => {\n const rqContext = TanstackQuery.getContext()\n\n const router = createRouter({\n routeTree,\n context: { ...rqContext },\n defaultPreload: 'intent',\n
|
|
12
|
+
"/src/router.tsx": "import { createRouter } from '@tanstack/react-router'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'\nimport * as TanstackQuery from './integrations/tanstack-query/root-provider'\n\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\n\n// Create a new router instance\nexport const getRouter = () => {\n const rqContext = TanstackQuery.getContext()\n\n const router = createRouter({\n routeTree,\n context: { ...rqContext },\n defaultPreload: 'intent',\n })\n\n setupRouterSsrQueryIntegration({ router, queryClient: rqContext.queryClient })\n\n return router\n}\n",
|
|
13
13
|
"/src/routes/__root.tsx": "import {\n HeadContent,\n Scripts,\n createRootRouteWithContext,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'\nimport { TanStackDevtools } from '@tanstack/react-devtools'\n\nimport Header from '../components/Header'\n\nimport TanStackQueryDevtools from '../integrations/tanstack-query/devtools'\n\nimport appCss from '../styles.css?url'\n\nimport type { QueryClient } from '@tanstack/react-query'\n\ninterface MyRouterContext {\n queryClient: QueryClient\n}\n\nexport const Route = createRootRouteWithContext<MyRouterContext>()({\n head: () => ({\n meta: [\n {\n charSet: 'utf-8',\n },\n {\n name: 'viewport',\n content: 'width=device-width, initial-scale=1',\n },\n {\n title: 'TanStack Start Starter',\n },\n ],\n links: [\n {\n rel: 'stylesheet',\n href: appCss,\n },\n ],\n }),\n\n shellComponent: RootDocument,\n})\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n return (\n <html lang=\"en\">\n <head>\n <HeadContent />\n </head>\n <body>\n <Header />\n {children}\n <TanStackDevtools\n config={{\n position: 'bottom-right',\n }}\n plugins={[\n {\n name: 'Tanstack Router',\n render: <TanStackRouterDevtoolsPanel />,\n },\n TanStackQueryDevtools,\n ]}\n />\n <Scripts />\n </body>\n </html>\n )\n}\n",
|
|
14
14
|
"/src/routes/demo/api.names.ts": "import { createFileRoute } from '@tanstack/react-router'\nimport { json } from '@tanstack/react-start'\n\nexport const Route = createFileRoute('/demo/api/names')({\n server: {\n handlers: {\n GET: () => json(['Alice', 'Bob', 'Charlie']),\n },\n },\n})\n",
|
|
15
15
|
"/src/routes/demo/api.tq-todos.ts": "import { createFileRoute } from '@tanstack/react-router'\n\nconst todos = [\n {\n id: 1,\n name: 'Buy groceries',\n },\n {\n id: 2,\n name: 'Buy mobile phone',\n },\n {\n id: 3,\n name: 'Buy laptop',\n },\n]\n\nexport const Route = createFileRoute('/demo/api/tq-todos')({\n server: {\n handlers: {\n GET: () => {\n return Response.json(todos)\n },\n POST: async ({ request }) => {\n const name = await request.json()\n const todo = {\n id: todos.length + 1,\n name,\n }\n todos.push(todo)\n return Response.json(todo)\n },\n },\n },\n})\n",
|
package/dist/checksum.js
DELETED
package/dist/types/checksum.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const contentChecksum = "b722b3f8235cbf4618c508da1b499a8a6a583d8107eebeb9e2ffe19716ddc7e9";
|
package/src/checksum.ts
DELETED