create-better-t-stack 2.50.1-canary.58bbe5f6 → 2.50.1-canary.9643d88e
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 +1 -1
- package/dist/index.js +1 -1
- package/dist/{src-CulfT5QB.js → src-B0pvu6Z-.js} +24 -7
- package/package.json +1 -1
- package/templates/api/orpc/native/utils/orpc.ts.hbs +5 -1
- package/templates/api/trpc/native/utils/trpc.ts.hbs +5 -1
- package/templates/base/tsconfig.base.json.hbs +1 -2
- package/templates/extras/bunfig.toml.hbs +1 -1
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -352,8 +352,9 @@ function validateSelfBackendCompatibility(providedFlags, options, config) {
|
|
|
352
352
|
const backend = config.backend || options.backend;
|
|
353
353
|
const frontends = config.frontend || options.frontend || [];
|
|
354
354
|
if (backend === "self") {
|
|
355
|
-
|
|
356
|
-
if (
|
|
355
|
+
const { web, native } = splitFrontends(frontends);
|
|
356
|
+
if (!(web.length === 1 && FULLSTACK_FRONTENDS$1.includes(web[0]))) exitWithError("Backend 'self' (fullstack) currently only supports Next.js frontend. Please use --frontend next. Support for Nuxt, SvelteKit, and TanStack Start will be added in a future update.");
|
|
357
|
+
if (native.length > 1) exitWithError("Cannot select multiple native frameworks. Choose only one of: native-nativewind, native-unistyles");
|
|
357
358
|
}
|
|
358
359
|
const hasFullstackFrontend = frontends.some((f) => FULLSTACK_FRONTENDS$1.includes(f));
|
|
359
360
|
if (providedFlags.has("backend") && !hasFullstackFrontend && backend === "self") exitWithError("Backend 'self' (fullstack) currently only supports Next.js frontend. Please use --frontend next or choose a different backend. Support for Nuxt, SvelteKit, and TanStack Start will be added in a future update.");
|
|
@@ -1766,6 +1767,12 @@ function validateBackendNoneConstraints(config, providedFlags) {
|
|
|
1766
1767
|
if (has("dbSetup") && config.dbSetup !== "none") exitWithError("Backend 'none' requires '--db-setup none'. Please remove the --db-setup flag or set it to 'none'.");
|
|
1767
1768
|
if (has("serverDeploy") && config.serverDeploy !== "none") exitWithError("Backend 'none' requires '--server-deploy none'. Please remove the --server-deploy flag or set it to 'none'.");
|
|
1768
1769
|
}
|
|
1770
|
+
function validateSelfBackendConstraints(config, providedFlags) {
|
|
1771
|
+
const { backend } = config;
|
|
1772
|
+
if (backend !== "self") return;
|
|
1773
|
+
const has = (k) => providedFlags.has(k);
|
|
1774
|
+
if (has("runtime") && config.runtime !== "none") exitWithError("Backend 'self' (fullstack) requires '--runtime none'. Please remove the --runtime flag or set it to 'none'.");
|
|
1775
|
+
}
|
|
1769
1776
|
function validateBackendConstraints(config, providedFlags, options) {
|
|
1770
1777
|
const { backend } = config;
|
|
1771
1778
|
if (config.auth === "clerk" && backend !== "convex") exitWithError("Clerk authentication is only supported with the Convex backend. Please use '--backend convex' or choose a different auth provider.");
|
|
@@ -1804,6 +1811,7 @@ function validateFullConfig(config, providedFlags, options) {
|
|
|
1804
1811
|
validateDatabaseSetup(config, providedFlags);
|
|
1805
1812
|
validateConvexConstraints(config, providedFlags);
|
|
1806
1813
|
validateBackendNoneConstraints(config, providedFlags);
|
|
1814
|
+
validateSelfBackendConstraints(config, providedFlags);
|
|
1807
1815
|
validateBackendConstraints(config, providedFlags, options);
|
|
1808
1816
|
validateFrontendConstraints(config, providedFlags);
|
|
1809
1817
|
validateApiConstraints(config, options);
|
|
@@ -4001,6 +4009,7 @@ async function setupCatalogs(projectDir, options) {
|
|
|
4001
4009
|
const packagePaths = [
|
|
4002
4010
|
"apps/server",
|
|
4003
4011
|
"apps/web",
|
|
4012
|
+
"apps/native",
|
|
4004
4013
|
"packages/api",
|
|
4005
4014
|
"packages/db",
|
|
4006
4015
|
"packages/auth",
|
|
@@ -4624,7 +4633,7 @@ async function setupEnvironmentVariables(config) {
|
|
|
4624
4633
|
const nativeDir = path.join(projectDir, "apps/native");
|
|
4625
4634
|
if (await fs.pathExists(nativeDir)) {
|
|
4626
4635
|
let envVarName = "EXPO_PUBLIC_SERVER_URL";
|
|
4627
|
-
let serverUrl = "http://localhost:3000";
|
|
4636
|
+
let serverUrl = backend === "self" ? "http://localhost:3001" : "http://localhost:3000";
|
|
4628
4637
|
if (backend === "convex") {
|
|
4629
4638
|
envVarName = "EXPO_PUBLIC_CONVEX_URL";
|
|
4630
4639
|
serverUrl = "https://<YOUR_CONVEX_URL>";
|
|
@@ -6146,7 +6155,6 @@ function generateFeaturesList(database, auth, addons, orm, runtime, frontend, ba
|
|
|
6146
6155
|
else if (backend === "express") addonsList.push("- **Express** - Fast, unopinionated web framework");
|
|
6147
6156
|
else if (backend === "fastify") addonsList.push("- **Fastify** - Fast, low-overhead web framework");
|
|
6148
6157
|
else if (backend === "elysia") addonsList.push("- **Elysia** - Type-safe, high-performance framework");
|
|
6149
|
-
else if (backend === "next") addonsList.push("- **Next.js** - Full-stack React framework");
|
|
6150
6158
|
if (api === "trpc") addonsList.push("- **tRPC** - End-to-end type-safe APIs");
|
|
6151
6159
|
else if (api === "orpc") addonsList.push("- **oRPC** - End-to-end type-safe APIs with OpenAPI integration");
|
|
6152
6160
|
if (runtime !== "none") addonsList.push(`- **${runtime === "bun" ? "Bun" : runtime === "node" ? "Node.js" : runtime}** - Runtime environment`);
|
|
@@ -6398,7 +6406,7 @@ async function displayPostInstallInstructions(config) {
|
|
|
6398
6406
|
const databaseInstructions = !isConvex && database !== "none" ? await getDatabaseInstructions(database, orm, runCmd, runtime, dbSetup, serverDeploy, backend) : "";
|
|
6399
6407
|
const tauriInstructions = addons?.includes("tauri") ? getTauriInstructions(runCmd) : "";
|
|
6400
6408
|
const lintingInstructions = hasHuskyOrBiome ? getLintingInstructions(runCmd) : "";
|
|
6401
|
-
const nativeInstructions = frontend?.includes("native-nativewind") || frontend?.includes("native-unistyles") ? getNativeInstructions(isConvex) : "";
|
|
6409
|
+
const nativeInstructions = frontend?.includes("native-nativewind") || frontend?.includes("native-unistyles") ? getNativeInstructions(isConvex, isBackendSelf) : "";
|
|
6402
6410
|
const pwaInstructions = addons?.includes("pwa") && frontend?.includes("react-router") ? getPwaInstructions() : "";
|
|
6403
6411
|
const starlightInstructions = addons?.includes("starlight") ? getStarlightInstructions(runCmd) : "";
|
|
6404
6412
|
const clerkInstructions = isConvex && config.auth === "clerk" ? getClerkInstructions() : "";
|
|
@@ -6464,9 +6472,9 @@ async function displayPostInstallInstructions(config) {
|
|
|
6464
6472
|
output += pc.cyan("https://github.com/AmanVarshney01/create-better-t-stack");
|
|
6465
6473
|
consola$1.box(output);
|
|
6466
6474
|
}
|
|
6467
|
-
function getNativeInstructions(isConvex) {
|
|
6475
|
+
function getNativeInstructions(isConvex, isBackendSelf) {
|
|
6468
6476
|
const envVar = isConvex ? "EXPO_PUBLIC_CONVEX_URL" : "EXPO_PUBLIC_SERVER_URL";
|
|
6469
|
-
const exampleUrl = isConvex ? "https://<YOUR_CONVEX_URL>" : "http://<YOUR_LOCAL_IP>:3000";
|
|
6477
|
+
const exampleUrl = isConvex ? "https://<YOUR_CONVEX_URL>" : isBackendSelf ? "http://<YOUR_LOCAL_IP>:3001" : "http://<YOUR_LOCAL_IP>:3000";
|
|
6470
6478
|
const envFileName = ".env";
|
|
6471
6479
|
const ipNote = isConvex ? "your Convex deployment URL (find after running 'dev:setup')" : "your local IP address";
|
|
6472
6480
|
let instructions = `${pc.yellow("NOTE:")} For Expo connectivity issues, update\n apps/native/${envFileName} with ${ipNote}:\n ${`${envVar}=${exampleUrl}`}\n`;
|
|
@@ -6617,6 +6625,15 @@ async function setupWorkspaceDependencies(projectDir, options) {
|
|
|
6617
6625
|
projectDir: webPackageDir
|
|
6618
6626
|
});
|
|
6619
6627
|
}
|
|
6628
|
+
const nativePackageDir = path.join(projectDir, "apps/native");
|
|
6629
|
+
if (await fs.pathExists(nativePackageDir)) {
|
|
6630
|
+
const nativeDeps = {};
|
|
6631
|
+
nativeDeps[`@${projectName}/api`] = workspaceVersion;
|
|
6632
|
+
if (Object.keys(nativeDeps).length > 0) await addPackageDependency({
|
|
6633
|
+
customDependencies: nativeDeps,
|
|
6634
|
+
projectDir: nativePackageDir
|
|
6635
|
+
});
|
|
6636
|
+
}
|
|
6620
6637
|
const runtimeDevDeps = getRuntimeDevDeps(options);
|
|
6621
6638
|
await addPackageDependency({
|
|
6622
6639
|
dependencies: commonDeps,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "2.50.1-canary.
|
|
3
|
+
"version": "2.50.1-canary.9643d88e",
|
|
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",
|
|
@@ -2,7 +2,7 @@ import { createORPCClient } from "@orpc/client";
|
|
|
2
2
|
import { RPCLink } from "@orpc/client/fetch";
|
|
3
3
|
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
|
4
4
|
import { QueryCache, QueryClient } from "@tanstack/react-query";
|
|
5
|
-
import type { AppRouterClient } from "
|
|
5
|
+
import type { AppRouterClient } from "@{{projectName}}/api/routers/index";
|
|
6
6
|
{{#if (eq auth "better-auth")}}
|
|
7
7
|
import { authClient } from "@/lib/auth-client";
|
|
8
8
|
{{/if}}
|
|
@@ -16,7 +16,11 @@ export const queryClient = new QueryClient({
|
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
export const link = new RPCLink({
|
|
19
|
+
{{#if (eq backend "self")}}
|
|
20
|
+
url: `${process.env.EXPO_PUBLIC_SERVER_URL}/api/rpc`,
|
|
21
|
+
{{else}}
|
|
19
22
|
url: `${process.env.EXPO_PUBLIC_SERVER_URL}/rpc`,
|
|
23
|
+
{{/if}}
|
|
20
24
|
{{#if (eq auth "better-auth")}}
|
|
21
25
|
headers() {
|
|
22
26
|
const headers = new Map<string, string>();
|
|
@@ -4,14 +4,18 @@ import { authClient } from "@/lib/auth-client";
|
|
|
4
4
|
import { QueryClient } from "@tanstack/react-query";
|
|
5
5
|
import { createTRPCClient, httpBatchLink } from "@trpc/client";
|
|
6
6
|
import { createTRPCOptionsProxy } from "@trpc/tanstack-react-query";
|
|
7
|
-
import type { AppRouter } from "
|
|
7
|
+
import type { AppRouter } from "@{{projectName}}/api/routers/index";
|
|
8
8
|
|
|
9
9
|
export const queryClient = new QueryClient();
|
|
10
10
|
|
|
11
11
|
const trpcClient = createTRPCClient<AppRouter>({
|
|
12
12
|
links: [
|
|
13
13
|
httpBatchLink({
|
|
14
|
+
{{#if (eq backend "self")}}
|
|
15
|
+
url: `${process.env.EXPO_PUBLIC_SERVER_URL}/api/trpc`,
|
|
16
|
+
{{else}}
|
|
14
17
|
url: `${process.env.EXPO_PUBLIC_SERVER_URL}/trpc`,
|
|
18
|
+
{{/if}}
|
|
15
19
|
{{#if (eq auth "better-auth")}}
|
|
16
20
|
headers() {
|
|
17
21
|
const headers = new Map<string, string>();
|