@tanstack/cta-framework-react-cra 0.36.1 → 0.37.0

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,10 +1,10 @@
1
1
  generator client {
2
- provider = "prisma-client-js"
2
+ provider = "prisma-client"
3
+ output = "../src/generated/prisma"
3
4
  }
4
5
 
5
6
  datasource db {
6
7
  provider = "<%= addOnOption.prisma.database === "postgres" ? "postgresql" : addOnOption.prisma.database %>"
7
- url = env("DATABASE_URL")
8
8
  }
9
9
 
10
10
  model Todo {
@@ -0,0 +1,51 @@
1
+ import { PrismaClient } from "../src/generated/prisma/client.js";
2
+
3
+ <% if (addOnOption.prisma.database === 'postgres') { %>
4
+ import { PrismaPg } from '@prisma/adapter-pg';
5
+
6
+ const adapter = new PrismaPg({
7
+ connectionString: process.env.DATABASE_URL!,
8
+ });<% } %>
9
+
10
+ <% if (addOnOption.prisma.database === 'mysql') { %>
11
+ import { PrismaMariaDb } from '@prisma/adapter-mariadb';
12
+ const adapter = new PrismaMariaDb({
13
+ host: "localhost",
14
+ port: 3306,
15
+ connectionLimit: 5
16
+ });<% } %>
17
+
18
+ <% if (addOnOption.prisma.database === 'sqlite') { %>
19
+ import { PrismaBetterSQLite3 } from '@prisma/adapter-better-sqlite3';
20
+ const adapter = new PrismaBetterSQLite3({
21
+ url: process.env.DATABASE_URL || 'file:./dev.db'
22
+ });<% } %>
23
+
24
+ const prisma = new PrismaClient({adapter})
25
+
26
+ async function main() {
27
+ console.log('🌱 Seeding database...')
28
+
29
+ // Clear existing todos
30
+ await prisma.todo.deleteMany()
31
+
32
+ // Create example todos
33
+ const todos = await prisma.todo.createMany({
34
+ data: [
35
+ { title: 'Buy groceries' },
36
+ { title: 'Read a book' },
37
+ { title: 'Workout' },
38
+ ],
39
+ })
40
+
41
+ console.log(`✅ Created ${todos.count} todos`)
42
+ }
43
+
44
+ main()
45
+ .catch((e) => {
46
+ console.error('❌ Error seeding database:', e)
47
+ process.exit(1)
48
+ })
49
+ .finally(async () => {
50
+ await prisma.$disconnect()
51
+ })
@@ -0,0 +1,13 @@
1
+ import { defineConfig, env } from 'prisma/config'
2
+
3
+ export default defineConfig({
4
+ schema: './prisma/schema.prisma',
5
+ migrations: {
6
+ path: './prisma/migrations',
7
+ seed: 'tsx prisma/seed.ts',
8
+ },
9
+ datasource: {
10
+ url: env('DATABASE_URL'),
11
+ },
12
+ });
13
+
@@ -0,0 +1,32 @@
1
+ import { PrismaClient } from './generated/prisma/client.js'
2
+
3
+ <% if (addOnOption.prisma.database === 'postgres') { %>
4
+ import { PrismaPg } from '@prisma/adapter-pg';
5
+
6
+ const adapter = new PrismaPg({
7
+ connectionString: process.env.DATABASE_URL!,
8
+ });<% } %>
9
+
10
+ <% if (addOnOption.prisma.database === 'mysql') { %>
11
+ import { PrismaMariaDb } from '@prisma/adapter-mariadb';
12
+ const adapter = new PrismaMariaDb({
13
+ host: "localhost",
14
+ port: 3306,
15
+ connectionLimit: 5
16
+ });<% } %>
17
+
18
+ <% if (addOnOption.prisma.database === 'sqlite') { %>
19
+ import { PrismaBetterSQLite3 } from '@prisma/adapter-better-sqlite3';
20
+ const adapter = new PrismaBetterSQLite3({
21
+ url: process.env.DATABASE_URL || 'file:./dev.db'
22
+ });<% } %>
23
+
24
+ declare global {
25
+ var __prisma: PrismaClient | undefined
26
+ }
27
+
28
+ export const prisma = globalThis.__prisma || new PrismaClient({ adapter })
29
+
30
+ if (process.env.NODE_ENV !== 'production') {
31
+ globalThis.__prisma = prisma
32
+ }
@@ -1,17 +1,14 @@
1
1
  {
2
2
  "dependencies": {
3
3
  "prisma": "^6.16.3",
4
- "@prisma/client": "^6.16.3"<% if (addOnOption.prisma.database === 'postgres') { %>,
5
- "pg": "^8.11.0"<% } %><% if (addOnOption.prisma.database === 'mysql') { %>,
6
- "mysql2": "^3.6.0"<% } %>
4
+ "@prisma/client": "^7.0.0"<% if (addOnOption.prisma.database === 'postgres') { %>,
5
+ "@prisma/adapter-pg": "^7.0.0"<% } %><% if (addOnOption.prisma.database === 'mysql') { %>,
6
+ "@prisma/adapter-mariadb": "^7.0.0"<% } %><% if (addOnOption.prisma.database === 'sqlite') { %>,
7
+ "@prisma/adapter-better-sqlite3": "^7.0.0"<% } %>
7
8
  },
8
9
  "devDependencies": {
9
10
  "dotenv-cli": "^10.0.0",
10
- "ts-node": "^10.9.2",
11
- <% if (addOnOption.prisma.database === 'postgres') { %>
12
- "@types/pg": "^8.10.0"<% } %><% if (addOnOption.prisma.database === 'mysql') { %>
13
- "@types/mysql2": "^3.6.0"<% } %><% if (addOnOption.prisma.database === 'sqlite') { %>
14
- "@types/better-sqlite3": "^7.6.0"<% } %>
11
+ "tsx": "^4.20.6"
15
12
  },
16
13
  "scripts": {<% if (addOnOption.prisma.database === 'postgres') { %>
17
14
  "post-cta-init": "npx create-db@latest",<% } %>
@@ -20,8 +17,5 @@
20
17
  "db:migrate": "dotenv -e .env.local -- prisma migrate dev",
21
18
  "db:studio": "dotenv -e .env.local -- prisma studio",
22
19
  "db:seed": "dotenv -e .env.local -- prisma db seed"
23
- },
24
- "prisma": {
25
- "seed": "ts-node seed.ts"
26
20
  }
27
- }
21
+ }
package/dist/checksum.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is auto-generated. Do not edit manually.
2
2
  // Generated from add-ons, examples, hosts, project, and toolchains directories
