@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.
@@ -1,7 +1,7 @@
1
1
  import { config } from "dotenv";
2
2
  import { defineConfig } from 'drizzle-kit';
3
3
 
4
- config();
4
+ config({ path: ['.env.local', '.env'] });
5
5
 
6
6
  export default defineConfig({
7
7
  out: "./drizzle",
@@ -1,27 +1,10 @@
1
- import { config } from 'dotenv'
2
- <% if (addOnOption.drizzle.database === 'postgresql') { %>
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
- import { drizzle } from 'drizzle-orm/mysql2';
7
- import mysql from 'mysql2/promise';
4
+ 'drizzle-orm/mysql2';
8
5
  <% } else if (addOnOption.drizzle.database === 'sqlite') {%>
9
- import { drizzle } from 'drizzle-orm/better-sqlite3';
10
- import Database from 'better-sqlite3';
6
+ 'drizzle-orm/better-sqlite3';
11
7
  <% } %>
12
8
  import * as schema from './schema.ts'
13
9
 
14
- config()
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('id').primaryKey(),
7
- title: text('title').notNull(),
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('id').primaryKey().autoincrement(),
17
- title: text('title').notNull(),
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('id', { mode: 'number' }).primaryKey({
27
+ id: integer({ mode: 'number' }).primaryKey({
28
28
  autoIncrement: true }),
29
- title: text('title').notNull(),
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.39.0",
4
- "drizzle-kit": "^0.30.0"<% if (addOnOption.drizzle.database === 'postgresql') { %>,
5
- "pg": "^8.11.0"<% } %><% if (addOnOption.drizzle.database === 'mysql') { %>,
6
- "mysql2": "^3.6.0"<% } %><% if (addOnOption.drizzle.database === 'sqlite') { %>,
7
- "better-sqlite3": "^9.4.0"<% } %>
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 === 'postgresql') { %>
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": {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "dependencies": {
3
- "@module-federation/vite": "^1.1.9"
3
+ "@module-federation/vite": "^1.9.4"
4
4
  }
5
5
  }
@@ -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 };
@@ -1,5 +1,3 @@
1
- import { contentChecksum } from './checksum.js';
2
1
  import type { FrameworkDefinition } from '@tanstack/cta-engine';
3
2
  export declare function createFrameworkDefinition(): FrameworkDefinition;
4
3
  export declare function register(): void;
5
- export { contentChecksum };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "scripts": {
3
- "deploy": "wrangler deploy"
3
+ "deploy": "npm run build && wrangler deploy"
4
4
  },
5
5
  "dependencies": {
6
6
  "@cloudflare/vite-plugin": "^1.13.8"
@@ -2,5 +2,6 @@
2
2
  command = "vite build"
3
3
  dir = "dist/client"
4
4
  [dev]
5
- command = "vite dev"
6
- port = 3000
5
+ command = "npm run dev"
6
+ targetPort = 3000
7
+ port = 8888
@@ -1,5 +1,5 @@
1
1
  {
2
- "dependencies": {
3
- "@netlify/vite-plugin-tanstack-start": "^1.0.2"
2
+ "devDependencies": {
3
+ "@netlify/vite-plugin-tanstack-start": "^1.2.3"
4
4
  }
5
5
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@tanstack/cta-framework-react-cra",
3
- "version": "0.41.2",
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.41.2"
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 Wrap: (props: { children: React.ReactNode }) => {\n return (\n <TanstackQuery.Provider {...rqContext}>\n {props.children}\n </TanstackQuery.Provider>\n )\n },\n })\n\n setupRouterSsrQueryIntegration({ router, queryClient: rqContext.queryClient })\n\n return router\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 })\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
@@ -1,3 +0,0 @@
1
- // This file is auto-generated. Do not edit manually.
2
- // Generated from add-ons, examples, hosts, project, and toolchains directories
3
- export const contentChecksum = 'b722b3f8235cbf4618c508da1b499a8a6a583d8107eebeb9e2ffe19716ddc7e9';
@@ -1 +0,0 @@
1
- export declare const contentChecksum = "b722b3f8235cbf4618c508da1b499a8a6a583d8107eebeb9e2ffe19716ddc7e9";
package/src/checksum.ts DELETED
@@ -1,3 +0,0 @@
1
- // This file is auto-generated. Do not edit manually.
2
- // Generated from add-ons, examples, hosts, project, and toolchains directories
3
- export const contentChecksum = 'b722b3f8235cbf4618c508da1b499a8a6a583d8107eebeb9e2ffe19716ddc7e9'