create-better-t-stack 3.1.4 → 3.1.5-canary.b53fc7d5

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/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { createBtsCli } from "./src-DfqHfdEO.js";
2
+ import { createBtsCli } from "./src-AeW2CVNz.js";
3
3
 
4
4
  //#region src/cli.ts
5
5
  createBtsCli().run();
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import { builder, createBtsCli, docs, init, router, sponsors } from "./src-DfqHfdEO.js";
2
+ import { builder, createBtsCli, docs, init, router, sponsors } from "./src-AeW2CVNz.js";
3
3
 
4
4
  export { builder, createBtsCli, docs, init, router, sponsors };
@@ -1388,7 +1388,7 @@ const getLatestCLIVersion = () => {
1388
1388
  */
1389
1389
  function isTelemetryEnabled() {
1390
1390
  const BTS_TELEMETRY_DISABLED = process.env.BTS_TELEMETRY_DISABLED;
1391
- const BTS_TELEMETRY = "1";
1391
+ const BTS_TELEMETRY = "0";
1392
1392
  if (BTS_TELEMETRY_DISABLED !== void 0) return BTS_TELEMETRY_DISABLED !== "1";
1393
1393
  if (BTS_TELEMETRY !== void 0) return BTS_TELEMETRY === "1";
1394
1394
  return true;
@@ -1396,8 +1396,8 @@ function isTelemetryEnabled() {
1396
1396
 
1397
1397
  //#endregion
1398
1398
  //#region src/utils/analytics.ts
1399
- const POSTHOG_API_KEY = "phc_8ZUxEwwfKMajJLvxz1daGd931dYbQrwKNficBmsdIrs";
1400
- const POSTHOG_HOST = "https://us.i.posthog.com";
1399
+ const POSTHOG_API_KEY = "random";
1400
+ const POSTHOG_HOST = "random";
1401
1401
  function generateSessionId() {
1402
1402
  const rand = Math.random().toString(36).slice(2);
1403
1403
  return `cli_${Date.now().toString(36)}${rand}`;
@@ -2141,7 +2141,17 @@ async function setupRuler(config) {
2141
2141
  opencode: { label: "OpenCode" },
2142
2142
  crush: { label: "Crush" },
2143
2143
  zed: { label: "Zed" },
2144
- qwen: { label: "Qwen" }
2144
+ qwen: { label: "Qwen" },
2145
+ amazonqcli: { label: "Amazon Q CLI" },
2146
+ augmentcode: { label: "AugmentCode" },
2147
+ firebender: { label: "Firebender" },
2148
+ goose: { label: "Goose" },
2149
+ jules: { label: "Jules" },
2150
+ kiro: { label: "Kiro" },
2151
+ openhands: { label: "Open Hands" },
2152
+ roo: { label: "RooCode" },
2153
+ trae: { label: "Trae AI" },
2154
+ warp: { label: "Warp" }
2145
2155
  }).map(([key, v]) => ({
2146
2156
  value: key,
2147
2157
  label: v.label
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-better-t-stack",
3
- "version": "3.1.4",
3
+ "version": "3.1.5-canary.b53fc7d5",
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,6 @@
1
+ import { authMiddleware } from "@/middleware/auth";
2
+ import { createServerFn } from "@tanstack/react-start";
3
+
4
+ export const getUser = createServerFn({ method: "GET" }).middleware([authMiddleware]).handler(async ({ context }) => {
5
+ return context.session
6
+ })
@@ -0,0 +1,12 @@
1
+ import { auth } from "@{{projectName}}/auth";
2
+ import { createMiddleware } from "@tanstack/react-start";
3
+
4
+
5
+ export const authMiddleware = createMiddleware().server(async ({ next, request }) => {
6
+ const session = await auth.api.getSession({
7
+ headers: request.headers,
8
+ })
9
+ return next({
10
+ context: { session }
11
+ })
12
+ })
@@ -1,69 +1,76 @@
1
+ import { getUser } from "@/functions/get-user";
2
+ {{#if (eq payments "polar") }}
1
3
  import { Button } from "@/components/ui/button";
2
4
  import { authClient } from "@/lib/auth-client";
3
- {{#if (eq api "trpc")}}
5
+ {{/if}}
6
+ {{#if (eq api "trpc") }}
4
7
  import { useTRPC } from "@/utils/trpc";
5
8
  import { useQuery } from "@tanstack/react-query";
6
9
  {{/if}}
7
- {{#if (eq api "orpc")}}
10
+ {{#if (eq api "orpc") }}
8
11
  import { orpc } from "@/utils/orpc";
9
12
  import { useQuery } from "@tanstack/react-query";
10
13
  {{/if}}
11
14
  import { createFileRoute, redirect } from "@tanstack/react-router";
12
15
 
13
16
  export const Route = createFileRoute("/dashboard")({
14
- component: RouteComponent,
15
- beforeLoad: async () => {
16
- const session = await authClient.getSession();
17
- if (!session.data) {
18
- redirect({
19
- to: "/login",
20
- throw: true
21
- });
22
- }
23
- {{#if (eq payments "polar")}}
24
- const {data: customerState} = await authClient.customer.state()
25
- return { session, customerState };
26
- {{else}}
27
- return { session };
28
- {{/if}}
29
- }
17
+ component: RouteComponent,
18
+ beforeLoad: async () => {
19
+ const session = await getUser();
20
+ return { session };
21
+ },
22
+ loader: async ({ context }) => {
23
+ if (!context.session) {
24
+ throw redirect({
25
+ to: "/login",
26
+ });
27
+ }
28
+ {{#if (eq payments "polar") }}
29
+ const { data: customerState } = await authClient.customer.state();
30
+ return { session: context.session, customerState };
31
+ {{else}}
32
+ return { session: context.session };
33
+ {{/if}}
34
+ },
30
35
  });
31
36
 
32
37
  function RouteComponent() {
33
- const { session{{#if (eq payments "polar")}}, customerState{{/if}} } = Route.useRouteContext();
38
+ const { session{{#if (eq payments "polar") }}, customerState{{/if}} } = Route.useRouteContext();
34
39
 
35
- {{#if (eq api "trpc")}}
36
- const trpc = useTRPC();
37
- const privateData = useQuery(trpc.privateData.queryOptions());
38
- {{/if}}
39
- {{#if (eq api "orpc")}}
40
- const privateData = useQuery(orpc.privateData.queryOptions());
41
- {{/if}}
40
+ {{#if (eq api "trpc") }}
41
+ const trpc = useTRPC();
42
+ const privateData = useQuery(trpc.privateData.queryOptions());
43
+ {{/if}}
44
+ {{#if (eq api "orpc") }}
45
+ const privateData = useQuery(orpc.privateData.queryOptions());
46
+ {{/if}}
42
47
 
43
- {{#if (eq payments "polar")}}
44
- const hasProSubscription = customerState?.activeSubscriptions?.length! > 0
45
- console.log("Active subscriptions:", customerState?.activeSubscriptions)
46
- {{/if}}
48
+ {{#if (eq payments "polar") }}
49
+ const hasProSubscription = (customerState?.activeSubscriptions?.length ?? 0) > 0;
50
+ console.log("Active subscriptions:", customerState?.activeSubscriptions);
51
+ {{/if}}
47
52
 
48
- return (
49
- <div>
50
- <h1>Dashboard</h1>
51
- <p>Welcome {session.data?.user.name}</p>
52
- {{#if ( or (eq api "orpc") (eq api "trpc"))}}
53
- <p>API: {privateData.data?.message}</p>
54
- {{/if}}
55
- {{#if (eq payments "polar")}}
56
- <p>Plan: {hasProSubscription ? "Pro" : "Free"}</p>
57
- {hasProSubscription ? (
58
- <Button onClick={async () => await authClient.customer.portal()}>
59
- Manage Subscription
60
- </Button>
61
- ) : (
62
- <Button onClick={async () => await authClient.checkout({ slug: "pro" })}>
63
- Upgrade to Pro
64
- </Button>
65
- )}
66
- {{/if}}
67
- </div>
68
- );
69
- }
53
+ return (
54
+ <div>
55
+ <h1>Dashboard</h1>
56
+ <p>Welcome {session?.user.name}</p>
57
+ {{#if (eq api "trpc") }}
58
+ <p>API: {privateData.data?.message}</p>
59
+ {{else if (eq api "orpc") }}
60
+ <p>API: {privateData.data?.message}</p>
61
+ {{/if}}
62
+ {{#if (eq payments "polar") }}
63
+ <p>Plan: {hasProSubscription ? "Pro" : "Free"}</p>
64
+ {hasProSubscription ? (
65
+ <Button onClick={async () => { await authClient.customer.portal(); }}>
66
+ Manage Subscription
67
+ </Button>
68
+ ) : (
69
+ <Button onClick={async () => { await authClient.checkout({ slug: "pro" }); }}>
70
+ Upgrade to Pro
71
+ </Button>
72
+ )}
73
+ {{/if}}
74
+ </div>
75
+ );
76
+ }
@@ -1,31 +1,12 @@
1
1
  // Learn more https://docs.expo.io/guides/customizing-metro
2
2
  const { getDefaultConfig } = require("expo/metro-config");
3
- const { FileStore } = require("metro-cache");
4
3
  const { withNativeWind } = require("nativewind/metro");
5
- const path = require("node:path");
6
4
 
7
- const config = withTurborepoManagedCache(
8
- withNativeWind(getDefaultConfig(__dirname), {
9
- input: "./global.css",
10
- configPath: "./tailwind.config.js",
11
- }),
12
- );
5
+ const config = withNativeWind(getDefaultConfig(__dirname), {
6
+ input: "./global.css",
7
+ configPath: "./tailwind.config.js",
8
+ });
13
9
 
14
10
  config.resolver.unstable_enablePackageExports = true;
15
11
 
16
- module.exports = config;
17
-
18
- /**
19
- * Move the Metro cache to the `.cache/metro` folder.
20
- * If you have any environment variables, you can configure Turborepo to invalidate it when needed.
21
- *
22
- * @see https://turbo.build/repo/docs/reference/configuration#env
23
- * @param {import('expo/metro-config').MetroConfig} config
24
- * @returns {import('expo/metro-config').MetroConfig}
25
- */
26
- function withTurborepoManagedCache(config) {
27
- config.cacheStores = [
28
- new FileStore({ root: path.join(__dirname, ".cache/metro") }),
29
- ];
30
- return config;
31
- }
12
+ module.exports = config;