create-thexjs-app 1.1.3 → 1.2.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/README.md CHANGED
@@ -27,7 +27,7 @@ bun create thexjs-app@latest
27
27
  You'll be guided through interactive prompts:
28
28
 
29
29
  - **Project name** — e.g. `my-app`
30
- - **Features** — choose from Tailwind CSS, shadcn/ui, Auth, and Content collections
30
+ - **Features** — choose from Tailwind CSS, shadcn/ui, Auth, Content collections, and Hooks
31
31
  - **Install & git** — confirm dependency install and `git init`
32
32
 
33
33
  ```bash
@@ -49,6 +49,7 @@ selected at prompt time (or via CLI flags).
49
49
  | **shadcn/ui** | Accessible React components in `src/components/ui` (requires Tailwind) |
50
50
  | **Auth** | SQLite-backed demo sessions, `/login` and a protected `/dashboard` with middleware |
51
51
  | **Content** | Markdown/MDX with frontmatter in `content/`, auto-routed and indexed on `/blog` |
52
+ | **Hooks** | `@thexjs/hooks` dependency — SSR-safe React hooks (debounce, media query, localStorage, forms, server actions) |
52
53
 
53
54
  Enabling **shadcn/ui** automatically enables **Tailwind CSS**.
54
55
 
@@ -70,6 +71,7 @@ bun create thexjs-app@latest my-app --tailwind --auth --content --shadcn
70
71
  | `--shadcn` | Include shadcn/ui (implies `--tailwind`) |
71
72
  | `--auth` | Include demo auth |
72
73
  | `--content` | Include content collections |
74
+ | `--hooks` | Include the `@thexjs/hooks` package |
73
75
  | `--no-install` | Skip `bun install` |
74
76
  | `--no-git` | Skip `git init` |
75
77
  | `--dev` | Start the dev server after install |
package/dist/index.js CHANGED
@@ -72,6 +72,14 @@ var FEATURES = [
72
72
  default: false,
73
73
  dependencies: {},
74
74
  devDependencies: {}
75
+ },
76
+ {
77
+ id: "hooks",
78
+ label: "Hooks (@thexjs/hooks)",
79
+ hint: "SSR-safe React hooks: debounce, media query, localStorage, forms, server actions",
80
+ default: false,
81
+ dependencies: {},
82
+ devDependencies: {}
75
83
  }
76
84
  ];
77
85
  var BASE_DEPENDENCIES = {
@@ -95,6 +103,7 @@ var TEMPLATES_ROOT = join(__dirname, "..", "templates");
95
103
  var BASE_TEMPLATE = join(TEMPLATES_ROOT, "base");
96
104
  var ADDONS_ROOT = join(TEMPLATES_ROOT, "addons");
97
105
  var FALLBACK_CORE_VERSION = "1.2.2";
106
+ var FALLBACK_HOOKS_VERSION = "0.1.0";
98
107
  function parseArgs(argv) {
99
108
  const options = {
100
109
  features: [],
@@ -132,6 +141,9 @@ function parseArgs(argv) {
132
141
  case "--content":
133
142
  nonInteractive.push("content");
134
143
  break;
144
+ case "--hooks":
145
+ nonInteractive.push("hooks");
146
+ break;
135
147
  default:
136
148
  if (arg && !arg.startsWith("--")) positional.push(arg);
137
149
  }
@@ -190,7 +202,7 @@ function finalizeGitignore(targetDir) {
190
202
  const to = join(targetDir, ".gitignore");
191
203
  renameSync(from, to);
192
204
  }
193
- function buildPackageJson(name, features, coreVersion, cliVersion) {
205
+ function buildPackageJson(name, features, coreVersion, cliVersion, hooksVersion) {
194
206
  const dependencies = {
195
207
  ...BASE_DEPENDENCIES,
196
208
  "@thexjs/core": `^${coreVersion}`
@@ -199,6 +211,9 @@ function buildPackageJson(name, features, coreVersion, cliVersion) {
199
211
  ...BASE_DEV_DEPENDENCIES,
200
212
  "@thexjs/cli": `^${cliVersion}`
201
213
  };
214
+ if (features.includes("hooks") && hooksVersion) {
215
+ dependencies["@thexjs/hooks"] = `^${hooksVersion}`;
216
+ }
202
217
  for (const feature of features) {
203
218
  const meta = FEATURES.find((f) => f.id === feature);
204
219
  if (!meta) continue;
@@ -300,9 +315,10 @@ async function main() {
300
315
  spin.message("Resolving latest @thexjs versions");
301
316
  const coreVersion = await fetchLatestVersion("@thexjs/core") ?? FALLBACK_CORE_VERSION;
302
317
  const cliVersion = await fetchLatestVersion("@thexjs/cli") ?? FALLBACK_CORE_VERSION;
318
+ const hooksVersion = features.includes("hooks") ? await fetchLatestVersion("@thexjs/hooks") ?? FALLBACK_HOOKS_VERSION : void 0;
303
319
  writeFileSync(
304
320
  join(targetDir, "package.json"),
305
- buildPackageJson(slug, features, coreVersion, cliVersion)
321
+ buildPackageJson(slug, features, coreVersion, cliVersion, hooksVersion)
306
322
  );
307
323
  writeFileSync(join(targetDir, "x.config.ts"), buildXConfig(features));
308
324
  spin.stop(`Created ${slug}/`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-thexjs-app",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "description": "Scaffold a new x framework app (npm create thexjs-app@latest).",
5
5
  "keywords": [
6
6
  "react",