@dartix-software-solutions/create-fullstack-app 2.0.12 → 2.0.14

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.
Files changed (84) hide show
  1. package/dist/backends/fastapi/templates/app/core/config.py.hbs +13 -13
  2. package/dist/backends/fastapi/templates/app/main.py.hbs +31 -31
  3. package/dist/backends/fastapi/templates/app/routers/health.py.hbs +8 -8
  4. package/dist/backends/fastapi/templates/app/routers/users.py.hbs +30 -30
  5. package/dist/backends/fastapi/templates/app/schemas/user.py.hbs +12 -12
  6. package/dist/backends/fastapi/templates/requirements.txt.hbs +6 -6
  7. package/dist/bin/create-fullstack-app.js +1 -1
  8. package/dist/{chunk-36CSXSDC.js → chunk-JQDTKR4K.js} +110 -43
  9. package/dist/databases/mongodb/templates/connection.ts.hbs +15 -15
  10. package/dist/databases/mongodb/templates/health-check.ts.hbs +11 -11
  11. package/dist/databases/mysql/templates/connection.ts.hbs +14 -14
  12. package/dist/databases/mysql/templates/health-check.ts.hbs +12 -12
  13. package/dist/databases/postgres/templates/connection.ts.hbs +14 -14
  14. package/dist/databases/postgres/templates/health-check.ts.hbs +12 -12
  15. package/dist/databases/redis/templates/connection.ts.hbs +14 -14
  16. package/dist/databases/redis/templates/health-check.ts.hbs +10 -10
  17. package/dist/databases/sqlite/templates/connection.ts.hbs +12 -12
  18. package/dist/databases/sqlite/templates/health-check.ts.hbs +10 -10
  19. package/dist/frontend-extras/react-table/templates/components/SampleTable.tsx.hbs +25 -25
  20. package/dist/frontend-extras/react-table/templates/data/sample-table-data.ts.hbs +4 -4
  21. package/dist/frontends/mobile/expo/templates/App.react-navigation.tsx.hbs +10 -10
  22. package/dist/frontends/mobile/expo/templates/app/(auth)/_layout.tsx.hbs +5 -5
  23. package/dist/frontends/mobile/expo/templates/app/(auth)/login.tsx.hbs +3 -3
  24. package/dist/frontends/mobile/expo/templates/app/(auth)/register.tsx.hbs +3 -3
  25. package/dist/frontends/mobile/expo/templates/app/(tabs)/_layout.tsx.hbs +11 -11
  26. package/dist/frontends/mobile/expo/templates/app/(tabs)/index.tsx.hbs +3 -3
  27. package/dist/frontends/mobile/expo/templates/app/(tabs)/profile.tsx.hbs +3 -3
  28. package/dist/frontends/mobile/expo/templates/app/(tabs)/settings.tsx.hbs +3 -3
  29. package/dist/frontends/mobile/expo/templates/app/+not-found.tsx.hbs +14 -14
  30. package/dist/frontends/mobile/expo/templates/app/_layout.tsx.hbs +11 -11
  31. package/dist/frontends/mobile/expo/templates/app/index.tsx.hbs +29 -29
  32. package/dist/frontends/mobile/expo/templates/types/router.ts.hbs +10 -10
  33. package/dist/frontends/mobile/react-native-cli/templates/app.json.hbs +4 -4
  34. package/dist/frontends/mobile/react-native-cli/templates/babel.config.js.hbs +14 -14
  35. package/dist/frontends/mobile/react-native-cli/templates/components/Avatar.tsx.hbs +29 -29
  36. package/dist/frontends/mobile/react-native-cli/templates/types/env.d.ts.hbs +3 -3
  37. package/dist/frontends/web/angular/templates/index.html.hbs +12 -12
  38. package/dist/frontends/web/angular/templates/main.ts.hbs +5 -5
  39. package/dist/frontends/web/angular/templates/pages/dashboard/dashboard.component.html.hbs +3 -3
  40. package/dist/frontends/web/angular/templates/pages/dashboard/dashboard.component.ts.hbs +10 -10
  41. package/dist/frontends/web/angular/templates/styles.css.hbs +11 -11
  42. package/dist/frontends/web/vue/templates/App.vue.hbs +9 -9
  43. package/dist/frontends/web/vue/templates/components/Layout.vue.hbs +17 -17
  44. package/dist/frontends/web/vue/templates/components/LoadingSpinner.vue.hbs +7 -7
  45. package/dist/frontends/web/vue/templates/components/Navbar.vue.hbs +24 -24
  46. package/dist/frontends/web/vue/templates/composables/useApi.ts.hbs +8 -8
  47. package/dist/frontends/web/vue/templates/composables/useAuth.ts.hbs +20 -20
  48. package/dist/frontends/web/vue/templates/env.d.ts.hbs +1 -1
  49. package/dist/frontends/web/vue/templates/index.html.hbs +12 -12
  50. package/dist/frontends/web/vue/templates/lib/config.ts.hbs +2 -2
  51. package/dist/frontends/web/vue/templates/main.ts.hbs +9 -9
  52. package/dist/frontends/web/vue/templates/pages/About.vue.hbs +6 -6
  53. package/dist/frontends/web/vue/templates/pages/Dashboard.vue.hbs +21 -21
  54. package/dist/frontends/web/vue/templates/pages/Home.vue.hbs +19 -19
  55. package/dist/frontends/web/vue/templates/pages/Login.vue.hbs +34 -34
  56. package/dist/frontends/web/vue/templates/pages/NotFound.vue.hbs +7 -7
  57. package/dist/frontends/web/vue/templates/router/index.ts.hbs +34 -34
  58. package/dist/frontends/web/vue/templates/stores/app.ts.hbs +8 -8
  59. package/dist/frontends/web/vue/templates/tsconfig.json.hbs +15 -15
  60. package/dist/frontends/web/vue/templates/vite.config.ts.hbs +6 -6
  61. package/dist/index.js +1 -1
  62. package/dist/orms/prisma/file-map.js +1 -0
  63. package/dist/orms/prisma/meta.js +5 -2
  64. package/dist/orms/prisma/templates/db-client.ts.hbs +10 -1
  65. package/dist/orms/prisma/templates/injection-module-import.hbs +1 -1
  66. package/dist/orms/prisma/templates/injection-module-register.hbs +1 -1
  67. package/dist/orms/prisma/templates/models/user.ts.hbs +3 -3
  68. package/dist/orms/prisma/templates/prisma.config.ts.hbs +12 -0
  69. package/dist/orms/prisma/templates/prisma.module.ts.hbs +9 -9
  70. package/dist/orms/prisma/templates/prisma.service.ts.hbs +24 -13
  71. package/dist/orms/prisma/templates/schema.prisma.hbs +0 -1
  72. package/dist/orms/prisma/templates/services/user.service.nestjs.ts.hbs +16 -16
  73. package/dist/orms/prisma/templates/services/user.service.ts.hbs +10 -10
  74. package/package.json +1 -1
  75. package/dist/plugins/devops/docker/templates/.dockerignore.hbs +0 -5
  76. package/dist/plugins/devops/gitlab-ci/templates/.gitlab-ci.yml.hbs +0 -14
  77. package/dist/plugins/devtools/eslint/templates/.eslintignore.hbs +0 -3
  78. package/dist/plugins/devtools/lint-staged/templates/.lintstagedrc.hbs +0 -5
  79. package/dist/plugins/devtools/prettier/templates/.prettierignore.hbs +0 -4
  80. package/dist/plugins/devtools/prettier/templates/.prettierrc.hbs +0 -6
  81. package/dist/plugins/mobile-navigation/expo-router/templates/.gitkeep +0 -0
  82. package/dist/plugins/testing/detox/templates/.detoxrc.js.hbs +0 -7
  83. package/dist/plugins/testing/maestro/templates/.maestro/home.yaml.hbs +0 -4
  84. package/dist/plugins/testing/maestro/templates/.maestro/login.yaml.hbs +0 -5
