create-better-t-stack 3.11.0-bun-compile-opentui.6a69159 → 3.11.0-bun-compile-opentui.bd6d873

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 (22) hide show
  1. package/package.json +7 -7
  2. package/src/constants.ts +46 -66
  3. package/src/helpers/addons/addons-setup.ts +0 -1
  4. package/src/index.ts +0 -3
  5. package/src/utils/get-latest-cli-version.ts +0 -1
  6. /package/templates/examples/ai/native/bare/{polyfills.js → polyfills.js.hbs} +0 -0
  7. /package/templates/examples/ai/native/unistyles/{polyfills.js → polyfills.js.hbs} +0 -0
  8. /package/templates/examples/ai/native/uniwind/{polyfills.js → polyfills.js.hbs} +0 -0
  9. /package/templates/examples/todo/server/drizzle/mysql/src/schema/{todo.ts → todo.ts.hbs} +0 -0
  10. /package/templates/examples/todo/server/drizzle/postgres/src/schema/{todo.ts → todo.ts.hbs} +0 -0
  11. /package/templates/examples/todo/server/drizzle/sqlite/src/schema/{todo.ts → todo.ts.hbs} +0 -0
  12. /package/templates/frontend/native/uniwind/{global.css → global.css.hbs} +0 -0
  13. /package/templates/frontend/nuxt/app/assets/css/{main.css → main.css.hbs} +0 -0
  14. /package/templates/frontend/react/react-router/{react-router.config.ts → react-router.config.ts.hbs} +0 -0
  15. /package/templates/frontend/react/react-router/src/{routes.ts → routes.ts.hbs} +0 -0
  16. /package/templates/frontend/solid/{index.html → index.html.hbs} +0 -0
  17. /package/templates/frontend/solid/src/components/{loader.tsx → loader.tsx.hbs} +0 -0
  18. /package/templates/frontend/solid/src/{styles.css → styles.css.hbs} +0 -0
  19. /package/templates/frontend/svelte/src/{app.css → app.css.hbs} +0 -0
  20. /package/templates/frontend/svelte/src/{app.d.ts → app.d.ts.hbs} +0 -0
  21. /package/templates/frontend/svelte/src/{app.html → app.html.hbs} +0 -0
  22. /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.6a69159",
3
+ "version": "3.11.0-bun-compile-opentui.bd6d873",
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.6a69159",
71
+ "@better-t-stack/types": "3.11.0-bun-compile-opentui.bd6d873",
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.6a69159",
97
- "@better-t-stack/cli-darwin-x64": "3.11.0-bun-compile-opentui.6a69159",
98
- "@better-t-stack/cli-linux-arm64": "3.11.0-bun-compile-opentui.6a69159",
99
- "@better-t-stack/cli-linux-x64": "3.11.0-bun-compile-opentui.6a69159",
100
- "@better-t-stack/cli-windows-x64": "3.11.0-bun-compile-opentui.6a69159",
96
+ "@better-t-stack/cli-darwin-arm64": "3.11.0-bun-compile-opentui.bd6d873",
97
+ "@better-t-stack/cli-darwin-x64": "3.11.0-bun-compile-opentui.bd6d873",
98
+ "@better-t-stack/cli-linux-arm64": "3.11.0-bun-compile-opentui.bd6d873",
99
+ "@better-t-stack/cli-linux-x64": "3.11.0-bun-compile-opentui.bd6d873",
100
+ "@better-t-stack/cli-windows-x64": "3.11.0-bun-compile-opentui.bd6d873",
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,64 @@ 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.
12
+ *
13
+ * For dev/npm distribution: Uses the current source directory.
14
+ *
15
+ * Package structure when installed via npm/bunx:
16
+ * <cache>/node_modules/create-better-t-stack/
17
+ * ├── templates/ <-- templates are here
18
+ * ├── bin/ <-- stub is here
19
+ * └── node_modules/
20
+ * └── @better-t-stack/
21
+ * └── cli-darwin-arm64/
22
+ * └── bin/ <-- compiled binary runs from here
10
23
  */
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);
24
+ function findPackageRoot(): string {
25
+ // Get the directory of the current module
26
+ const __filename = fileURLToPath(import.meta.url);
27
+ const __dirname = path.dirname(__filename);
28
+
29
+ // In development or when running from source (e.g., `bun run dev`),
30
+ // we're already in the right package - just go up from src/constants.ts
31
+ const devRoot = path.resolve(__dirname, "..");
32
+ const devTemplatesPath = path.join(devRoot, "templates");
33
+ if (fs.existsSync(devTemplatesPath)) {
34
+ return devRoot;
35
+ }
25
36
 
26
- // Search up the directory tree for node_modules/create-better-t-stack
37
+ // For compiled binaries, walk up the directory tree looking for templates
38
+ // The binary is typically at:
39
+ // .../create-better-t-stack/node_modules/@better-t-stack/cli-{os}-{arch}/bin/
40
+ // And we need to find:
41
+ // .../create-better-t-stack/templates/
42
+ let current = __dirname;
27
43
  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
-
44
+ // Check if this directory has templates (we found create-better-t-stack root)
45
+ const templatesPath = path.join(current, "templates");
31
46
  if (fs.existsSync(templatesPath)) {
32
- return candidate;
33
- }
34
-
35
- current = path.dirname(current);
36
- }
37
-
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;
47
+ return current;
52
48
  }
53
49
 
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, "..", "..", "..");
50
+ // Check for create-better-t-stack in node_modules at this level
51
+ const nodeModulesPath = path.join(current, "node_modules", "create-better-t-stack");
52
+ const nodeModulesTemplatesPath = path.join(nodeModulesPath, "templates");
53
+ if (fs.existsSync(nodeModulesTemplatesPath)) {
54
+ return nodeModulesPath;
63
55
  }
64
56
 
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, "..", "..");
69
- }
70
-
71
- // Fourth try: templates at ../templates
72
- const simpleTemplatesPath = path.resolve(binaryDir, "..", "templates");
73
- if (fs.existsSync(simpleTemplatesPath)) {
74
- return path.resolve(binaryDir, "..");
75
- }
57
+ current = path.dirname(current);
76
58
  }
77
59
 
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, "../");
60
+ // Fallback: return dev root and hope for the best
61
+ return devRoot;
82
62
  }
83
63
 
84
- export const PKG_ROOT = getPkgRoot();
64
+ export const PKG_ROOT = findPackageRoot();
85
65
 
86
66
  export const DEFAULT_CONFIG_BASE = {
87
67
  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";
@@ -11,7 +11,6 @@ import { PKG_ROOT } from "../constants";
11
11
  declare const CLI_VERSION: string | undefined;
12
12
 
13
13
  export const getLatestCLIVersion = (): string => {
14
- // Check if version was embedded at compile time
15
14
  if (typeof CLI_VERSION !== "undefined") {
16
15
  return CLI_VERSION;
17
16
  }