create-better-t-stack 3.9.0 → 3.11.0-pr749.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.
- package/README.md +2 -1
- package/bin/create-better-t-stack +98 -0
- package/package.json +69 -59
- package/src/api.ts +203 -0
- package/src/cli.ts +185 -0
- package/src/constants.ts +270 -0
- package/src/helpers/addons/addons-setup.ts +201 -0
- package/src/helpers/addons/examples-setup.ts +137 -0
- package/src/helpers/addons/fumadocs-setup.ts +99 -0
- package/src/helpers/addons/oxlint-setup.ts +36 -0
- package/src/helpers/addons/ruler-setup.ts +135 -0
- package/src/helpers/addons/starlight-setup.ts +45 -0
- package/src/helpers/addons/tauri-setup.ts +90 -0
- package/src/helpers/addons/tui-setup.ts +64 -0
- package/src/helpers/addons/ultracite-setup.ts +228 -0
- package/src/helpers/addons/vite-pwa-setup.ts +59 -0
- package/src/helpers/addons/wxt-setup.ts +86 -0
- package/src/helpers/core/add-addons.ts +85 -0
- package/src/helpers/core/add-deployment.ts +102 -0
- package/src/helpers/core/api-setup.ts +280 -0
- package/src/helpers/core/auth-setup.ts +203 -0
- package/src/helpers/core/backend-setup.ts +69 -0
- package/src/helpers/core/command-handlers.ts +354 -0
- package/src/helpers/core/convex-codegen.ts +14 -0
- package/src/helpers/core/create-project.ts +134 -0
- package/src/helpers/core/create-readme.ts +694 -0
- package/src/helpers/core/db-setup.ts +184 -0
- package/src/helpers/core/detect-project-config.ts +41 -0
- package/src/helpers/core/env-setup.ts +481 -0
- package/src/helpers/core/git.ts +23 -0
- package/src/helpers/core/install-dependencies.ts +29 -0
- package/src/helpers/core/payments-setup.ts +48 -0
- package/src/helpers/core/post-installation.ts +403 -0
- package/src/helpers/core/project-config.ts +250 -0
- package/src/helpers/core/runtime-setup.ts +76 -0
- package/src/helpers/core/template-manager.ts +917 -0
- package/src/helpers/core/workspace-setup.ts +184 -0
- package/src/helpers/database-providers/d1-setup.ts +28 -0
- package/src/helpers/database-providers/docker-compose-setup.ts +50 -0
- package/src/helpers/database-providers/mongodb-atlas-setup.ts +182 -0
- package/src/helpers/database-providers/neon-setup.ts +240 -0
- package/src/helpers/database-providers/planetscale-setup.ts +78 -0
- package/src/helpers/database-providers/prisma-postgres-setup.ts +193 -0
- package/src/helpers/database-providers/supabase-setup.ts +196 -0
- package/src/helpers/database-providers/turso-setup.ts +309 -0
- package/src/helpers/deployment/alchemy/alchemy-combined-setup.ts +80 -0
- package/src/helpers/deployment/alchemy/alchemy-next-setup.ts +52 -0
- package/src/helpers/deployment/alchemy/alchemy-nuxt-setup.ts +105 -0
- package/src/helpers/deployment/alchemy/alchemy-react-router-setup.ts +33 -0
- package/src/helpers/deployment/alchemy/alchemy-solid-setup.ts +33 -0
- package/src/helpers/deployment/alchemy/alchemy-svelte-setup.ts +99 -0
- package/src/helpers/deployment/alchemy/alchemy-tanstack-router-setup.ts +34 -0
- package/src/helpers/deployment/alchemy/alchemy-tanstack-start-setup.ts +99 -0
- package/src/helpers/deployment/alchemy/env-dts-setup.ts +76 -0
- package/src/helpers/deployment/alchemy/index.ts +7 -0
- package/src/helpers/deployment/server-deploy-setup.ts +55 -0
- package/src/helpers/deployment/web-deploy-setup.ts +58 -0
- package/src/index.ts +51 -0
- package/src/prompts/addons.ts +200 -0
- package/src/prompts/api.ts +49 -0
- package/src/prompts/auth.ts +84 -0
- package/src/prompts/backend.ts +83 -0
- package/src/prompts/config-prompts.ts +138 -0
- package/src/prompts/database-setup.ts +112 -0
- package/src/prompts/database.ts +57 -0
- package/src/prompts/examples.ts +60 -0
- package/src/prompts/frontend.ts +118 -0
- package/src/prompts/git.ts +16 -0
- package/src/prompts/install.ts +16 -0
- package/src/prompts/orm.ts +53 -0
- package/src/prompts/package-manager.ts +32 -0
- package/src/prompts/payments.ts +50 -0
- package/src/prompts/project-name.ts +86 -0
- package/src/prompts/runtime.ts +47 -0
- package/src/prompts/server-deploy.ts +91 -0
- package/src/prompts/web-deploy.ts +107 -0
- package/src/tui/app.tsx +1062 -0
- package/src/types.ts +70 -0
- package/src/utils/add-package-deps.ts +57 -0
- package/src/utils/analytics.ts +39 -0
- package/src/utils/better-auth-plugin-setup.ts +71 -0
- package/src/utils/bts-config.ts +122 -0
- package/src/utils/command-exists.ts +16 -0
- package/src/utils/compatibility-rules.ts +337 -0
- package/src/utils/compatibility.ts +11 -0
- package/src/utils/config-processing.ts +130 -0
- package/src/utils/config-validation.ts +470 -0
- package/src/utils/display-config.ts +96 -0
- package/src/utils/docker-utils.ts +70 -0
- package/src/utils/errors.ts +30 -0
- package/src/utils/file-formatter.ts +11 -0
- package/src/utils/generate-reproducible-command.ts +53 -0
- package/src/utils/get-latest-cli-version.ts +27 -0
- package/src/utils/get-package-manager.ts +13 -0
- package/src/utils/open-url.ts +18 -0
- package/src/utils/package-runner.ts +23 -0
- package/src/utils/project-directory.ts +102 -0
- package/src/utils/project-name-validation.ts +43 -0
- package/src/utils/render-title.ts +48 -0
- package/src/utils/setup-catalogs.ts +192 -0
- package/src/utils/sponsors.ts +101 -0
- package/src/utils/telemetry.ts +19 -0
- package/src/utils/template-processor.ts +64 -0
- package/src/utils/templates.ts +94 -0
- package/src/utils/ts-morph.ts +26 -0
- package/src/validation.ts +117 -0
- package/templates/auth/better-auth/convex/backend/convex/auth.config.ts.hbs +5 -7
- package/templates/auth/better-auth/convex/backend/convex/auth.ts.hbs +17 -17
- package/templates/auth/better-auth/convex/backend/convex/http.ts.hbs +4 -4
- package/templates/auth/better-auth/convex/web/react/next/src/app/api/auth/[...all]/route.ts.hbs +2 -2
- package/templates/auth/better-auth/convex/web/react/next/src/components/user-menu.tsx.hbs +10 -10
- package/templates/auth/better-auth/convex/web/react/next/src/lib/auth-server.ts.hbs +13 -5
- package/templates/auth/better-auth/convex/web/react/tanstack-router/src/components/user-menu.tsx.hbs +14 -12
- package/templates/auth/better-auth/convex/web/react/tanstack-start/src/components/user-menu.tsx.hbs +13 -16
- package/templates/auth/better-auth/convex/web/react/tanstack-start/src/lib/auth-server.ts.hbs +11 -5
- package/templates/auth/better-auth/convex/web/react/tanstack-start/src/routes/api/auth/$.ts.hbs +4 -4
- package/templates/auth/better-auth/fullstack/tanstack-start/src/routes/api/auth/$.ts.hbs +1 -1
- package/templates/auth/better-auth/web/react/next/src/components/user-menu.tsx.hbs +17 -15
- package/templates/auth/better-auth/web/react/react-router/src/components/user-menu.tsx.hbs +16 -15
- package/templates/auth/better-auth/web/react/tanstack-router/src/components/{user-menu.tsx → user-menu.tsx.hbs} +16 -15
- package/templates/auth/better-auth/web/react/tanstack-start/src/components/{user-menu.tsx → user-menu.tsx.hbs} +16 -15
- package/templates/backend/convex/packages/backend/convex/README.md +4 -4
- package/templates/backend/convex/packages/backend/convex/convex.config.ts.hbs +17 -0
- package/templates/backend/convex/packages/backend/convex/tsconfig.json.hbs +1 -1
- package/templates/examples/ai/convex/packages/backend/convex/agent.ts.hbs +9 -0
- package/templates/examples/ai/convex/packages/backend/convex/chat.ts.hbs +67 -0
- package/templates/examples/ai/native/bare/app/(drawer)/ai.tsx.hbs +301 -3
- package/templates/examples/ai/native/unistyles/app/(drawer)/ai.tsx.hbs +296 -10
- package/templates/examples/ai/native/uniwind/app/(drawer)/ai.tsx.hbs +180 -1
- package/templates/examples/ai/web/react/next/src/app/ai/page.tsx.hbs +172 -9
- package/templates/examples/ai/web/react/react-router/src/routes/ai.tsx.hbs +156 -6
- package/templates/examples/ai/web/react/tanstack-router/src/routes/ai.tsx.hbs +156 -4
- package/templates/examples/ai/web/react/tanstack-start/src/routes/ai.tsx.hbs +159 -6
- package/templates/frontend/react/next/package.json.hbs +8 -7
- package/templates/frontend/react/next/src/app/layout.tsx.hbs +28 -1
- package/templates/frontend/react/next/src/components/mode-toggle.tsx.hbs +4 -6
- package/templates/frontend/react/next/src/components/providers.tsx.hbs +14 -4
- package/templates/frontend/react/react-router/package.json.hbs +2 -1
- package/templates/frontend/react/{tanstack-router/src/components/mode-toggle.tsx → react-router/src/components/mode-toggle.tsx.hbs} +4 -6
- package/templates/frontend/react/tanstack-router/package.json.hbs +2 -1
- package/templates/frontend/react/{react-router/src/components/mode-toggle.tsx → tanstack-router/src/components/mode-toggle.tsx.hbs} +4 -6
- package/templates/frontend/react/tanstack-start/package.json.hbs +2 -1
- package/templates/frontend/react/tanstack-start/src/router.tsx.hbs +6 -0
- package/templates/frontend/react/tanstack-start/src/routes/__root.tsx.hbs +13 -14
- package/templates/frontend/react/tanstack-start/vite.config.ts.hbs +5 -0
- package/templates/frontend/react/web-base/components.json +5 -2
- package/templates/frontend/react/web-base/src/components/ui/button.tsx.hbs +57 -0
- package/templates/frontend/react/web-base/src/components/ui/card.tsx.hbs +103 -0
- package/templates/frontend/react/web-base/src/components/ui/checkbox.tsx.hbs +26 -0
- package/templates/frontend/react/web-base/src/components/ui/dropdown-menu.tsx.hbs +262 -0
- package/templates/frontend/react/web-base/src/components/ui/input.tsx.hbs +20 -0
- package/templates/frontend/react/web-base/src/components/ui/label.tsx.hbs +20 -0
- package/templates/frontend/react/web-base/src/components/ui/skeleton.tsx.hbs +13 -0
- package/templates/frontend/react/web-base/src/components/ui/sonner.tsx.hbs +44 -0
- package/templates/frontend/react/web-base/src/index.css.hbs +58 -64
- package/dist/cli.d.mts +0 -1
- package/dist/cli.mjs +0 -8
- package/dist/index.d.mts +0 -347
- package/dist/index.mjs +0 -4
- package/dist/src-DLvUK0Qf.mjs +0 -7069
- package/templates/auth/better-auth/convex/backend/convex/convex.config.ts.hbs +0 -7
- package/templates/examples/ai/web/react/base/src/components/response.tsx.hbs +0 -22
- package/templates/frontend/react/web-base/src/components/ui/button.tsx +0 -56
- package/templates/frontend/react/web-base/src/components/ui/card.tsx +0 -75
- package/templates/frontend/react/web-base/src/components/ui/checkbox.tsx +0 -27
- package/templates/frontend/react/web-base/src/components/ui/dropdown-menu.tsx +0 -228
- package/templates/frontend/react/web-base/src/components/ui/input.tsx +0 -21
- package/templates/frontend/react/web-base/src/components/ui/label.tsx +0 -19
- package/templates/frontend/react/web-base/src/components/ui/skeleton.tsx +0 -13
- package/templates/frontend/react/web-base/src/components/ui/sonner.tsx +0 -25
- /package/templates/auth/better-auth/web/react/tanstack-router/src/components/{sign-in-form.tsx → sign-in-form.tsx.hbs} +0 -0
- /package/templates/auth/better-auth/web/react/tanstack-router/src/components/{sign-up-form.tsx → sign-up-form.tsx.hbs} +0 -0
- /package/templates/auth/better-auth/web/react/tanstack-router/src/routes/{login.tsx → login.tsx.hbs} +0 -0
- /package/templates/auth/better-auth/web/react/tanstack-start/src/components/{sign-in-form.tsx → sign-in-form.tsx.hbs} +0 -0
- /package/templates/auth/better-auth/web/react/tanstack-start/src/components/{sign-up-form.tsx → sign-up-form.tsx.hbs} +0 -0
- /package/templates/auth/better-auth/web/react/tanstack-start/src/routes/{login.tsx → login.tsx.hbs} +0 -0
- /package/templates/auth/better-auth/web/solid/src/components/{sign-in-form.tsx → sign-in-form.tsx.hbs} +0 -0
- /package/templates/auth/better-auth/web/solid/src/components/{sign-up-form.tsx → sign-up-form.tsx.hbs} +0 -0
- /package/templates/auth/better-auth/web/solid/src/routes/{login.tsx → login.tsx.hbs} +0 -0
- /package/templates/frontend/react/react-router/src/components/{theme-provider.tsx → theme-provider.tsx.hbs} +0 -0
- /package/templates/frontend/react/tanstack-router/src/components/{theme-provider.tsx → theme-provider.tsx.hbs} +0 -0
- /package/templates/frontend/react/web-base/src/lib/{utils.ts → utils.ts.hbs} +0 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { log } from "@clack/prompts";
|
|
2
|
+
import fs from "fs-extra";
|
|
3
|
+
import type { ProjectConfig } from "../../types";
|
|
4
|
+
import { writeBtsConfig } from "../../utils/bts-config";
|
|
5
|
+
import { exitWithError } from "../../utils/errors";
|
|
6
|
+
import { setupCatalogs } from "../../utils/setup-catalogs";
|
|
7
|
+
import { setupAddons } from "../addons/addons-setup";
|
|
8
|
+
import { setupExamples } from "../addons/examples-setup";
|
|
9
|
+
import { setupApi } from "../core/api-setup";
|
|
10
|
+
import { setupBackendDependencies } from "../core/backend-setup";
|
|
11
|
+
import { setupDatabase } from "../core/db-setup";
|
|
12
|
+
import { setupRuntime } from "../core/runtime-setup";
|
|
13
|
+
import { setupServerDeploy } from "../deployment/server-deploy-setup";
|
|
14
|
+
import { setupWebDeploy } from "../deployment/web-deploy-setup";
|
|
15
|
+
import { setupAuth } from "./auth-setup";
|
|
16
|
+
import { createReadme } from "./create-readme";
|
|
17
|
+
import { setupEnvironmentVariables } from "./env-setup";
|
|
18
|
+
import { initializeGit } from "./git";
|
|
19
|
+
import { installDependencies } from "./install-dependencies";
|
|
20
|
+
import { setupPayments } from "./payments-setup";
|
|
21
|
+
import { displayPostInstallInstructions } from "./post-installation";
|
|
22
|
+
import { updatePackageConfigurations } from "./project-config";
|
|
23
|
+
import {
|
|
24
|
+
copyBaseTemplate,
|
|
25
|
+
handleExtras,
|
|
26
|
+
setupAddonsTemplate,
|
|
27
|
+
setupAuthTemplate,
|
|
28
|
+
setupBackendFramework,
|
|
29
|
+
setupDeploymentTemplates,
|
|
30
|
+
setupDockerComposeTemplates,
|
|
31
|
+
setupExamplesTemplate,
|
|
32
|
+
setupFrontendTemplates,
|
|
33
|
+
setupPaymentsTemplate,
|
|
34
|
+
} from "./template-manager";
|
|
35
|
+
|
|
36
|
+
export async function createProject(options: ProjectConfig, cliInput?: { manualDb?: boolean }) {
|
|
37
|
+
const projectDir = options.projectDir;
|
|
38
|
+
const isConvex = options.backend === "convex";
|
|
39
|
+
const isSelfBackend = options.backend === "self";
|
|
40
|
+
const needsServerSetup = !isConvex && !isSelfBackend;
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
await fs.ensureDir(projectDir);
|
|
44
|
+
|
|
45
|
+
await copyBaseTemplate(projectDir, options);
|
|
46
|
+
await setupFrontendTemplates(projectDir, options);
|
|
47
|
+
|
|
48
|
+
await setupBackendFramework(projectDir, options);
|
|
49
|
+
|
|
50
|
+
if (needsServerSetup || (isSelfBackend && options.dbSetup === "docker")) {
|
|
51
|
+
await setupDockerComposeTemplates(projectDir, options);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
await setupAuthTemplate(projectDir, options);
|
|
55
|
+
if (options.payments && options.payments !== "none") {
|
|
56
|
+
await setupPaymentsTemplate(projectDir, options);
|
|
57
|
+
}
|
|
58
|
+
if (options.examples.length > 0 && options.examples[0] !== "none") {
|
|
59
|
+
await setupExamplesTemplate(projectDir, options);
|
|
60
|
+
}
|
|
61
|
+
await setupAddonsTemplate(projectDir, options);
|
|
62
|
+
|
|
63
|
+
await setupDeploymentTemplates(projectDir, options);
|
|
64
|
+
|
|
65
|
+
await setupApi(options);
|
|
66
|
+
|
|
67
|
+
if (isConvex || needsServerSetup) {
|
|
68
|
+
await setupBackendDependencies(options);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (!isConvex) {
|
|
72
|
+
if (needsServerSetup) {
|
|
73
|
+
await setupRuntime(options);
|
|
74
|
+
}
|
|
75
|
+
await setupDatabase(options, cliInput);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (options.examples.length > 0 && options.examples[0] !== "none") {
|
|
79
|
+
await setupExamples(options);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (options.addons.length > 0 && options.addons[0] !== "none") {
|
|
83
|
+
await setupAddons(options);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (options.auth && options.auth !== "none") {
|
|
87
|
+
await setupAuth(options);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (options.payments && options.payments !== "none") {
|
|
91
|
+
await setupPayments(options);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
await handleExtras(projectDir, options);
|
|
95
|
+
|
|
96
|
+
await setupEnvironmentVariables(options);
|
|
97
|
+
await updatePackageConfigurations(projectDir, options);
|
|
98
|
+
|
|
99
|
+
await setupWebDeploy(options);
|
|
100
|
+
await setupServerDeploy(options);
|
|
101
|
+
|
|
102
|
+
await setupCatalogs(projectDir, options);
|
|
103
|
+
|
|
104
|
+
await createReadme(projectDir, options);
|
|
105
|
+
|
|
106
|
+
await writeBtsConfig(options);
|
|
107
|
+
|
|
108
|
+
log.success("Project template successfully scaffolded!");
|
|
109
|
+
|
|
110
|
+
if (options.install) {
|
|
111
|
+
await installDependencies({
|
|
112
|
+
projectDir,
|
|
113
|
+
packageManager: options.packageManager,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
await initializeGit(projectDir, options.git);
|
|
118
|
+
|
|
119
|
+
await displayPostInstallInstructions({
|
|
120
|
+
...options,
|
|
121
|
+
depsInstalled: options.install,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
return projectDir;
|
|
125
|
+
} catch (error) {
|
|
126
|
+
if (error instanceof Error) {
|
|
127
|
+
console.error(error.stack);
|
|
128
|
+
exitWithError(`Error during project creation: ${error.message}`);
|
|
129
|
+
} else {
|
|
130
|
+
console.error(error);
|
|
131
|
+
exitWithError(`An unexpected error occurred: ${String(error)}`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|