create-better-t-stack 3.11.0-bun-compile-opentui.2583611 → 3.11.0-bun-compile-opentui.eb5328c

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.
Files changed (36) hide show
  1. package/package.json +7 -7
  2. package/src/constants.ts +46 -67
  3. package/src/helpers/addons/addons-setup.ts +0 -1
  4. package/src/index.ts +0 -3
  5. package/src/tui/app.tsx +133 -972
  6. package/src/tui/components/index.ts +11 -0
  7. package/src/tui/components/log-display.tsx +35 -0
  8. package/src/tui/components/logo.tsx +68 -0
  9. package/src/tui/components/prompts/confirm-step.tsx +43 -0
  10. package/src/tui/components/prompts/confirm.tsx +39 -0
  11. package/src/tui/components/prompts/index.ts +5 -0
  12. package/src/tui/components/prompts/input.tsx +36 -0
  13. package/src/tui/components/prompts/multi-select.tsx +46 -0
  14. package/src/tui/components/prompts/select.tsx +44 -0
  15. package/src/tui/components/spinner.tsx +21 -0
  16. package/src/tui/components/status-bar.tsx +68 -0
  17. package/src/tui/steps.ts +520 -0
  18. package/src/tui/theme.ts +22 -0
  19. package/src/utils/get-latest-cli-version.ts +0 -1
  20. /package/templates/examples/ai/native/bare/{polyfills.js → polyfills.js.hbs} +0 -0
  21. /package/templates/examples/ai/native/unistyles/{polyfills.js → polyfills.js.hbs} +0 -0
  22. /package/templates/examples/ai/native/uniwind/{polyfills.js → polyfills.js.hbs} +0 -0
  23. /package/templates/examples/todo/server/drizzle/mysql/src/schema/{todo.ts → todo.ts.hbs} +0 -0
  24. /package/templates/examples/todo/server/drizzle/postgres/src/schema/{todo.ts → todo.ts.hbs} +0 -0
  25. /package/templates/examples/todo/server/drizzle/sqlite/src/schema/{todo.ts → todo.ts.hbs} +0 -0
  26. /package/templates/frontend/native/uniwind/{global.css → global.css.hbs} +0 -0
  27. /package/templates/frontend/nuxt/app/assets/css/{main.css → main.css.hbs} +0 -0
  28. /package/templates/frontend/react/react-router/{react-router.config.ts → react-router.config.ts.hbs} +0 -0
  29. /package/templates/frontend/react/react-router/src/{routes.ts → routes.ts.hbs} +0 -0
  30. /package/templates/frontend/solid/{index.html → index.html.hbs} +0 -0
  31. /package/templates/frontend/solid/src/components/{loader.tsx → loader.tsx.hbs} +0 -0
  32. /package/templates/frontend/solid/src/{styles.css → styles.css.hbs} +0 -0
  33. /package/templates/frontend/svelte/src/{app.css → app.css.hbs} +0 -0
  34. /package/templates/frontend/svelte/src/{app.d.ts → app.d.ts.hbs} +0 -0
  35. /package/templates/frontend/svelte/src/{app.html → app.html.hbs} +0 -0
  36. /package/templates/frontend/svelte/src/lib/{index.ts → index.ts.hbs} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-better-t-stack",
3
- "version": "3.11.0-bun-compile-opentui.2583611",
3
+ "version": "3.11.0-bun-compile-opentui.eb5328c",
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",
@@ -68,7 +68,7 @@
68
68
  "prepublishOnly": "echo 'Build binaries separately before publishing'"
69
69
  },
70
70
  "dependencies": {
71
- "@better-t-stack/types": "3.11.0-bun-compile-opentui.2583611",
71
+ "@better-t-stack/types": "3.11.0-bun-compile-opentui.eb5328c",
72
72
  "@clack/prompts": "^1.0.0-alpha.8",
73
73
  "@opentui/core": "^0.1.62",
74
74
  "@opentui/react": "^0.1.62",
@@ -93,11 +93,11 @@
93
93
  "typescript": "^5.9.3"
94
94
  },