@@ -1,24 +1,24 @@
1
- <template>
2
- <header class="nav">
3
- <strong>{{projectName}}</strong>
4
- <nav>
5
- <RouterLink to="/">Home</RouterLink>
6
- <RouterLink to="/about">About</RouterLink>
7
- {{#if hasAuth}}
8
- <RouterLink to="/dashboard">Dashboard</RouterLink>
9
- <RouterLink to="/login">Login</RouterLink>
10
- {{/if}}
11
- </nav>
12
- </header>
13
- </template>
14
-
15
- <style scoped>
16
- .nav {
17
- border-bottom: 1px solid #e5e7eb;
18
- padding: 0.75rem 1.5rem;
19
- display: flex;
20
- gap: 1rem;
21
- align-items: center;
22
- }
23
- nav { display: flex; gap: 0.75rem; }
24
- </style>
1
+ <template>
2
+ <header class="nav">
3
+ <strong>{{projectName}}</strong>
4
+ <nav>
5
+ <RouterLink to="/">Home</RouterLink>
6
+ <RouterLink to="/about">About</RouterLink>
7
+ {{#if hasAuth}}
8
+ <RouterLink to="/dashboard">Dashboard</RouterLink>
9
+ <RouterLink to="/login">Login</RouterLink>
10
+ {{/if}}
11
+ </nav>
12
+ </header>
13
+ </template>
14
+
15
+ <style scoped>
16
+ .nav {
17
+ border-bottom: 1px solid #e5e7eb;
18
+ padding: 0.75rem 1.5rem;
19
+ display: flex;
20
+ gap: 1rem;
21
+ align-items: center;
22
+ }
23
+ nav { display: flex; gap: 0.75rem; }
24
+ </style>
@@ -1,8 +1,8 @@
1
- import { apiUrl } from '../lib/config';
2
-
3
- export async function apiGet<T>(path: string, init?: RequestInit): Promise<T> {
4
- const url = path.startsWith('http') ? path : `${apiUrl.replace(/\/$/, '')}/${path.replace(/^\//, '')}`;
5
- const res = await fetch(url, { ...init, headers: { Accept: 'application/json', ...init?.headers } });
6
- if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
7
- return (await res.json()) as T;
8
- }
1
+ import { apiUrl } from '../lib/config';
2
+
3
+ export async function apiGet<T>(path: string, init?: RequestInit): Promise<T> {
4
+ const url = path.startsWith('http') ? path : `${apiUrl.replace(/\/$/, '')}/${path.replace(/^\//, '')}`;
5
+ const res = await fetch(url, { ...init, headers: { Accept: 'application/json', ...init?.headers } });
6
+ if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
7
+ return (await res.json()) as T;
8
+ }
@@ -1,20 +1,20 @@
1
- import { computed, ref } from 'vue';
2
-
3
- const AUTH_KEY = 'auth_token';
4
- const tokenRef = ref<string | null>(typeof window === 'undefined' ? null : localStorage.getItem(AUTH_KEY));
5
-
6
- export function useAuth() {
7
- const isAuthenticated = computed(() => Boolean(tokenRef.value));
8
-
9
- function login(token: string) {
10
- tokenRef.value = token;
11
- localStorage.setItem(AUTH_KEY, token);
12
- }
13
-
14
- function logout() {
15
- tokenRef.value = null;
16
- localStorage.removeItem(AUTH_KEY);
17
- }
18
-
19
- return { token: tokenRef, isAuthenticated, login, logout };
20
- }
1
+ import { computed, ref } from 'vue';
2
+
3
+ const AUTH_KEY = 'auth_token';
4
+ const tokenRef = ref<string | null>(typeof window === 'undefined' ? null : localStorage.getItem(AUTH_KEY));
5
+
6
+ export function useAuth() {
7
+ const isAuthenticated = computed(() => Boolean(tokenRef.value));
8
+
9
+ function login(token: string) {
10
+ tokenRef.value = token;
11
+ localStorage.setItem(AUTH_KEY, token);
12
+ }
13
+
14
+ function logout() {
15
+ tokenRef.value = null;
16
+ localStorage.removeItem(AUTH_KEY);
17
+ }
18
+
19
+ return { token: tokenRef, isAuthenticated, login, logout };
20
+ }
@@ -1 +1 @@
1
- /// <reference types="vite/client" />
1
+ /// <reference types="vite/client" />
@@ -1,12 +1,12 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>{{projectName}}</title>
7
- </head>
8
- <body>
9
- <div id="app"></div>
10
- <script type="module" src="/src/main.ts"></script>
11
- </body>
12
- </html>
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>{{projectName}}</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="/src/main.ts"></script>
11
+ </body>
12
+ </html>
@@ -1,2 +1,2 @@
1
- export const appName = import.meta.env.VITE_APP_NAME ?? '{{projectName}}';
2
- export const apiUrl = import.meta.env.VITE_API_URL ?? 'http://localhost:3000';
1
+ export const appName = import.meta.env.VITE_APP_NAME ?? '{{projectName}}';
2
+ export const apiUrl = import.meta.env.VITE_API_URL ?? 'http://localhost:3000';
@@ -1,9 +1,9 @@
1
- import { createPinia } from 'pinia';
2
- import { createApp } from 'vue';
3
- import App from './App.vue';
4
- import router from './router';
5
-
6
- const app = createApp(App);
7
- app.use(createPinia());
8
- app.use(router);
9
- app.mount('#app');
1
+ import { createPinia } from 'pinia';
2
+ import { createApp } from 'vue';
3
+ import App from './App.vue';
4
+ import router from './router';
5
+
6
+ const app = createApp(App);
7
+ app.use(createPinia());
8
+ app.use(router);
9
+ app.mount('#app');
@@ -1,6 +1,6 @@
1
- <template>
2
- <section>
3
- <h1>About</h1>
4
- <p>This page was generated by your fullstack app scaffold.</p>
5
- </section>
6
- </template>
1
+ <template>
2
+ <section>
3
+ <h1>About</h1>
4
+ <p>This page was generated by your fullstack app scaffold.</p>
5
+ </section>
6
+ </template>
@@ -1,21 +1,21 @@
1
- <script setup lang="ts">
2
- import { useRouter } from 'vue-router';
3
- import { useAuth } from '../composables/useAuth';
4
-
5
- const router = useRouter();
6
- const { token, logout } = useAuth();
7
-
8
- function signOut() {
9
- logout();
10
- router.replace('/');
11
- }
12
- </script>
13
-
14
- <template>
15
- <section>
16
- <h1>Dashboard</h1>
17
- <p>You are signed in.</p>
18
- <pre>{{ token }}</pre>
19
- <button type="button" @click="signOut">Sign out</button>
20
- </section>
21
- </template>
1
+ <script setup lang="ts">
2
+ import { useRouter } from 'vue-router';
3
+ import { useAuth } from '../composables/useAuth';
4
+
5
+ const router = useRouter();
6
+ const { token, logout } = useAuth();
7
+
8
+ function signOut() {
9
+ logout();
10
+ router.replace('/');
11
+ }
12
+ </script>
13
+
14
+ <template>
15
+ <section>
16
+ <h1>Dashboard</h1>
17
+ <p>You are signed in.</p>
18
+ <pre>{{ token }}</pre>
19
+ <button type="button" @click="signOut">Sign out</button>
20
+ </section>
21
+ </template>
@@ -1,19 +1,19 @@
1
- <script setup lang="ts">
2
- import { apiUrl, appName } from '../lib/config';
3
- </script>
4
-
5
- <template>
6
- <section>
7
- <h1>Welcome to {{ "{{" }} appName {{ "}}" }}</h1>
8
- <p>Vue 3 + Vite starter.</p>
9
- <ul>
10
- <li><RouterLink to="/about">About</RouterLink></li>
11
- {{#if hasAuth}}
12
- <li><RouterLink to="/dashboard">Dashboard</RouterLink> (protected)</li>
13
- {{/if}}
14
- </ul>
15
- {{#if hasBackend}}
16
- <p>API base URL: <code>{{ "{{" }} apiUrl {{ "}}" }}</code></p>
17
- {{/if}}
18
- </section>
19
- </template>
1
+ <script setup lang="ts">
2
+ import { apiUrl, appName } from '../lib/config';
3
+ </script>
4
+
5
+ <template>
6
+ <section>
7
+ <h1>Welcome to {{ "{{" }} appName {{ "}}" }}</h1>
8
+ <p>Vue 3 + Vite starter.</p>
9
+ <ul>
10
+ <li><RouterLink to="/about">About</RouterLink></li>
11
+ {{#if hasAuth}}
12
+ <li><RouterLink to="/dashboard">Dashboard</RouterLink> (protected)</li>
13
+ {{/if}}
14
+ </ul>
15
+ {{#if hasBackend}}
16
+ <p>API base URL: <code>{{ "{{" }} apiUrl {{ "}}" }}</code></p>
17
+ {{/if}}
18
+ </section>
19
+ </template>
@@ -1,34 +1,34 @@
1
- <script setup lang="ts">
2
- import { ref } from 'vue';
3
- import { useRouter } from 'vue-router';
4
- import { useAuth } from '../composables/useAuth';
5
-
6
- const email = ref('');
7
- const error = ref<string | null>(null);
8
- const router = useRouter();
9
- const { login } = useAuth();
10
-
11
- function onSubmit() {
12
- error.value = null;
13
- if (!email.value.trim()) {
14
- error.value = 'Email is required';
15
- return;
16
- }
17
- login(`demo-token:${email.value.trim()}`);
18
- router.push('/dashboard');
19
- }
20
- </script>
21
-
22
- <template>
23
- <section>
24
- <h1>Sign in</h1>
25
- <form @submit.prevent="onSubmit">
26
- <label>
27
- Email
28
- <input v-model="email" type="email" autocomplete="email" required />
29
- </label>
30
- <button type="submit">Continue</button>
31
- </form>
32
- <p v-if="error" role="alert">{{ error }}</p>
33
- </section>
34
- </template>
1
+ <script setup lang="ts">
2
+ import { ref } from 'vue';
3
+ import { useRouter } from 'vue-router';
4
+ import { useAuth } from '../composables/useAuth';
5
+
6
+ const email = ref('');
7
+ const error = ref<string | null>(null);
8
+ const router = useRouter();
9
+ const { login } = useAuth();
10
+
11
+ function onSubmit() {
12
+ error.value = null;
13
+ if (!email.value.trim()) {
14
+ error.value = 'Email is required';
15
+ return;
16
+ }
17
+ login(`demo-token:${email.value.trim()}`);
18
+ router.push('/dashboard');
19
+ }
20
+ </script>
21
+
22
+ <template>
23
+ <section>
24
+ <h1>Sign in</h1>
25
+ <form @submit.prevent="onSubmit">
26
+ <label>
27
+ Email
28
+ <input v-model="email" type="email" autocomplete="email" required />
29
+ </label>
30
+ <button type="submit">Continue</button>
31
+ </form>
32
+ <p v-if="error" role="alert">{{ error }}</p>
33
+ </section>
34
+ </template>
@@ -1,7 +1,7 @@
1
- <template>
2
- <section>
3
- <h1>404</h1>
4
- <p>Page not found.</p>
5
- <RouterLink to="/">Back home</RouterLink>
6
- </section>
7
- </template>
1
+ <template>
2
+ <section>
3
+ <h1>404</h1>
4
+ <p>Page not found.</p>
5
+ <RouterLink to="/">Back home</RouterLink>
6
+ </section>
7
+ </template>
@@ -1,34 +1,34 @@
1
- import { createRouter, createWebHistory } from 'vue-router';
2
- import AboutPage from '../pages/About.vue';
3
- import HomePage from '../pages/Home.vue';
4
- import NotFoundPage from '../pages/NotFound.vue';
5
- {{#if hasAuth}}
6
- import DashboardPage from '../pages/Dashboard.vue';
7
- import LoginPage from '../pages/Login.vue';
8
- import { useAuth } from '../composables/useAuth';
9
- {{/if}}
10
-
11
- const router = createRouter({
12
- history: createWebHistory(),
13
- routes: [
14
- { path: '/', name: 'home', component: HomePage },
15
- { path: '/about', name: 'about', component: AboutPage },
16
- {{#if hasAuth}}
17
- { path: '/login', name: 'login', component: LoginPage },
18
- { path: '/dashboard', name: 'dashboard', component: DashboardPage, meta: { requiresAuth: true } },
19
- {{/if}}
20
- { path: '/:pathMatch(.*)*', name: 'not-found', component: NotFoundPage },
21
- ],
22
- });
23
-
24
- {{#if hasAuth}}
25
- router.beforeEach((to) => {
26
- const { isAuthenticated } = useAuth();
27
- if (to.meta.requiresAuth && !isAuthenticated.value) {
28
- return { name: 'login' };
29
- }
30
- return true;
31
- });
32
- {{/if}}
33
-
34
- export default router;
1
+ import { createRouter, createWebHistory } from 'vue-router';
2
+ import AboutPage from '../pages/About.vue';
3
+ import HomePage from '../pages/Home.vue';
4
+ import NotFoundPage from '../pages/NotFound.vue';
5
+ {{#if hasAuth}}
6
+ import DashboardPage from '../pages/Dashboard.vue';
7
+ import LoginPage from '../pages/Login.vue';
8
+ import { useAuth } from '../composables/useAuth';
9
+ {{/if}}
10
+
11
+ const router = createRouter({
12
+ history: createWebHistory(),
13
+ routes: [
14
+ { path: '/', name: 'home', component: HomePage },
15
+ { path: '/about', name: 'about', component: AboutPage },
16
+ {{#if hasAuth}}
17
+ { path: '/login', name: 'login', component: LoginPage },
18
+ { path: '/dashboard', name: 'dashboard', component: DashboardPage, meta: { requiresAuth: true } },
19
+ {{/if}}
20
+ { path: '/:pathMatch(.*)*', name: 'not-found', component: NotFoundPage },
21
+ ],
22
+ });
23
+
24
+ {{#if hasAuth}}
25
+ router.beforeEach((to) => {
26
+ const { isAuthenticated } = useAuth();
27
+ if (to.meta.requiresAuth && !isAuthenticated.value) {
28
+ return { name: 'login' };
29
+ }
30
+ return true;
31
+ });
32
+ {{/if}}
33
+
34
+ export default router;
@@ -1,8 +1,8 @@
1
- import { defineStore } from 'pinia';
2
- import { appName } from '../lib/config';
3
-
4
- export const useAppStore = defineStore('app', {
5
- state: () => ({
6
- appName,
7
- }),
8
- });
1
+ import { defineStore } from 'pinia';
2
+ import { appName } from '../lib/config';
3
+
4
+ export const useAppStore = defineStore('app', {
5
+ state: () => ({
6
+ appName,
7
+ }),
8
+ });
@@ -1,15 +1,15 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "ESNext",
5
- "moduleResolution": "Bundler",
6
- "strict": true,
7
- "jsx": "preserve",
8
- "resolveJsonModule": true,
9
- "isolatedModules": true,
10
- "esModuleInterop": true,
11
- "lib": ["ES2020", "DOM", "DOM.Iterable"],
12
- "types": ["vite/client"]
13
- },
14
- "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
15
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Bundler",
6
+ "strict": true,
7
+ "jsx": "preserve",
8
+ "resolveJsonModule": true,
9
+ "isolatedModules": true,
10
+ "esModuleInterop": true,
11
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
12
+ "types": ["vite/client"]
13
+ },
14
+ "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
15
+ }
@@ -1,6 +1,6 @@
1
- import vue from '@vitejs/plugin-vue';
2
- import { defineConfig } from 'vite';
3
-
4
- export default defineConfig({
5
- plugins: [vue()],
6
- });
1
+ import vue from '@vitejs/plugin-vue';
2
+ import { defineConfig } from 'vite';
3
+
4
+ export default defineConfig({
5
+ plugins: [vue()],
6
+ });
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  main
3
- } from "./chunk-36CSXSDC.js";
3
+ } from "./chunk-JQDTKR4K.js";
4
4
  export {
5
5
  main
6
6
  };
@@ -2,6 +2,7 @@
2
2
  var fileMap = {
3
3
  files: [
4
4
  { template: "schema.prisma.hbs", outputPath: "prisma/schema.prisma", target: "backend" },
5
+ { template: "prisma.config.ts.hbs", outputPath: "prisma.config.ts", target: "backend" },
5
6
  { template: "seed.ts.hbs", outputPath: "prisma/seed.ts", target: "backend" },
6
7
  { template: "db-client.ts.hbs", outputPath: "src/lib/db.ts", target: "backend" },
7
8
  { template: "models/user.ts.hbs", outputPath: "src/models/user.ts", target: "backend" },
@@ -5,9 +5,12 @@ var meta = {
5
5
  description: "Type-safe ORM with auto-generated client, migrations, and studio",
6
6
  category: "orm",
7
7
  platformSupport: "backend-only",
8
- deps: [{ name: "@prisma/client", version: "^6.1.0" }],
8
+ deps: [
9
+ { name: "@prisma/client", version: "^7.7.0" },
10
+ { name: "@prisma/adapter-pg", version: "^7.7.0" }
11
+ ],
9
12
  devDeps: [
10
- { name: "prisma", version: "^6.1.0" },
13
+ { name: "prisma", version: "^7.7.0" },
11
14
  { name: "tsx", version: "^4.19.0" }
12
15
  ],
13
16
  envVars: [],
@@ -1,8 +1,17 @@
1
1
  import { PrismaClient } from '@prisma/client';
2
+ {{#if hasPostgres}}
3
+ import { PrismaPg } from '@prisma/adapter-pg';
4
+ {{/if}}
2
5
 
3
6
  const globalForPrisma = globalThis as unknown as { prisma: PrismaClient | undefined };
4
7
 
5
- export const prisma = globalForPrisma.prisma ?? new PrismaClient();
8
+ export const prisma =
9
+ globalForPrisma.prisma ??
10
+ new PrismaClient({
11
+ {{#if hasPostgres}}
12
+ adapter: new PrismaPg({ connectionString: process.env.DATABASE_URL ?? '' }),
13
+ {{/if}}
14
+ });
6
15
 
7
16
  if (process.env.NODE_ENV !== 'production') {
8
17
  globalForPrisma.prisma = prisma;
@@ -1 +1 @@
1
- import { PrismaModule } from './prisma/prisma.module.js';
1
+ import { PrismaModule } from './prisma/prisma.module.js';
@@ -1 +1 @@
1
- PrismaModule,
1
+ PrismaModule,
@@ -1,3 +1,3 @@
1
- import type { User as PrismaUser } from '@prisma/client';
2
-
3
- export type User = PrismaUser;
1
+ import type { User as PrismaUser } from '@prisma/client';
2
+
3
+ export type User = PrismaUser;
@@ -0,0 +1,12 @@
1
+ import { defineConfig, env } from 'prisma/config';
2
+
3
+ export default defineConfig({
4
+ schema: 'prisma/schema.prisma',
5
+ migrations: {
6
+ path: 'prisma/migrations',
7
+ },
8
+ seed: 'tsx prisma/seed.ts',
9
+ datasource: {
10
+ url: env('DATABASE_URL'),
11
+ },
12
+ });
@@ -1,9 +1,9 @@
1
- import { Global, Module } from '@nestjs/common';
2
- import { PrismaService } from './prisma.service.js';
3
-
4
- @Global()
5
- @Module({
6
- providers: [PrismaService],
7
- exports: [PrismaService],
8
- })
9
- export class PrismaModule {}
1
+ import { Global, Module } from '@nestjs/common';
2
+ import { PrismaService } from './prisma.service.js';
3
+
4
+ @Global()
5
+ @Module({
6
+ providers: [PrismaService],
7
+ exports: [PrismaService],
8
+ })
9
+ export class PrismaModule {}
@@ -1,13 +1,24 @@
1
- import { Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common';
2
- import { PrismaClient } from '@prisma/client';
3
-
4
- @Injectable()
5
- export class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
6
- async onModuleInit(): Promise<void> {
7
- await this.$connect();
8
- }
9
-
10
- async onModuleDestroy(): Promise<void> {
11
- await this.$disconnect();
12
- }
13
- }
1
+ import { Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common';
2
+ import { PrismaClient } from '@prisma/client';
3
+ {{#if hasPostgres}}
4
+ import { PrismaPg } from '@prisma/adapter-pg';
5
+ {{/if}}
6
+
7
+ @Injectable()
8
+ export class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
9
+ constructor() {
10
+ super({
11
+ {{#if hasPostgres}}
12
+ adapter: new PrismaPg({ connectionString: process.env.DATABASE_URL ?? '' }),
13
+ {{/if}}
14
+ });
15
+ }
16
+
17
+ async onModuleInit(): Promise<void> {
18
+ await this.$connect();
19
+ }
20
+
21
+ async onModuleDestroy(): Promise<void> {
22
+ await this.$disconnect();
23
+ }
24
+ }
@@ -10,7 +10,6 @@ datasource db {
10
10
  {{else}}
11
11
  provider = "sqlite"
12
12
  {{/if}}
13
- url = env("DATABASE_URL")
14
13
  }
15
14
 
16
15
  model User {