3
- export const contentChecksum = '22415a1abc64758541fdba06e79f1b24860e8100379e3a08c2cd0084f5ec26f9';
3
+ export const contentChecksum = '2b3e74e22202e202e179f9a6a55cec0b4a0cbdcf70c6debf7a900f3405cbfad7';
@@ -1 +1 @@
1
- export declare const contentChecksum = "22415a1abc64758541fdba06e79f1b24860e8100379e3a08c2cd0084f5ec26f9";
1
+ export declare const contentChecksum = "2b3e74e22202e202e179f9a6a55cec0b4a0cbdcf70c6debf7a900f3405cbfad7";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/cta-framework-react-cra",
3
- "version": "0.36.1",
3
+ "version": "0.37.0",
4
4
  "description": "CTA Framework for React (Create React App)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "author": "Jack Herrington <jherr@pobox.com>",
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
- "@tanstack/cta-engine": "0.36.0"
26
+ "@tanstack/cta-engine": "0.36.2"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^24.6.0",
package/src/checksum.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is auto-generated. Do not edit manually.
2
2
  // Generated from add-ons, examples, hosts, project, and toolchains directories
3
- export const contentChecksum = '22415a1abc64758541fdba06e79f1b24860e8100379e3a08c2cd0084f5ec26f9'
3
+ export const contentChecksum = '2b3e74e22202e202e179f9a6a55cec0b4a0cbdcf70c6debf7a900f3405cbfad7'
@@ -1,30 +0,0 @@
1
- import { PrismaClient } from '@prisma/client'
2
-
3
- const prisma = new PrismaClient()
4
-
5
- async function main() {
6
- console.log('🌱 Seeding database...')
7
-
8
- // Clear existing todos
9
- await prisma.todo.deleteMany()
10
-
11
- // Create example todos
12
- const todos = await prisma.todo.createMany({
13
- data: [
14
- { title: 'Buy groceries' },
15
- { title: 'Read a book' },
16
- { title: 'Workout' },
17
- ],
18
- })
19
-
20
- console.log(`✅ Created ${todos.count} todos`)
21
- }
22
-
23
- main()
24
- .catch((e) => {
25
- console.error('❌ Error seeding database:', e)
26
- process.exit(1)
27
- })
28
- .finally(async () => {
29
- await prisma.$disconnect()
30
- })
@@ -1,11 +0,0 @@
1
- import { PrismaClient } from '@prisma/client'
2
-
3
- declare global {
4
- var __prisma: PrismaClient | undefined
5
- }
6
-
7
- export const prisma = globalThis.__prisma || new PrismaClient()
8
-
9
- if (process.env.NODE_ENV !== 'production') {
10
- globalThis.__prisma = prisma
11
- }