create-better-t-stack 2.25.9 → 2.26.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/dist/index.js +4 -8
- package/package.json +1 -1
- package/templates/auth/web/nuxt/app/pages/dashboard.vue.hbs +33 -0
- package/templates/auth/web/react/react-router/src/routes/dashboard.tsx.hbs +4 -0
- package/templates/auth/web/react/tanstack-router/src/routes/dashboard.tsx.hbs +4 -0
- package/templates/auth/web/react/tanstack-start/src/routes/dashboard.tsx.hbs +4 -1
- package/templates/auth/web/solid/src/routes/{dashboard.tsx → dashboard.tsx.hbs} +6 -0
- package/templates/auth/web/svelte/src/components/UserMenu.svelte +0 -2
- package/templates/auth/web/svelte/src/routes/dashboard/{+page.svelte → +page.svelte.hbs} +6 -1
- package/templates/frontend/nuxt/nuxt.config.ts.hbs +1 -4
- package/templates/frontend/nuxt/package.json.hbs +7 -7
- package/templates/auth/web/nuxt/app/pages/dashboard.vue +0 -27
package/dist/index.js
CHANGED
|
@@ -2180,15 +2180,11 @@ async function setupAuthTemplate(projectDir, context) {
|
|
|
2180
2180
|
const authWebNuxtSrc = path.join(PKG_ROOT, "templates/auth/web/nuxt");
|
|
2181
2181
|
if (await fs.pathExists(authWebNuxtSrc)) await processAndCopyFiles("**/*", authWebNuxtSrc, webAppDir, context);
|
|
2182
2182
|
} else if (hasSvelteWeb) {
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
if (await fs.pathExists(authWebSvelteSrc)) await processAndCopyFiles("**/*", authWebSvelteSrc, webAppDir, context);
|
|
2186
|
-
}
|
|
2183
|
+
const authWebSvelteSrc = path.join(PKG_ROOT, "templates/auth/web/svelte");
|
|
2184
|
+
if (await fs.pathExists(authWebSvelteSrc)) await processAndCopyFiles("**/*", authWebSvelteSrc, webAppDir, context);
|
|
2187
2185
|
} else if (hasSolidWeb) {
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
if (await fs.pathExists(authWebSolidSrc)) await processAndCopyFiles("**/*", authWebSolidSrc, webAppDir, context);
|
|
2191
|
-
}
|
|
2186
|
+
const authWebSolidSrc = path.join(PKG_ROOT, "templates/auth/web/solid");
|
|
2187
|
+
if (await fs.pathExists(authWebSolidSrc)) await processAndCopyFiles("**/*", authWebSolidSrc, webAppDir, context);
|
|
2192
2188
|
}
|
|
2193
2189
|
}
|
|
2194
2190
|
if (hasNative && nativeAppDirExists) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.26.1",
|
|
4
4
|
"description": "A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
{{#if (eq api "orpc")}}
|
|
3
|
+
import { useQuery } from '@tanstack/vue-query'
|
|
4
|
+
{{/if}}
|
|
5
|
+
const {$authClient} = useNuxtApp()
|
|
6
|
+
|
|
7
|
+
definePageMeta({
|
|
8
|
+
middleware: ['auth']
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
const { $orpc } = useNuxtApp()
|
|
12
|
+
|
|
13
|
+
const session = $authClient.useSession()
|
|
14
|
+
|
|
15
|
+
{{#if (eq api "orpc")}}
|
|
16
|
+
const privateData = useQuery($orpc.privateData.queryOptions())
|
|
17
|
+
{{/if}}
|
|
18
|
+
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<div class="container mx-auto p-4">
|
|
23
|
+
<h1 class="text-2xl font-bold mb-4">Dashboard</h1>
|
|
24
|
+
<div v-if="session?.data?.user">
|
|
25
|
+
<p class="mb-2">Welcome \{{ session.data.user.name }}</p>
|
|
26
|
+
</div>
|
|
27
|
+
{{#if (eq api "orpc")}}
|
|
28
|
+
<div v-if="privateData.status.value === 'pending'">Loading private data...</div>
|
|
29
|
+
<div v-else-if="privateData.status.value === 'error'">Error loading private data: \{{ privateData.error.value?.message }}</div>
|
|
30
|
+
<p v-else-if="privateData.data.value">Private Data: \{{ privateData.data.value.message }}</p>
|
|
31
|
+
{{/if}}
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
@@ -5,7 +5,9 @@ import { orpc } from "@/utils/orpc";
|
|
|
5
5
|
{{#if (eq api "trpc")}}
|
|
6
6
|
import { trpc } from "@/utils/trpc";
|
|
7
7
|
{{/if}}
|
|
8
|
+
{{#if ( or (eq api "orpc") (eq api "trpc"))}}
|
|
8
9
|
import { useQuery } from "@tanstack/react-query";
|
|
10
|
+
{{/if}}
|
|
9
11
|
import { useEffect } from "react";
|
|
10
12
|
import { useNavigate } from "react-router";
|
|
11
13
|
|
|
@@ -34,7 +36,9 @@ export default function Dashboard() {
|
|
|
34
36
|
<div>
|
|
35
37
|
<h1>Dashboard</h1>
|
|
36
38
|
<p>Welcome {session?.user.name}</p>
|
|
39
|
+
{{#if ( or (eq api "orpc") (eq api "trpc"))}}
|
|
37
40
|
<p>privateData: {privateData.data?.message}</p>
|
|
41
|
+
{{/if}}
|
|
38
42
|
</div>
|
|
39
43
|
);
|
|
40
44
|
}
|
|
@@ -5,7 +5,9 @@ import { orpc } from "@/utils/orpc";
|
|
|
5
5
|
{{#if (eq api "trpc")}}
|
|
6
6
|
import { trpc } from "@/utils/trpc";
|
|
7
7
|
{{/if}}
|
|
8
|
+
{{#if ( or (eq api "orpc") (eq api "trpc"))}}
|
|
8
9
|
import { useQuery } from "@tanstack/react-query";
|
|
10
|
+
{{/if}}
|
|
9
11
|
import { createFileRoute } from "@tanstack/react-router";
|
|
10
12
|
import { useEffect } from "react";
|
|
11
13
|
|
|
@@ -41,7 +43,9 @@ function RouteComponent() {
|
|
|
41
43
|
<div>
|
|
42
44
|
<h1>Dashboard</h1>
|
|
43
45
|
<p>Welcome {session?.user.name}</p>
|
|
46
|
+
{{#if ( or (eq api "orpc") (eq api "trpc"))}}
|
|
44
47
|
<p>privateData: {privateData.data?.message}</p>
|
|
48
|
+
{{/if}}
|
|
45
49
|
</div>
|
|
46
50
|
);
|
|
47
51
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { authClient } from "@/lib/auth-client";
|
|
2
2
|
{{#if (eq api "trpc")}}
|
|
3
3
|
import { useTRPC } from "@/utils/trpc";
|
|
4
|
+
import { useQuery } from "@tanstack/react-query";
|
|
4
5
|
{{/if}}
|
|
5
6
|
{{#if (eq api "orpc")}}
|
|
6
7
|
import { orpc } from "@/utils/orpc";
|
|
7
|
-
{{/if}}
|
|
8
8
|
import { useQuery } from "@tanstack/react-query";
|
|
9
|
+
{{/if}}
|
|
9
10
|
import { createFileRoute } from "@tanstack/react-router";
|
|
10
11
|
import { useEffect } from "react";
|
|
11
12
|
|
|
@@ -45,7 +46,9 @@ function RouteComponent() {
|
|
|
45
46
|
<div>
|
|
46
47
|
<h1>Dashboard</h1>
|
|
47
48
|
<p>Welcome {session?.user.name}</p>
|
|
49
|
+
{{#if ( or (eq api "orpc") (eq api "trpc"))}}
|
|
48
50
|
<p>privateData: {privateData.data?.message}</p>
|
|
51
|
+
{{/if}}
|
|
49
52
|
</div>
|
|
50
53
|
);
|
|
51
54
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { authClient } from "@/lib/auth-client";
|
|
2
|
+
{{#if (eq api "orpc")}}
|
|
2
3
|
import { orpc } from "@/utils/orpc";
|
|
3
4
|
import { useQuery } from "@tanstack/solid-query";
|
|
5
|
+
{{/if}}
|
|
4
6
|
import { createFileRoute } from "@tanstack/solid-router";
|
|
5
7
|
import { createEffect, Show } from "solid-js";
|
|
6
8
|
|
|
@@ -12,7 +14,9 @@ function RouteComponent() {
|
|
|
12
14
|
const session = authClient.useSession();
|
|
13
15
|
const navigate = Route.useNavigate();
|
|
14
16
|
|
|
17
|
+
{{#if (eq api "orpc")}}
|
|
15
18
|
const privateData = useQuery(() => orpc.privateData.queryOptions());
|
|
19
|
+
{{/if}}
|
|
16
20
|
|
|
17
21
|
createEffect(() => {
|
|
18
22
|
if (!session().data && !session().isPending) {
|
|
@@ -31,7 +35,9 @@ function RouteComponent() {
|
|
|
31
35
|
<Show when={!session().isPending && session().data}>
|
|
32
36
|
<h1>Dashboard</h1>
|
|
33
37
|
<p>Welcome {session().data?.user.name}</p>
|
|
38
|
+
{{#if (eq api "orpc")}}
|
|
34
39
|
<p>privateData: {privateData.data?.message}</p>
|
|
40
|
+
{{/if}}
|
|
35
41
|
</Show>
|
|
36
42
|
</div>
|
|
37
43
|
);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { authClient } from '$lib/auth-client';
|
|
3
3
|
import { goto } from '$app/navigation';
|
|
4
|
-
import { queryClient } from '$lib/orpc';
|
|
5
4
|
|
|
6
5
|
const sessionQuery = authClient.useSession();
|
|
7
6
|
|
|
@@ -9,7 +8,6 @@
|
|
|
9
8
|
await authClient.signOut({
|
|
10
9
|
fetchOptions: {
|
|
11
10
|
onSuccess: () => {
|
|
12
|
-
queryClient.invalidateQueries();
|
|
13
11
|
goto('/');
|
|
14
12
|
},
|
|
15
13
|
onError: (error) => {
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
import { onMount } from 'svelte';
|
|
3
3
|
import { goto } from '$app/navigation';
|
|
4
4
|
import { authClient } from '$lib/auth-client';
|
|
5
|
+
{{#if (eq api "orpc")}}
|
|
5
6
|
import { orpc } from '$lib/orpc';
|
|
6
7
|
import { createQuery } from '@tanstack/svelte-query';
|
|
8
|
+
{{/if}}
|
|
7
9
|
import { get } from 'svelte/store';
|
|
8
10
|
|
|
9
11
|
const sessionQuery = authClient.useSession();
|
|
10
12
|
|
|
13
|
+
{{#if (eq api "orpc")}}
|
|
11
14
|
const privateDataQuery = createQuery(orpc.privateData.queryOptions());
|
|
15
|
+
{{/if}}
|
|
12
16
|
|
|
13
17
|
onMount(() => {
|
|
14
18
|
const { data: session, isPending } = get(sessionQuery);
|
|
@@ -21,11 +25,12 @@
|
|
|
21
25
|
{#if $sessionQuery.isPending}
|
|
22
26
|
<div>Loading...</div>
|
|
23
27
|
{:else if !$sessionQuery.data}
|
|
24
|
-
<!-- Redirecting... -->
|
|
25
28
|
{:else}
|
|
26
29
|
<div>
|
|
27
30
|
<h1>Dashboard</h1>
|
|
28
31
|
<p>Welcome {$sessionQuery.data.user.name}</p>
|
|
32
|
+
{{#if (eq api "orpc")}}
|
|
29
33
|
<p>privateData: {$privateDataQuery.data?.message}</p>
|
|
34
|
+
{{/if}}
|
|
30
35
|
</div>
|
|
31
36
|
{/if}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
// https://nuxt.com/docs/api/configuration/nuxt-config
|
|
2
2
|
export default defineNuxtConfig({
|
|
3
|
-
compatibilityDate: '
|
|
4
|
-
future: {
|
|
5
|
-
compatibilityVersion: 4
|
|
6
|
-
},
|
|
3
|
+
compatibilityDate: 'latest',
|
|
7
4
|
devtools: { enabled: true },
|
|
8
5
|
modules: ['@nuxt/ui'],
|
|
9
6
|
css: ['~/assets/css/main.css'],
|
|
@@ -10,16 +10,16 @@
|
|
|
10
10
|
"postinstall": "nuxt prepare"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@nuxt/ui": "3.0
|
|
14
|
-
"@tanstack/vue-query": "^5.
|
|
15
|
-
"nuxt": "^
|
|
13
|
+
"@nuxt/ui": "3.2.0",
|
|
14
|
+
"@tanstack/vue-query": "^5.83.0",
|
|
15
|
+
"nuxt": "^4.0.0",
|
|
16
16
|
"typescript": "^5.6.3",
|
|
17
|
-
"vue": "^3.5.
|
|
18
|
-
"vue-router": "^4.5.
|
|
17
|
+
"vue": "^3.5.17",
|
|
18
|
+
"vue-router": "^4.5.1",
|
|
19
19
|
"zod": "^4.0.2"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@tanstack/vue-query-devtools": "^5.
|
|
23
|
-
"@iconify-json/lucide": "^1.2.
|
|
22
|
+
"@tanstack/vue-query-devtools": "^5.83.0",
|
|
23
|
+
"@iconify-json/lucide": "^1.2.57"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { useQuery } from '@tanstack/vue-query'
|
|
3
|
-
const {$authClient} = useNuxtApp()
|
|
4
|
-
|
|
5
|
-
definePageMeta({
|
|
6
|
-
middleware: ['auth']
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
const { $orpc } = useNuxtApp()
|
|
10
|
-
|
|
11
|
-
const session = $authClient.useSession()
|
|
12
|
-
|
|
13
|
-
const privateData = useQuery($orpc.privateData.queryOptions())
|
|
14
|
-
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<template>
|
|
18
|
-
<div class="container mx-auto p-4">
|
|
19
|
-
<h1 class="text-2xl font-bold mb-4">Dashboard</h1>
|
|
20
|
-
<div v-if="session?.data?.user">
|
|
21
|
-
<p class="mb-2">Welcome {{ session.data.user.name }}</p>
|
|
22
|
-
</div>
|
|
23
|
-
<div v-if="privateData.status.value === 'pending'">Loading private data...</div>
|
|
24
|
-
<div v-else-if="privateData.status.value === 'error'">Error loading private data: {{ privateData.error.value?.message }}</div>
|
|
25
|
-
<p v-else-if="privateData.data.value">Private Data: {{ privateData.data.value.message }}</p>
|
|
26
|
-
</div>
|
|
27
|
-
</template>
|