create-better-t-stack 3.17.0 → 3.18.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/dist/cli.mjs +1 -1
- package/dist/index.d.mts +132 -95
- package/dist/index.mjs +2 -2
- package/dist/{src-D5L84uxt.mjs → src-R2RWz37j.mjs} +1993 -1486
- package/dist/virtual.d.mts +2 -2
- package/dist/virtual.mjs +2 -2
- package/package.json +12 -11
package/dist/cli.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,121 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import * as _orpc_server0 from "@orpc/server";
|
|
3
|
+
import * as better_result0 from "better-result";
|
|
4
|
+
import { Result, Result as Result$1 } from "better-result";
|
|
3
5
|
import * as trpc_cli0 from "trpc-cli";
|
|
4
6
|
import z from "zod";
|
|
5
|
-
import { EMBEDDED_TEMPLATES,
|
|
7
|
+
import { EMBEDDED_TEMPLATES, GeneratorError, GeneratorError as GeneratorError$1, GeneratorOptions, TEMPLATE_COUNT, VirtualDirectory, VirtualFile, VirtualFileSystem, VirtualFileTree, VirtualFileTree as VirtualFileTree$1, VirtualNode, generate } from "@better-t-stack/template-generator";
|
|
6
8
|
|
|
7
9
|
//#region src/types.d.ts
|
|
8
10
|
|
|
9
11
|
import * as import__better_t_stack_types from "@better-t-stack/types";
|
|
10
12
|
//#endregion
|
|
13
|
+
//#region src/helpers/core/command-handlers.d.ts
|
|
14
|
+
/**
|
|
15
|
+
* Result type for project creation
|
|
16
|
+
*/
|
|
17
|
+
interface CreateProjectResult {
|
|
18
|
+
success: boolean;
|
|
19
|
+
projectConfig: types_d_exports.ProjectConfig;
|
|
20
|
+
reproducibleCommand: string;
|
|
21
|
+
timeScaffolded: string;
|
|
22
|
+
elapsedTimeMs: number;
|
|
23
|
+
projectDirectory: string;
|
|
24
|
+
relativePath: string;
|
|
25
|
+
error?: string;
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/utils/errors.d.ts
|
|
29
|
+
declare const UserCancelledError_base: better_result0.TaggedErrorClass<"UserCancelledError", {
|
|
30
|
+
message: string;
|
|
31
|
+
}>;
|
|
32
|
+
/**
|
|
33
|
+
* User cancelled the operation (e.g., Ctrl+C in prompts)
|
|
34
|
+
*/
|
|
35
|
+
declare class UserCancelledError extends UserCancelledError_base {
|
|
36
|
+
constructor(args?: {
|
|
37
|
+
message?: string;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
declare const CLIError_base: better_result0.TaggedErrorClass<"CLIError", {
|
|
41
|
+
message: string;
|
|
42
|
+
cause?: unknown;
|
|
43
|
+
}>;
|
|
44
|
+
/**
|
|
45
|
+
* General CLI error for validation failures, invalid flags, etc.
|
|
46
|
+
*/
|
|
47
|
+
declare class CLIError extends CLIError_base {}
|
|
48
|
+
declare const ValidationError_base: better_result0.TaggedErrorClass<"ValidationError", {
|
|
49
|
+
field?: string;
|
|
50
|
+
value?: unknown;
|
|
51
|
+
message: string;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* Validation error for config/flag validation failures
|
|
55
|
+
*/
|
|
56
|
+
declare class ValidationError extends ValidationError_base {
|
|
57
|
+
constructor(args: {
|
|
58
|
+
field?: string;
|
|
59
|
+
value?: unknown;
|
|
60
|
+
message: string;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
declare const CompatibilityError_base: better_result0.TaggedErrorClass<"CompatibilityError", {
|
|
64
|
+
options: string[];
|
|
65
|
+
message: string;
|
|
66
|
+
}>;
|
|
67
|
+
/**
|
|
68
|
+
* Compatibility error for incompatible option combinations
|
|
69
|
+
*/
|
|
70
|
+
declare class CompatibilityError extends CompatibilityError_base {
|
|
71
|
+
constructor(args: {
|
|
72
|
+
options: string[];
|
|
73
|
+
message: string;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
declare const DirectoryConflictError_base: better_result0.TaggedErrorClass<"DirectoryConflictError", {
|
|
77
|
+
directory: string;
|
|
78
|
+
message: string;
|
|
79
|
+
}>;
|
|
80
|
+
/**
|
|
81
|
+
* Directory conflict error when target directory exists and is not empty
|
|
82
|
+
*/
|
|
83
|
+
declare class DirectoryConflictError extends DirectoryConflictError_base {
|
|
84
|
+
constructor(args: {
|
|
85
|
+
directory: string;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
declare const ProjectCreationError_base: better_result0.TaggedErrorClass<"ProjectCreationError", {
|
|
89
|
+
phase: string;
|
|
90
|
+
message: string;
|
|
91
|
+
cause?: unknown;
|
|
92
|
+
}>;
|
|
93
|
+
/**
|
|
94
|
+
* Project creation error for failures during scaffolding
|
|
95
|
+
*/
|
|
96
|
+
declare class ProjectCreationError extends ProjectCreationError_base {
|
|
97
|
+
constructor(args: {
|
|
98
|
+
phase: string;
|
|
99
|
+
message: string;
|
|
100
|
+
cause?: unknown;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
declare const DatabaseSetupError_base: better_result0.TaggedErrorClass<"DatabaseSetupError", {
|
|
104
|
+
provider: string;
|
|
105
|
+
message: string;
|
|
106
|
+
cause?: unknown;
|
|
107
|
+
}>;
|
|
108
|
+
/**
|
|
109
|
+
* Database setup error for failures during database configuration
|
|
110
|
+
*/
|
|
111
|
+
declare class DatabaseSetupError extends DatabaseSetupError_base {
|
|
112
|
+
constructor(args: {
|
|
113
|
+
provider: string;
|
|
114
|
+
message: string;
|
|
115
|
+
cause?: unknown;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
11
119
|
//#region src/index.d.ts
|
|
12
120
|
declare const router: {
|
|
13
121
|
create: _orpc_server0.Procedure<_orpc_server0.MergedInitialContext<Record<never, never>, Record<never, never>, Record<never, never>>, Record<never, never>, z.ZodTuple<[z.ZodOptional<z.ZodString>, z.ZodObject<{
|
|
@@ -133,95 +241,23 @@ declare const router: {
|
|
|
133
241
|
renderTitle: z.ZodOptional<z.ZodBoolean>;
|
|
134
242
|
disableAnalytics: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
135
243
|
manualDb: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
136
|
-
}, z.core.$strip>], null>, _orpc_server0.Schema<
|
|
137
|
-
success: boolean;
|
|
138
|
-
projectConfig: {
|
|
139
|
-
projectName: string;
|
|
140
|
-
projectDir: string;
|
|
141
|
-
relativePath: string;
|
|
142
|
-
database: "none" | "sqlite" | "postgres" | "mysql" | "mongodb";
|
|
143
|
-
orm: "none" | "drizzle" | "prisma" | "mongoose";
|
|
144
|
-
backend: "none" | "hono" | "express" | "fastify" | "elysia" | "convex" | "self";
|
|
145
|
-
runtime: "none" | "bun" | "node" | "workers";
|
|
146
|
-
frontend: ("none" | "tanstack-router" | "react-router" | "tanstack-start" | "next" | "nuxt" | "native-bare" | "native-uniwind" | "native-unistyles" | "svelte" | "solid" | "astro")[];
|
|
147
|
-
addons: ("none" | "pwa" | "tauri" | "starlight" | "biome" | "lefthook" | "husky" | "ruler" | "turborepo" | "fumadocs" | "ultracite" | "oxlint" | "opentui" | "wxt")[];
|
|
148
|
-
examples: ("none" | "todo" | "ai")[];
|
|
149
|
-
auth: "none" | "better-auth" | "clerk";
|
|
150
|
-
payments: "none" | "polar";
|
|
151
|
-
git: boolean;
|
|
152
|
-
packageManager: "bun" | "npm" | "pnpm";
|
|
153
|
-
install: boolean;
|
|
154
|
-
dbSetup: "none" | "turso" | "neon" | "prisma-postgres" | "planetscale" | "mongodb-atlas" | "supabase" | "d1" | "docker";
|
|
155
|
-
api: "none" | "trpc" | "orpc";
|
|
156
|
-
webDeploy: "none" | "cloudflare";
|
|
157
|
-
serverDeploy: "none" | "cloudflare";
|
|
158
|
-
};
|
|
159
|
-
reproducibleCommand: string;
|
|
160
|
-
timeScaffolded: string;
|
|
161
|
-
elapsedTimeMs: number;
|
|
162
|
-
projectDirectory: string;
|
|
163
|
-
relativePath: string;
|
|
164
|
-
error?: undefined;
|
|
165
|
-
} | {
|
|
166
|
-
success: boolean;
|
|
167
|
-
error: string;
|
|
168
|
-
projectConfig: types_d_exports.ProjectConfig;
|
|
169
|
-
reproducibleCommand: string;
|
|
170
|
-
timeScaffolded: string;
|
|
171
|
-
elapsedTimeMs: number;
|
|
172
|
-
projectDirectory: string;
|
|
173
|
-
relativePath: string;
|
|
174
|
-
} | undefined, {
|
|
175
|
-
success: boolean;
|
|
176
|
-
projectConfig: {
|
|
177
|
-
projectName: string;
|
|
178
|
-
projectDir: string;
|
|
179
|
-
relativePath: string;
|
|
180
|
-
database: "none" | "sqlite" | "postgres" | "mysql" | "mongodb";
|
|
181
|
-
orm: "none" | "drizzle" | "prisma" | "mongoose";
|
|
182
|
-
backend: "none" | "hono" | "express" | "fastify" | "elysia" | "convex" | "self";
|
|
183
|
-
runtime: "none" | "bun" | "node" | "workers";
|
|
184
|
-
frontend: ("none" | "tanstack-router" | "react-router" | "tanstack-start" | "next" | "nuxt" | "native-bare" | "native-uniwind" | "native-unistyles" | "svelte" | "solid" | "astro")[];
|
|
185
|
-
addons: ("none" | "pwa" | "tauri" | "starlight" | "biome" | "lefthook" | "husky" | "ruler" | "turborepo" | "fumadocs" | "ultracite" | "oxlint" | "opentui" | "wxt")[];
|
|
186
|
-
examples: ("none" | "todo" | "ai")[];
|
|
187
|
-
auth: "none" | "better-auth" | "clerk";
|
|
188
|
-
payments: "none" | "polar";
|
|
189
|
-
git: boolean;
|
|
190
|
-
packageManager: "bun" | "npm" | "pnpm";
|
|
191
|
-
install: boolean;
|
|
192
|
-
dbSetup: "none" | "turso" | "neon" | "prisma-postgres" | "planetscale" | "mongodb-atlas" | "supabase" | "d1" | "docker";
|
|
193
|
-
api: "none" | "trpc" | "orpc";
|
|
194
|
-
webDeploy: "none" | "cloudflare";
|
|
195
|
-
serverDeploy: "none" | "cloudflare";
|
|
196
|
-
};
|
|
197
|
-
reproducibleCommand: string;
|
|
198
|
-
timeScaffolded: string;
|
|
199
|
-
elapsedTimeMs: number;
|
|
200
|
-
projectDirectory: string;
|
|
201
|
-
relativePath: string;
|
|
202
|
-
error?: undefined;
|
|
203
|
-
} | {
|
|
204
|
-
success: boolean;
|
|
205
|
-
error: string;
|
|
206
|
-
projectConfig: types_d_exports.ProjectConfig;
|
|
207
|
-
reproducibleCommand: string;
|
|
208
|
-
timeScaffolded: string;
|
|
209
|
-
elapsedTimeMs: number;
|
|
210
|
-
projectDirectory: string;
|
|
211
|
-
relativePath: string;
|
|
212
|
-
} | undefined>, _orpc_server0.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
244
|
+
}, z.core.$strip>], null>, _orpc_server0.Schema<CreateProjectResult | undefined, CreateProjectResult | undefined>, _orpc_server0.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
213
245
|
sponsors: _orpc_server0.Procedure<_orpc_server0.MergedInitialContext<Record<never, never>, Record<never, never>, Record<never, never>>, Record<never, never>, _orpc_server0.Schema<unknown, unknown>, _orpc_server0.Schema<void, void>, _orpc_server0.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
214
246
|
docs: _orpc_server0.Procedure<_orpc_server0.MergedInitialContext<Record<never, never>, Record<never, never>, Record<never, never>>, Record<never, never>, _orpc_server0.Schema<unknown, unknown>, _orpc_server0.Schema<void, void>, _orpc_server0.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
215
247
|
builder: _orpc_server0.Procedure<_orpc_server0.MergedInitialContext<Record<never, never>, Record<never, never>, Record<never, never>>, Record<never, never>, _orpc_server0.Schema<unknown, unknown>, _orpc_server0.Schema<void, void>, _orpc_server0.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
216
248
|
};
|
|
217
249
|
declare function createBtsCli(): trpc_cli0.TrpcCli;
|
|
250
|
+
/**
|
|
251
|
+
* Error types that can be returned from create/createVirtual
|
|
252
|
+
*/
|
|
253
|
+
type CreateError = UserCancelledError | CLIError | ProjectCreationError;
|
|
218
254
|
/**
|
|
219
255
|
* Programmatic API to create a new Better-T-Stack project.
|
|
220
|
-
* Returns
|
|
256
|
+
* Returns a Result type - no console output, no interactive prompts.
|
|
221
257
|
*
|
|
222
258
|
* @example
|
|
223
259
|
* ```typescript
|
|
224
|
-
* import { create } from "create-better-t-stack";
|
|
260
|
+
* import { create, Result } from "create-better-t-stack";
|
|
225
261
|
*
|
|
226
262
|
* const result = await create("my-app", {
|
|
227
263
|
* frontend: ["tanstack-router"],
|
|
@@ -231,23 +267,27 @@ declare function createBtsCli(): trpc_cli0.TrpcCli;
|
|
|
231
267
|
* orm: "drizzle",
|
|
232
268
|
* });
|
|
233
269
|
*
|
|
234
|
-
*
|
|
235
|
-
* console.log(`Project created at: ${
|
|
236
|
-
* }
|
|
270
|
+
* result.match({
|
|
271
|
+
* ok: (data) => console.log(`Project created at: ${data.projectDirectory}`),
|
|
272
|
+
* err: (error) => console.error(`Failed: ${error.message}`),
|
|
273
|
+
* });
|
|
274
|
+
*
|
|
275
|
+
* // Or use unwrapOr for a default value
|
|
276
|
+
* const data = result.unwrapOr(null);
|
|
237
277
|
* ```
|
|
238
278
|
*/
|
|
239
|
-
declare function create(projectName?: string, options?: Partial<types_d_exports.CreateInput>): Promise<types_d_exports.InitResult
|
|
279
|
+
declare function create(projectName?: string, options?: Partial<types_d_exports.CreateInput>): Promise<Result$1<types_d_exports.InitResult, CreateError>>;
|
|
240
280
|
declare function sponsors(): Promise<void>;
|
|
241
281
|
declare function docs(): Promise<void>;
|
|
242
282
|
declare function builder(): Promise<void>;
|
|
243
283
|
/**
|
|
244
284
|
* Programmatic API to generate a project in-memory (virtual filesystem).
|
|
245
|
-
* Returns a VirtualFileTree without writing to disk.
|
|
285
|
+
* Returns a Result with a VirtualFileTree without writing to disk.
|
|
246
286
|
* Useful for web previews and testing.
|
|
247
287
|
*
|
|
248
288
|
* @example
|
|
249
289
|
* ```typescript
|
|
250
|
-
* import { createVirtual, EMBEDDED_TEMPLATES } from "create-better-t-stack";
|
|
290
|
+
* import { createVirtual, EMBEDDED_TEMPLATES, Result } from "create-better-t-stack";
|
|
251
291
|
*
|
|
252
292
|
* const result = await createVirtual({
|
|
253
293
|
* frontend: ["tanstack-router"],
|
|
@@ -257,16 +297,13 @@ declare function builder(): Promise<void>;
|
|
|
257
297
|
* orm: "drizzle",
|
|
258
298
|
* });
|
|
259
299
|
*
|
|
260
|
-
*
|
|
261
|
-
* console.log(`Generated ${
|
|
262
|
-
* }
|
|
300
|
+
* result.match({
|
|
301
|
+
* ok: (tree) => console.log(`Generated ${tree.fileCount} files`),
|
|
302
|
+
* err: (error) => console.error(`Failed: ${error.message}`),
|
|
303
|
+
* });
|
|
263
304
|
* ```
|
|
264
305
|
*/
|
|
265
|
-
declare function createVirtual(options: Partial<Omit<types_d_exports.ProjectConfig, "projectDir" | "relativePath">>): Promise<
|
|
266
|
-
success: boolean;
|
|
267
|
-
tree?: VirtualFileTree$1;
|
|
268
|
-
error?: string;
|
|
269
|
-
}>;
|
|
306
|
+
declare function createVirtual(options: Partial<Omit<types_d_exports.ProjectConfig, "projectDir" | "relativePath">>): Promise<Result$1<VirtualFileTree$1, GeneratorError$1>>;
|
|
270
307
|
type API = import__better_t_stack_types.API;
|
|
271
308
|
type Addons = import__better_t_stack_types.Addons;
|
|
272
309
|
type Auth = import__better_t_stack_types.Auth;
|
|
@@ -286,4 +323,4 @@ type Runtime = import__better_t_stack_types.Runtime;
|
|
|
286
323
|
type ServerDeploy = import__better_t_stack_types.ServerDeploy;
|
|
287
324
|
type Template = import__better_t_stack_types.Template;
|
|
288
325
|
type WebDeploy = import__better_t_stack_types.WebDeploy;
|
|
289
|
-
export { type API, type Addons, type Auth, type Backend, type BetterTStackConfig, type CreateInput, type Database, type DatabaseSetup, type DirectoryConflict, EMBEDDED_TEMPLATES, type Examples, type Frontend,
|
|
326
|
+
export { type API, type Addons, type Auth, type Backend, type BetterTStackConfig, CLIError, CompatibilityError, CreateError, type CreateInput, type Database, type DatabaseSetup, DatabaseSetupError, type DirectoryConflict, DirectoryConflictError, EMBEDDED_TEMPLATES, type Examples, type Frontend, GeneratorError, type GeneratorOptions, type InitResult, type ORM, type PackageManager, type Payments, ProjectCreationError, Result, type Runtime, type ServerDeploy, TEMPLATE_COUNT, type Template, UserCancelledError, ValidationError, type VirtualDirectory, type VirtualFile, VirtualFileSystem, type VirtualFileTree, type VirtualNode, type WebDeploy, builder, create, createBtsCli, createVirtual, docs, generate, router, sponsors };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as
|
|
2
|
+
import { _ as DirectoryConflictError, a as VirtualFileSystem, b as ValidationError, c as createBtsCli, d as generate, f as router, g as DatabaseSetupError, h as CompatibilityError, i as TEMPLATE_COUNT, l as createVirtual, m as CLIError, n as GeneratorError, o as builder, p as sponsors, r as Result, s as create, t as EMBEDDED_TEMPLATES, u as docs, v as ProjectCreationError, y as UserCancelledError } from "./src-R2RWz37j.mjs";
|
|
3
3
|
|
|
4
|
-
export { EMBEDDED_TEMPLATES, TEMPLATE_COUNT, VirtualFileSystem, builder, create, createBtsCli, createVirtual, docs,
|
|
4
|
+
export { CLIError, CompatibilityError, DatabaseSetupError, DirectoryConflictError, EMBEDDED_TEMPLATES, GeneratorError, ProjectCreationError, Result, TEMPLATE_COUNT, UserCancelledError, ValidationError, VirtualFileSystem, builder, create, createBtsCli, createVirtual, docs, generate, router, sponsors };
|