create-better-t-stack 3.11.0-bun-compile-opentui.eb5328c → 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 (2) hide show
  1. package/package.json +7 -7
  2. package/src/constants.ts +24 -23
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.eb5328c",
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.eb5328c",
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.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",
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
@@ -8,9 +8,18 @@ import { getUserPkgManager } from "./utils/get-package-manager";
8
8
  *
9
9
  * For compiled binaries: The binary runs from @better-t-stack/cli-{platform}-{arch},
10
10
  * but templates are shipped with the main create-better-t-stack package.
11
- * We need to find that package in node_modules.
11
+ * We need to find that package.
12
12
  *
13
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
14
23
  */
15
24
  function findPackageRoot(): string {
16
25
  // Get the directory of the current module
@@ -25,32 +34,24 @@ function findPackageRoot(): string {
25
34
  return devRoot;
26
35
  }
27
36
 
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
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/
31
42
  let current = __dirname;
32
43
  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
- }
44
+ // Check if this directory has templates (we found create-better-t-stack root)
45
+ const templatesPath = path.join(current, "templates");
46
+ if (fs.existsSync(templatesPath)) {
47
+ return current;
41
48
  }
42
49
 
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
- }
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;
54
55
  }
55
56
 
56
57
  current = path.dirname(current);