95
95
  "optionalDependencies": {
96
- "@better-t-stack/cli-darwin-arm64": "3.11.0-bun-compile-opentui.2583611",
97
- "@better-t-stack/cli-darwin-x64": "3.11.0-bun-compile-opentui.2583611",
98
- "@better-t-stack/cli-linux-arm64": "3.11.0-bun-compile-opentui.2583611",
99
- "@better-t-stack/cli-linux-x64": "3.11.0-bun-compile-opentui.2583611",
100
- "@better-t-stack/cli-windows-x64": "3.11.0-bun-compile-opentui.2583611",
96
+ "@better-t-stack/cli-darwin-arm64": "3.11.0-bun-compile-opentui.eb5328c",
97
+ "@better-t-stack/cli-darwin-x64": "3.11.0-bun-compile-opentui.eb5328c",
98
+ "@better-t-stack/cli-linux-arm64": "3.11.0-bun-compile-opentui.eb5328c",
99
+ "@better-t-stack/cli-linux-x64": "3.11.0-bun-compile-opentui.eb5328c",
100
+ "@better-t-stack/cli-windows-x64": "3.11.0-bun-compile-opentui.eb5328c",
101
101
  "@opentui/core-darwin-arm64": "0.1.63",
102
102
  "@opentui/core-darwin-x64": "0.1.63",
103
103
  "@opentui/core-linux-arm64": "0.1.63",
package/src/constants.ts CHANGED
@@ -4,84 +4,63 @@ import { fileURLToPath } from "node:url";
4
4
  import { getUserPkgManager } from "./utils/get-package-manager";
5
5
 
6
6
  /**
7
- * Detect if running as a compiled Bun binary.
8
- * Compiled binaries have Bun.main pointing to the executable itself,
9
- * not a .ts or .js file.
7
+ * Find the package root directory containing templates.
8
+ *
9
+ * For compiled binaries: The binary runs from @better-t-stack/cli-{platform}-{arch},
10
+ * but templates are shipped with the main create-better-t-stack package.
11
+ * We need to find that package in node_modules.
12
+ *
13
+ * For dev/npm distribution: Uses the current source directory.
10
14
  */
11
- function isCompiledBinary(): boolean {
12
- if (typeof Bun === "undefined") return false;
13
- const main = Bun.main;
14
- // Compiled binaries don't have .ts, .js, or .mjs extensions
15
- return !main.endsWith(".ts") && !main.endsWith(".js") && !main.endsWith(".mjs");
16
- }
17
-
18
- /**
19
- * Find the main create-better-t-stack package in node_modules.
20
- * Used when running as a compiled binary from a platform package.
21
- */
22
- function findMainPackage(): string | null {
23
- // Use process.execPath to get actual filesystem path (Bun.main returns bunfs virtual path)
24
- let current = path.dirname(process.execPath);
25
-
26
- // Search up the directory tree for node_modules/create-better-t-stack
27
- while (current !== path.dirname(current)) {
28
- const candidate = path.join(current, "node_modules", "create-better-t-stack");
29
- const templatesPath = path.join(candidate, "templates");
30
-
31
- if (fs.existsSync(templatesPath)) {
32
- return candidate;
33
- }
34
-
35
- current = path.dirname(current);
15
+ function findPackageRoot(): string {
16
+ // Get the directory of the current module
17
+ const __filename = fileURLToPath(import.meta.url);
18
+ const __dirname = path.dirname(__filename);
19
+
20
+ // In development or when running from source (e.g., `bun run dev`),
21
+ // we're already in the right package - just go up from src/constants.ts
22
+ const devRoot = path.resolve(__dirname, "..");
23
+ const devTemplatesPath = path.join(devRoot, "templates");
24
+ if (fs.existsSync(devTemplatesPath)) {
25
+ return devRoot;
36
26
  }
37
27
 
38
- return null;
39
- }
40
-
41
- /**
42
- * Get the package root directory.
43
- * - In JS mode (development/tsdown build): relative to dist/
44
- * - In compiled binary mode: find main package in node_modules, or use dev fallback
45
- */
46
- function getPkgRoot(): string {
47
- if (isCompiledBinary()) {
48
- // First try: find main package in node_modules (production npm install)
49
- const mainPkg = findMainPackage();
50
- if (mainPkg) {
51
- return mainPkg;
52
- }
53
-
54
- // Second try: development mode - binary is in dist/create-better-t-stack-{platform}-{arch}/bin/
55
- // Use process.execPath to get actual filesystem path (Bun.main returns bunfs virtual path)
56
- const binaryPath = process.execPath;
57
- const binaryDir = path.dirname(binaryPath);
58
-
59
- // Templates are at ../../../templates relative to the binary (bin -> platform-dir -> dist -> apps/cli)
60
- const devTemplatesPath = path.resolve(binaryDir, "..", "..", "..", "templates");
61
- if (fs.existsSync(devTemplatesPath)) {
62
- return path.resolve(binaryDir, "..", "..", "..");
28
+ // For compiled binaries, the binary is in @better-t-stack/cli-{platform}-{arch}/bin/
29
+ // We need to find create-better-t-stack package which contains templates
30
+ // Walk up from the binary location to find node_modules
31
+ let current = __dirname;
32
+ while (current !== path.dirname(current)) {
33
+ // Check if we're in node_modules and can find the main package
34
+ const nodeModulesPath = path.join(current, "node_modules");
35
+ if (fs.existsSync(nodeModulesPath)) {
36
+ const mainPackagePath = path.join(nodeModulesPath, "create-better-t-stack");
37
+ const mainTemplatesPath = path.join(mainPackagePath, "templates");
38
+ if (fs.existsSync(mainTemplatesPath)) {
39
+ return mainPackagePath;
40
+ }
63
41
  }
64
42
 
65
- // Third try: templates might be at ../../templates (if binary is in dist/bin/)
66
- const altTemplatesPath = path.resolve(binaryDir, "..", "..", "templates");
67
- if (fs.existsSync(altTemplatesPath)) {
68
- return path.resolve(binaryDir, "..", "..");
43
+ // Also check if current directory is inside node_modules
44
+ // e.g., /path/node_modules/@better-t-stack/cli-darwin-arm64/bin
45
+ const parts = current.split(path.sep);
46
+ const nodeModulesIndex = parts.lastIndexOf("node_modules");
47
+ if (nodeModulesIndex !== -1) {
48
+ const nodeModulesDir = parts.slice(0, nodeModulesIndex + 1).join(path.sep);
49
+ const mainPackagePath = path.join(nodeModulesDir, "create-better-t-stack");
50
+ const mainTemplatesPath = path.join(mainPackagePath, "templates");
51
+ if (fs.existsSync(mainTemplatesPath)) {
52
+ return mainPackagePath;
53
+ }
69
54
  }
70
55
 
71
- // Fourth try: templates at ../templates
72
- const simpleTemplatesPath = path.resolve(binaryDir, "..", "templates");
73
- if (fs.existsSync(simpleTemplatesPath)) {
74
- return path.resolve(binaryDir, "..");
75
- }
56
+ current = path.dirname(current);
76
57
  }
77
58
 
78
- // Standard JS mode - relative to this file in dist/
79
- const __filename = fileURLToPath(import.meta.url);
80
- const distPath = path.dirname(__filename);
81
- return path.join(distPath, "../");
59
+ // Fallback: return dev root and hope for the best
60
+ return devRoot;
82
61
  }
83
62
 
84
- export const PKG_ROOT = getPkgRoot();
63
+ export const PKG_ROOT = findPackageRoot();
85
64
 
86
65
  export const DEFAULT_CONFIG_BASE = {
87
66
  projectName: "my-better-t-app",
@@ -1,6 +1,5 @@
1
1
  import path from "node:path";
2
2
  import fs from "fs-extra";
3
- import pc from "picocolors";
4
3
  import { log } from "../../utils/logger";
5
4
  import type { Frontend, ProjectConfig } from "../../types";
6
5
  import { addPackageDependency } from "../../utils/add-package-deps";
package/src/index.ts CHANGED
@@ -46,6 +46,3 @@ export type {
46
46
  Template,
47
47
  BetterTStackConfig,
48
48
  } from "./types";
49
-
50
- // Legacy exports for backwards compatibility (deprecated)
51
- export { create as init } from "./api";