create-better-t-stack 3.38.0 → 3.38.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/cli.mjs +1 -1
- package/dist/index.d.mts +62 -62
- package/dist/index.mjs +1 -1
- package/dist/{src-Cbu9a6bq.mjs → src-ihjK9T9S.mjs} +70 -62
- package/package.json +4 -4
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { _ as types_exports, i as SchemaNameSchema, l as create, m as getSchemaResult, s as add, u as createBtsCli, v as getLatestCLIVersion } from "./src-
|
|
2
|
+
import { _ as types_exports, i as SchemaNameSchema, l as create, m as getSchemaResult, s as add, u as createBtsCli, v as getLatestCLIVersion } from "./src-ihjK9T9S.mjs";
|
|
3
3
|
import z from "zod";
|
|
4
4
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
5
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
package/dist/index.d.mts
CHANGED
|
@@ -5,115 +5,90 @@ import z from "zod";
|
|
|
5
5
|
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
6
|
import * as import__better_t_stack_types from "@better-t-stack/types";
|
|
7
7
|
//#endregion
|
|
8
|
-
//#region src/helpers/core/command-handlers.d.ts
|
|
9
|
-
/**
|
|
10
|
-
* Result type for project creation
|
|
11
|
-
*/
|
|
12
|
-
interface CreateProjectResult {
|
|
13
|
-
success: boolean;
|
|
14
|
-
projectConfig: types_d_exports.ProjectConfig;
|
|
15
|
-
reproducibleCommand: string;
|
|
16
|
-
timeScaffolded: string;
|
|
17
|
-
elapsedTimeMs: number;
|
|
18
|
-
projectDirectory: string;
|
|
19
|
-
relativePath: string;
|
|
20
|
-
error?: string;
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region src/helpers/core/add-handler.d.ts
|
|
24
|
-
interface AddResult {
|
|
25
|
-
success: boolean;
|
|
26
|
-
addedAddons: types_d_exports.Addons[];
|
|
27
|
-
projectDir: string;
|
|
28
|
-
dryRun?: boolean;
|
|
29
|
-
plannedFileCount?: number;
|
|
30
|
-
error?: string;
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
33
8
|
//#region src/utils/errors.d.ts
|
|
34
|
-
declare const UserCancelledError_base: import("better-result").TaggedErrorClass<"UserCancelledError"
|
|
35
|
-
message: string;
|
|
36
|
-
}>;
|
|
9
|
+
declare const UserCancelledError_base: import("better-result").TaggedErrorClass<"UserCancelledError">;
|
|
37
10
|
/**
|
|
38
11
|
* User cancelled the operation (e.g., Ctrl+C in prompts)
|
|
39
12
|
*/
|
|
40
|
-
declare class UserCancelledError extends UserCancelledError_base
|
|
13
|
+
declare class UserCancelledError extends UserCancelledError_base<{
|
|
14
|
+
message: string;
|
|
15
|
+
}> {
|
|
41
16
|
constructor(args?: {
|
|
42
17
|
message?: string;
|
|
43
18
|
});
|
|
44
19
|
}
|
|
45
|
-
declare const CLIError_base: import("better-result").TaggedErrorClass<"CLIError"
|
|
46
|
-
message: string;
|
|
47
|
-
cause?: unknown;
|
|
48
|
-
}>;
|
|
20
|
+
declare const CLIError_base: import("better-result").TaggedErrorClass<"CLIError">;
|
|
49
21
|
/**
|
|
50
22
|
* General CLI error for validation failures, invalid flags, etc.
|
|
51
23
|
*/
|
|
52
|
-
declare class CLIError extends CLIError_base
|
|
53
|
-
declare const ValidationError_base: import("better-result").TaggedErrorClass<"ValidationError", {
|
|
54
|
-
field?: string;
|
|
55
|
-
value?: unknown;
|
|
24
|
+
declare class CLIError extends CLIError_base<{
|
|
56
25
|
message: string;
|
|
57
|
-
|
|
26
|
+
cause?: unknown;
|
|
27
|
+
}> {}
|
|
28
|
+
declare const ValidationError_base: import("better-result").TaggedErrorClass<"ValidationError">;
|
|
58
29
|
/**
|
|
59
30
|
* Validation error for config/flag validation failures
|
|
60
31
|
*/
|
|
61
|
-
declare class ValidationError extends ValidationError_base
|
|
32
|
+
declare class ValidationError extends ValidationError_base<{
|
|
33
|
+
field?: string;
|
|
34
|
+
value?: unknown;
|
|
35
|
+
message: string;
|
|
36
|
+
}> {
|
|
62
37
|
constructor(args: {
|
|
63
38
|
field?: string;
|
|
64
39
|
value?: unknown;
|
|
65
40
|
message: string;
|
|
66
41
|
});
|
|
67
42
|
}
|
|
68
|
-
declare const CompatibilityError_base: import("better-result").TaggedErrorClass<"CompatibilityError"
|
|
69
|
-
options: string[];
|
|
70
|
-
message: string;
|
|
71
|
-
}>;
|
|
43
|
+
declare const CompatibilityError_base: import("better-result").TaggedErrorClass<"CompatibilityError">;
|
|
72
44
|
/**
|
|
73
45
|
* Compatibility error for incompatible option combinations
|
|
74
46
|
*/
|
|
75
|
-
declare class CompatibilityError extends CompatibilityError_base
|
|
47
|
+
declare class CompatibilityError extends CompatibilityError_base<{
|
|
48
|
+
options: string[];
|
|
49
|
+
message: string;
|
|
50
|
+
}> {
|
|
76
51
|
constructor(args: {
|
|
77
52
|
options: string[];
|
|
78
53
|
message: string;
|
|
79
54
|
});
|
|
80
55
|
}
|
|
81
|
-
declare const DirectoryConflictError_base: import("better-result").TaggedErrorClass<"DirectoryConflictError"
|
|
82
|
-
directory: string;
|
|
83
|
-
message: string;
|
|
84
|
-
}>;
|
|
56
|
+
declare const DirectoryConflictError_base: import("better-result").TaggedErrorClass<"DirectoryConflictError">;
|
|
85
57
|
/**
|
|
86
58
|
* Directory conflict error when target directory exists and is not empty
|
|
87
59
|
*/
|
|
88
|
-
declare class DirectoryConflictError extends DirectoryConflictError_base
|
|
60
|
+
declare class DirectoryConflictError extends DirectoryConflictError_base<{
|
|
61
|
+
directory: string;
|
|
62
|
+
message: string;
|
|
63
|
+
}> {
|
|
89
64
|
constructor(args: {
|
|
90
65
|
directory: string;
|
|
91
66
|
});
|
|
92
67
|
}
|
|
93
|
-
declare const ProjectCreationError_base: import("better-result").TaggedErrorClass<"ProjectCreationError"
|
|
94
|
-
phase: string;
|
|
95
|
-
message: string;
|
|
96
|
-
cause?: unknown;
|
|
97
|
-
}>;
|
|
68
|
+
declare const ProjectCreationError_base: import("better-result").TaggedErrorClass<"ProjectCreationError">;
|
|
98
69
|
/**
|
|
99
70
|
* Project creation error for failures during scaffolding
|
|
100
71
|
*/
|
|
101
|
-
declare class ProjectCreationError extends ProjectCreationError_base
|
|
72
|
+
declare class ProjectCreationError extends ProjectCreationError_base<{
|
|
73
|
+
phase: string;
|
|
74
|
+
message: string;
|
|
75
|
+
cause?: unknown;
|
|
76
|
+
}> {
|
|
102
77
|
constructor(args: {
|
|
103
78
|
phase: string;
|
|
104
79
|
message: string;
|
|
105
80
|
cause?: unknown;
|
|
106
81
|
});
|
|
107
82
|
}
|
|
108
|
-
declare const DatabaseSetupError_base: import("better-result").TaggedErrorClass<"DatabaseSetupError"
|
|
109
|
-
provider: string;
|
|
110
|
-
message: string;
|
|
111
|
-
cause?: unknown;
|
|
112
|
-
}>;
|
|
83
|
+
declare const DatabaseSetupError_base: import("better-result").TaggedErrorClass<"DatabaseSetupError">;
|
|
113
84
|
/**
|
|
114
85
|
* Database setup error for failures during database configuration
|
|
115
86
|
*/
|
|
116
|
-
declare class DatabaseSetupError extends DatabaseSetupError_base
|
|
87
|
+
declare class DatabaseSetupError extends DatabaseSetupError_base<{
|
|
88
|
+
provider: string;
|
|
89
|
+
message: string;
|
|
90
|
+
cause?: unknown;
|
|
91
|
+
}> {
|
|
117
92
|
constructor(args: {
|
|
118
93
|
provider: string;
|
|
119
94
|
message: string;
|
|
@@ -121,6 +96,31 @@ declare class DatabaseSetupError extends DatabaseSetupError_base {
|
|
|
121
96
|
});
|
|
122
97
|
}
|
|
123
98
|
//#endregion
|
|
99
|
+
//#region src/helpers/core/command-handlers.d.ts
|
|
100
|
+
/**
|
|
101
|
+
* Result type for project creation
|
|
102
|
+
*/
|
|
103
|
+
interface CreateProjectResult {
|
|
104
|
+
success: boolean;
|
|
105
|
+
projectConfig: types_d_exports.ProjectConfig;
|
|
106
|
+
reproducibleCommand: string;
|
|
107
|
+
timeScaffolded: string;
|
|
108
|
+
elapsedTimeMs: number;
|
|
109
|
+
projectDirectory: string;
|
|
110
|
+
relativePath: string;
|
|
111
|
+
error?: string;
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/helpers/core/add-handler.d.ts
|
|
115
|
+
interface AddResult {
|
|
116
|
+
success: boolean;
|
|
117
|
+
addedAddons: types_d_exports.Addons[];
|
|
118
|
+
projectDir: string;
|
|
119
|
+
dryRun?: boolean;
|
|
120
|
+
plannedFileCount?: number;
|
|
121
|
+
error?: string;
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
124
|
//#region src/index.d.ts
|
|
125
125
|
declare const SchemaNameSchema: z.ZodDefault<z.ZodEnum<{
|
|
126
126
|
all: "all";
|
|
@@ -383,7 +383,7 @@ declare function createBtsCli(): ReturnType<typeof createCli>;
|
|
|
383
383
|
/**
|
|
384
384
|
* Error types that can be returned from create/createVirtual
|
|
385
385
|
*/
|
|
386
|
-
type CreateError = UserCancelledError | CLIError | ProjectCreationError;
|
|
386
|
+
type CreateError = UserCancelledError | CLIError | DirectoryConflictError | ProjectCreationError;
|
|
387
387
|
/**
|
|
388
388
|
* Programmatic API to create a new Better-T-Stack project.
|
|
389
389
|
* Returns a Result type - no console output, no interactive prompts.
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as ProjectCreationError, S as DirectoryConflictError, T as ValidationError, a as TEMPLATE_COUNT, b as CompatibilityError, c as builder, d as createVirtual, f as docs, g as sponsors, h as router, i as SchemaNameSchema, l as create, m as getSchemaResult, n as GeneratorError, o as VirtualFileSystem, p as generate, r as Result, s as add, t as EMBEDDED_TEMPLATES, u as createBtsCli, w as UserCancelledError, x as DatabaseSetupError, y as CLIError } from "./src-
|
|
2
|
+
import { C as ProjectCreationError, S as DirectoryConflictError, T as ValidationError, a as TEMPLATE_COUNT, b as CompatibilityError, c as builder, d as createVirtual, f as docs, g as sponsors, h as router, i as SchemaNameSchema, l as create, m as getSchemaResult, n as GeneratorError, o as VirtualFileSystem, p as generate, r as Result, s as add, t as EMBEDDED_TEMPLATES, u as createBtsCli, w as UserCancelledError, x as DatabaseSetupError, y as CLIError } from "./src-ihjK9T9S.mjs";
|
|
3
3
|
export { CLIError, CompatibilityError, DatabaseSetupError, DirectoryConflictError, EMBEDDED_TEMPLATES, GeneratorError, ProjectCreationError, Result, SchemaNameSchema, TEMPLATE_COUNT, UserCancelledError, ValidationError, VirtualFileSystem, add, builder, create, createBtsCli, createVirtual, docs, generate, getSchemaResult, router, sponsors };
|
|
@@ -336,7 +336,7 @@ const cliConsola = {
|
|
|
336
336
|
/**
|
|
337
337
|
* User cancelled the operation (e.g., Ctrl+C in prompts)
|
|
338
338
|
*/
|
|
339
|
-
var UserCancelledError = class extends TaggedError("UserCancelledError")
|
|
339
|
+
var UserCancelledError = class extends TaggedError("UserCancelledError") {
|
|
340
340
|
constructor(args) {
|
|
341
341
|
super({ message: args?.message ?? "Operation cancelled" });
|
|
342
342
|
}
|
|
@@ -344,11 +344,11 @@ var UserCancelledError = class extends TaggedError("UserCancelledError")() {
|
|
|
344
344
|
/**
|
|
345
345
|
* General CLI error for validation failures, invalid flags, etc.
|
|
346
346
|
*/
|
|
347
|
-
var CLIError = class extends TaggedError("CLIError")
|
|
347
|
+
var CLIError = class extends TaggedError("CLIError") {};
|
|
348
348
|
/**
|
|
349
349
|
* Validation error for config/flag validation failures
|
|
350
350
|
*/
|
|
351
|
-
var ValidationError = class extends TaggedError("ValidationError")
|
|
351
|
+
var ValidationError = class extends TaggedError("ValidationError") {
|
|
352
352
|
constructor(args) {
|
|
353
353
|
super(args);
|
|
354
354
|
}
|
|
@@ -356,7 +356,7 @@ var ValidationError = class extends TaggedError("ValidationError")() {
|
|
|
356
356
|
/**
|
|
357
357
|
* Compatibility error for incompatible option combinations
|
|
358
358
|
*/
|
|
359
|
-
var CompatibilityError = class extends TaggedError("CompatibilityError")
|
|
359
|
+
var CompatibilityError = class extends TaggedError("CompatibilityError") {
|
|
360
360
|
constructor(args) {
|
|
361
361
|
super(args);
|
|
362
362
|
}
|
|
@@ -364,7 +364,7 @@ var CompatibilityError = class extends TaggedError("CompatibilityError")() {
|
|
|
364
364
|
/**
|
|
365
365
|
* Directory conflict error when target directory exists and is not empty
|
|
366
366
|
*/
|
|
367
|
-
var DirectoryConflictError = class extends TaggedError("DirectoryConflictError")
|
|
367
|
+
var DirectoryConflictError = class extends TaggedError("DirectoryConflictError") {
|
|
368
368
|
constructor(args) {
|
|
369
369
|
super({
|
|
370
370
|
directory: args.directory,
|
|
@@ -375,7 +375,7 @@ var DirectoryConflictError = class extends TaggedError("DirectoryConflictError")
|
|
|
375
375
|
/**
|
|
376
376
|
* Project creation error for failures during scaffolding
|
|
377
377
|
*/
|
|
378
|
-
var ProjectCreationError = class extends TaggedError("ProjectCreationError")
|
|
378
|
+
var ProjectCreationError = class extends TaggedError("ProjectCreationError") {
|
|
379
379
|
constructor(args) {
|
|
380
380
|
super(args);
|
|
381
381
|
}
|
|
@@ -383,7 +383,7 @@ var ProjectCreationError = class extends TaggedError("ProjectCreationError")() {
|
|
|
383
383
|
/**
|
|
384
384
|
* Database setup error for failures during database configuration
|
|
385
385
|
*/
|
|
386
|
-
var DatabaseSetupError = class extends TaggedError("DatabaseSetupError")
|
|
386
|
+
var DatabaseSetupError = class extends TaggedError("DatabaseSetupError") {
|
|
387
387
|
constructor(args) {
|
|
388
388
|
super(args);
|
|
389
389
|
}
|
|
@@ -391,7 +391,7 @@ var DatabaseSetupError = class extends TaggedError("DatabaseSetupError")() {
|
|
|
391
391
|
/**
|
|
392
392
|
* Addon setup error for failures during addon configuration
|
|
393
393
|
*/
|
|
394
|
-
var AddonSetupError = class extends TaggedError("AddonSetupError")
|
|
394
|
+
var AddonSetupError = class extends TaggedError("AddonSetupError") {
|
|
395
395
|
constructor(args) {
|
|
396
396
|
super(args);
|
|
397
397
|
}
|
|
@@ -441,7 +441,7 @@ function getLatestCLIVersion() {
|
|
|
441
441
|
//#region src/utils/project-history.ts
|
|
442
442
|
const paths = envPaths("better-t-stack", { suffix: "" });
|
|
443
443
|
const HISTORY_FILE = "history.json";
|
|
444
|
-
var HistoryError = class extends TaggedError("HistoryError")
|
|
444
|
+
var HistoryError = class extends TaggedError("HistoryError") {};
|
|
445
445
|
function getHistoryDir() {
|
|
446
446
|
return paths.data;
|
|
447
447
|
}
|
|
@@ -5848,16 +5848,15 @@ async function handleDirectoryConflict(currentPathInput) {
|
|
|
5848
5848
|
}
|
|
5849
5849
|
}
|
|
5850
5850
|
}
|
|
5851
|
+
function resolveProjectDirectoryPath(finalPathInput) {
|
|
5852
|
+
const finalResolvedPath = finalPathInput === "." ? process.cwd() : path.resolve(process.cwd(), finalPathInput);
|
|
5853
|
+
return {
|
|
5854
|
+
finalResolvedPath,
|
|
5855
|
+
finalBaseName: path.basename(finalResolvedPath)
|
|
5856
|
+
};
|
|
5857
|
+
}
|
|
5851
5858
|
async function setupProjectDirectory(finalPathInput, shouldClearDirectory) {
|
|
5852
|
-
|
|
5853
|
-
let finalBaseName;
|
|
5854
|
-
if (finalPathInput === ".") {
|
|
5855
|
-
finalResolvedPath = process.cwd();
|
|
5856
|
-
finalBaseName = path.basename(finalResolvedPath);
|
|
5857
|
-
} else {
|
|
5858
|
-
finalResolvedPath = path.resolve(process.cwd(), finalPathInput);
|
|
5859
|
-
finalBaseName = path.basename(finalResolvedPath);
|
|
5860
|
-
}
|
|
5859
|
+
const { finalResolvedPath, finalBaseName } = resolveProjectDirectoryPath(finalPathInput);
|
|
5861
5860
|
const pathSafetyResult = await validateSafeProjectDirectoryPath(finalPathInput);
|
|
5862
5861
|
if (pathSafetyResult.isErr()) throw pathSafetyResult.error;
|
|
5863
5862
|
if (shouldClearDirectory) {
|
|
@@ -6106,7 +6105,7 @@ function validateArrayOptions(options) {
|
|
|
6106
6105
|
}
|
|
6107
6106
|
//#endregion
|
|
6108
6107
|
//#region src/validation.ts
|
|
6109
|
-
const
|
|
6108
|
+
const coreStackFlags = /* @__PURE__ */ new Set([
|
|
6110
6109
|
"database",
|
|
6111
6110
|
"orm",
|
|
6112
6111
|
"backend",
|
|
@@ -6124,7 +6123,7 @@ const CORE_STACK_FLAGS = /* @__PURE__ */ new Set([
|
|
|
6124
6123
|
function validateYesFlagCombination(options, providedFlags) {
|
|
6125
6124
|
if (!options.yes) return Result.ok(void 0);
|
|
6126
6125
|
if (options.template && options.template !== "none") return Result.ok(void 0);
|
|
6127
|
-
const coreStackFlagsProvided = Array.from(providedFlags).filter((flag) =>
|
|
6126
|
+
const coreStackFlagsProvided = Array.from(providedFlags).filter((flag) => coreStackFlags.has(flag));
|
|
6128
6127
|
if (coreStackFlagsProvided.length > 0) return Result.err(new ValidationError({ message: `Cannot combine --yes with core stack configuration flags: ${coreStackFlagsProvided.map((f) => `--${f}`).join(", ")}. The --yes flag uses default configuration. Remove these flags or use --yes without them.` }));
|
|
6129
6128
|
return Result.ok(void 0);
|
|
6130
6129
|
}
|
|
@@ -6163,6 +6162,9 @@ function validateConfigCompatibility(config, providedFlags, options) {
|
|
|
6163
6162
|
if (options && providedFlags) return validateFullConfig(config, providedFlags, options);
|
|
6164
6163
|
else return validateConfigForProgrammaticUse(config);
|
|
6165
6164
|
}
|
|
6165
|
+
function validateResolvedConfigCompatibility(config) {
|
|
6166
|
+
return validateFullConfig(config, coreStackFlags, config);
|
|
6167
|
+
}
|
|
6166
6168
|
//#endregion
|
|
6167
6169
|
//#region src/utils/file-formatter.ts
|
|
6168
6170
|
const formatOptions = {
|
|
@@ -8087,24 +8089,35 @@ function createEmptyResult(timeScaffolded, elapsedTimeMs, error) {
|
|
|
8087
8089
|
error
|
|
8088
8090
|
};
|
|
8089
8091
|
}
|
|
8090
|
-
async function
|
|
8092
|
+
async function executeCreateProjectHandler(input, options) {
|
|
8091
8093
|
const { silent = false } = options;
|
|
8092
8094
|
return runWithContextAsync({ silent }, async () => {
|
|
8093
8095
|
const startTime = Date.now();
|
|
8094
8096
|
const timeScaffolded = (/* @__PURE__ */ new Date()).toISOString();
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
if (isSilent()) return createEmptyResult(timeScaffolded, elapsedTimeMs, error.message);
|
|
8101
|
-
return;
|
|
8102
|
-
}
|
|
8103
|
-
if (isSilent()) return createEmptyResult(timeScaffolded, elapsedTimeMs, error.message);
|
|
8104
|
-
displayError(error);
|
|
8105
|
-
process.exit(1);
|
|
8097
|
+
return {
|
|
8098
|
+
result: await createProjectHandlerInternal(input, startTime, timeScaffolded),
|
|
8099
|
+
startTime,
|
|
8100
|
+
timeScaffolded
|
|
8101
|
+
};
|
|
8106
8102
|
});
|
|
8107
8103
|
}
|
|
8104
|
+
async function createProjectHandlerResult(input, options = {}) {
|
|
8105
|
+
return (await executeCreateProjectHandler(input, options)).result;
|
|
8106
|
+
}
|
|
8107
|
+
async function createProjectHandler(input, options = {}) {
|
|
8108
|
+
const { silent = false } = options;
|
|
8109
|
+
const { result, startTime, timeScaffolded } = await executeCreateProjectHandler(input, options);
|
|
8110
|
+
if (result.isOk()) return result.value;
|
|
8111
|
+
const error = result.error;
|
|
8112
|
+
const elapsedTimeMs = Date.now() - startTime;
|
|
8113
|
+
if (UserCancelledError.is(error)) {
|
|
8114
|
+
if (silent) return createEmptyResult(timeScaffolded, elapsedTimeMs, error.message);
|
|
8115
|
+
return;
|
|
8116
|
+
}
|
|
8117
|
+
if (silent) return createEmptyResult(timeScaffolded, elapsedTimeMs, error.message);
|
|
8118
|
+
displayError(error);
|
|
8119
|
+
process.exit(1);
|
|
8120
|
+
}
|
|
8108
8121
|
async function createProjectHandlerInternal(input, startTime, timeScaffolded) {
|
|
8109
8122
|
return Result.gen(async function* () {
|
|
8110
8123
|
if (!isSilent() && input.renderTitle !== false) renderTitle();
|
|
@@ -8137,25 +8150,7 @@ async function createProjectHandlerInternal(input, startTime, timeScaffolded) {
|
|
|
8137
8150
|
shouldClearDirectory = conflictResult.shouldClearDirectory;
|
|
8138
8151
|
yield* validateResolvedProjectPathInput(finalPathInput);
|
|
8139
8152
|
yield* Result.await(validateSafeProjectDirectoryPath(finalPathInput));
|
|
8140
|
-
|
|
8141
|
-
let finalBaseName;
|
|
8142
|
-
if (input.dryRun) {
|
|
8143
|
-
finalResolvedPath = finalPathInput === "." ? process.cwd() : path.resolve(process.cwd(), finalPathInput);
|
|
8144
|
-
finalBaseName = path.basename(finalResolvedPath);
|
|
8145
|
-
} else {
|
|
8146
|
-
const setupResult = yield* Result.await(Result.tryPromise({
|
|
8147
|
-
try: async () => setupProjectDirectory(finalPathInput, shouldClearDirectory),
|
|
8148
|
-
catch: (e) => {
|
|
8149
|
-
if (e instanceof UserCancelledError) return e;
|
|
8150
|
-
return new CLIError({
|
|
8151
|
-
message: e instanceof Error ? e.message : String(e),
|
|
8152
|
-
cause: e
|
|
8153
|
-
});
|
|
8154
|
-
}
|
|
8155
|
-
}));
|
|
8156
|
-
finalResolvedPath = setupResult.finalResolvedPath;
|
|
8157
|
-
finalBaseName = setupResult.finalBaseName;
|
|
8158
|
-
}
|
|
8153
|
+
const { finalResolvedPath, finalBaseName } = resolveProjectDirectoryPath(finalPathInput);
|
|
8159
8154
|
const originalInput = {
|
|
8160
8155
|
...input,
|
|
8161
8156
|
projectDirectory: input.projectName
|
|
@@ -8194,10 +8189,10 @@ async function createProjectHandlerInternal(input, startTime, timeScaffolded) {
|
|
|
8194
8189
|
relativePath: finalPathInput
|
|
8195
8190
|
};
|
|
8196
8191
|
const validationResult = validateConfigCompatibility(config, providedFlags, cliInput);
|
|
8197
|
-
if (validationResult.isErr())
|
|
8192
|
+
if (validationResult.isErr()) yield* new CLIError({
|
|
8198
8193
|
message: validationResult.error.message,
|
|
8199
8194
|
cause: validationResult.error
|
|
8200
|
-
})
|
|
8195
|
+
});
|
|
8201
8196
|
if (!isSilent()) log.info(pc.dim("Quick setup selected — using defaults and provided flags."));
|
|
8202
8197
|
} else {
|
|
8203
8198
|
const flagConfigResult = processAndValidateFlags(cliInput, providedFlags, finalBaseName);
|
|
@@ -8229,9 +8224,22 @@ async function createProjectHandlerInternal(input, startTime, timeScaffolded) {
|
|
|
8229
8224
|
dbSetupOptions: effectiveDbSetupOptions
|
|
8230
8225
|
};
|
|
8231
8226
|
if (!input.yolo) {
|
|
8232
|
-
const
|
|
8233
|
-
if (
|
|
8227
|
+
const resolvedConfigValidationResult = validateResolvedConfigCompatibility(config);
|
|
8228
|
+
if (resolvedConfigValidationResult.isErr()) yield* new CLIError({
|
|
8229
|
+
message: resolvedConfigValidationResult.error.message,
|
|
8230
|
+
cause: resolvedConfigValidationResult.error
|
|
8231
|
+
});
|
|
8234
8232
|
}
|
|
8233
|
+
if (!input.dryRun) yield* Result.await(Result.tryPromise({
|
|
8234
|
+
try: async () => setupProjectDirectory(finalPathInput, shouldClearDirectory),
|
|
8235
|
+
catch: (e) => {
|
|
8236
|
+
if (e instanceof UserCancelledError) return e;
|
|
8237
|
+
return new CLIError({
|
|
8238
|
+
message: e instanceof Error ? e.message : String(e),
|
|
8239
|
+
cause: e
|
|
8240
|
+
});
|
|
8241
|
+
}
|
|
8242
|
+
}));
|
|
8235
8243
|
if (!isSilent()) {
|
|
8236
8244
|
log.info(pc.magenta(pc.bold("Stack ready")));
|
|
8237
8245
|
log.message(displayConfig(config));
|
|
@@ -8542,15 +8550,15 @@ async function create(projectName, options) {
|
|
|
8542
8550
|
};
|
|
8543
8551
|
return Result.tryPromise({
|
|
8544
8552
|
try: async () => {
|
|
8545
|
-
const result = await
|
|
8546
|
-
if (
|
|
8547
|
-
|
|
8548
|
-
return result;
|
|
8553
|
+
const result = await createProjectHandlerResult(input, { silent: true });
|
|
8554
|
+
if (result.isErr()) throw result.error;
|
|
8555
|
+
return result.value;
|
|
8549
8556
|
},
|
|
8550
8557
|
catch: (e) => {
|
|
8551
|
-
if (e
|
|
8552
|
-
if (e
|
|
8553
|
-
if (e
|
|
8558
|
+
if (UserCancelledError.is(e)) return e;
|
|
8559
|
+
if (CLIError.is(e)) return e;
|
|
8560
|
+
if (DirectoryConflictError.is(e)) return e;
|
|
8561
|
+
if (ProjectCreationError.is(e)) return e;
|
|
8554
8562
|
return new CLIError({
|
|
8555
8563
|
message: e instanceof Error ? e.message : String(e),
|
|
8556
8564
|
cause: e
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "3.38.
|
|
3
|
+
"version": "3.38.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
|
"keywords": [
|
|
6
6
|
"better-auth",
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
"prepublishOnly": "npm run build"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@better-t-stack/template-generator": "^3.38.
|
|
73
|
-
"@better-t-stack/types": "^3.38.
|
|
72
|
+
"@better-t-stack/template-generator": "^3.38.1",
|
|
73
|
+
"@better-t-stack/types": "^3.38.1",
|
|
74
74
|
"@clack/core": "^1.4.3",
|
|
75
75
|
"@clack/prompts": "^1.7.0",
|
|
76
76
|
"@modelcontextprotocol/sdk": "1.30.0",
|
|
77
77
|
"@trpc/server": "^11.18.0",
|
|
78
|
-
"better-result": "^
|
|
78
|
+
"better-result": "^3.0.0",
|
|
79
79
|
"consola": "^3.4.2",
|
|
80
80
|
"env-paths": "^4.0.0",
|
|
81
81
|
"execa": "^10.0.0",
|