@thorprovider/create-thor-app 3.1.3 → 4.0.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.
Files changed (48) hide show
  1. package/README.md +6 -55
  2. package/dist/index.js +154 -626
  3. package/package.json +2 -2
  4. package/templates/default/.agents/AGENTS.md +27 -0
  5. package/templates/default/.env.example +8 -30
  6. package/templates/default/.eslintrc.json +20 -27
  7. package/templates/default/README.md +52 -123
  8. package/templates/default/ai-validator.json +47 -29
  9. package/templates/default/app/api/revalidate/route.ts +27 -36
  10. package/templates/default/app/backend-unavailable/page.tsx +3 -7
  11. package/templates/default/app/error.tsx +1 -2
  12. package/templates/default/app/global-error.tsx +3 -3
  13. package/templates/default/app/globals.css +1 -71
  14. package/templates/default/app/layout.tsx +16 -38
  15. package/templates/default/app/not-found.tsx +1 -1
  16. package/templates/default/app/page.tsx +10 -119
  17. package/templates/default/components/providers/app-providers.tsx +19 -68
  18. package/templates/default/components/providers/cart-provider.tsx +143 -0
  19. package/templates/default/components/providers/commerce-provider.tsx +33 -0
  20. package/templates/default/components/providers/region-provider.tsx +105 -0
  21. package/templates/default/docs/README.md +46 -37
  22. package/templates/default/docs/commerce-api.md +58 -125
  23. package/templates/default/docs/patterns.md +128 -67
  24. package/templates/default/docs/project-structure.md +58 -50
  25. package/templates/default/docs/rules.md +43 -42
  26. package/templates/default/docs/types.md +105 -1024
  27. package/templates/default/lib/commerce.ts +33 -132
  28. package/templates/default/lib/env.ts +24 -94
  29. package/templates/default/lib/utils.ts +18 -0
  30. package/templates/default/next-env.d.ts +1 -1
  31. package/templates/default/next.config.ts +7 -0
  32. package/templates/default/package.json +2 -8
  33. package/templates/default/registry.json +6 -0
  34. package/templates/default/styles/tokens.css +81 -0
  35. package/templates/default/components/providers/navigation-provider.tsx +0 -37
  36. package/templates/default/config/site.config.ts +0 -156
  37. package/templates/default/docs/components.md +0 -282
  38. package/templates/default/docs/dependencies.md +0 -61
  39. package/templates/default/lib/auth-context.tsx +0 -213
  40. package/templates/default/lib/cart-provider.tsx +0 -53
  41. package/templates/default/lib/commerce-provider.tsx +0 -48
  42. package/templates/default/lib/region-detection.ts +0 -73
  43. package/templates/default/lib/region-provider.tsx +0 -53
  44. package/templates/default/lib/regions-config.ts +0 -48
  45. package/templates/default/lib/storefront-config.ts +0 -54
  46. package/templates/default/next.config.mjs +0 -51
  47. package/templates/default/proxy.ts +0 -155
  48. package/templates/default/scripts/generate-regions-config.ts +0 -498
package/README.md CHANGED
@@ -83,10 +83,7 @@ yarn create:app --name my-store \
83
83
  yarn create:app --name my-store \
84
84
  --commerce-provider medusa \
85
85
  --commerce-api-url https://my-backend.com \
86
- --commerce-api-key pk_live_xxx \
87
- --preset electro \
88
- --site-url https://my-store.com \
89
- --generate-regions
86
+ --commerce-api-key pk_live_xxx
90
87
 
91
88
  # With backend configuration
92
89
  yarn create:app --name my-store \
@@ -94,11 +91,6 @@ yarn create:app --name my-store \
94
91
  --commerce-api-url http://localhost:9000 \
95
92
  --commerce-api-key pk_abc123
96
93
 
97
- # With site configuration
98
- yarn create:app --name my-store \
99
- --preset electro \
100
- --site-url https://my-store.com
101
-
102
94
  # Custom output directory
103
95
  yarn create:app --name my-store --output /path/to/projects/my-store
104
96
  ```
@@ -113,12 +105,6 @@ npx @thorprovider/create-thor-app my-store
113
105
  **Differences from monorepo mode**:
114
106
  - Template is frozen at build time (versions pre-baked into `templates/default/package.json`)
115
107
  - No live dependency resolution — uses versions from the last build
116
- - `scripts/generate-regions-config.ts` is bundled in the standalone template
117
-
118
- **Environment** (for standalone):
119
- ```bash
120
- export NODE_AUTH_TOKEN=ghp_xxxxx # For GitHub Packages .npmrc
121
- ```
122
108
 
123
109
  ---
124
110
 
@@ -131,9 +117,6 @@ export NODE_AUTH_TOKEN=ghp_xxxxx # For GitHub Packages .npmrc
131
117
  | `--commerce-provider <p>` | Commerce backend (`medusa`, `shopify`) → `.env` | `medusa` |
132
118
  | `--commerce-api-url <url>` | Backend API URL → `.env` | `http://localhost:9000` |
133
119
  | `--commerce-api-key <key>` | Publishable API key → `.env` | placeholder |
134
- | `--preset <preset>` | Visual preset → `site.config.ts` | `electro` |
135
- | `--site-url <url>` | Public site URL → `site.config.ts` | `https://example.com` |
136
- | `--generate-regions` | Run region generation from backend after install | `false` |
137
120
  | `--skip-git` | Skip git initialization | `false` |
138
121
  | `--skip-install` | Skip yarn install | `false` |
139
122
  | `--skip-remote` | Skip GitHub remote repo creation | `false` |
@@ -201,14 +184,11 @@ Next steps:
201
184
  ```
202
185
  projects/my-store/
203
186
  ├── .env # Backend config (copy from .env.example)
204
- ├── .npmrc # GitHub Packages auth (included)
205
187
  ├── .agents/
206
188
  │ ├── AGENTS.md # Entry point for AI agents (V0, Claude Code, OpenCode)
207
189
  │ ├── context/ # Architecture, types, API, patterns, rules
208
190
  │ │ ├── architecture.md
209
191
  │ │ ├── project-structure.md
210
- │ │ ├── dependencies.md
211
- │ │ ├── components.md
212
192
  │ │ ├── types.md
213
193
  │ │ ├── commerce-api.md
214
194
  │ │ ├── patterns.md
@@ -228,8 +208,8 @@ projects/my-store/
228
208
  ├── package.json # @thorprovider/my-store, updated deps
229
209
  ├── app/ # Next.js 16 app directory
230
210
  ├── components/ # UI components
231
- ├── lib/ # Commerce provider, config, utilities
232
- ├── scripts/ # generate-regions-config.ts (bundled)
211
+ ├── lib/ # Commerce config, env, utilities
212
+ ├── styles/ # Theme tokens
233
213
  └── ...
234
214
  ```
235
215
 
@@ -242,13 +222,8 @@ projects/my-store/
242
222
  - **Name**: `@thorprovider/<name>`
243
223
  - **Dependencies**: All `workspace:*` refs → `^X.Y.Z` (pre-baked versions)
244
224
  - **Scripts configured**:
245
- - `prebuild` / `predev`: Runs region generation
246
225
  - `dev`, `build`, `start`: Next.js commands
247
- - `generate:regions`: Region config generator
248
-
249
- ### .npmrc
250
-
251
- GitHub Packages registry config. Uses `NODE_AUTH_TOKEN` ENV for authentication.
226
+ - `type-check`: TypeScript validation
252
227
 
253
228
  ### .agents/
254
229
 
@@ -278,7 +253,6 @@ Required GitHub Actions secrets (printed during scaffolding):
278
253
  - `VERCEL_TOKEN` — Vercel Access Token
279
254
  - `VERCEL_ORG_ID` — From `.vercel/project.json`
280
255
  - `VERCEL_PROJECT_ID` — From `.vercel/project.json`
281
- - `NODE_AUTH_TOKEN` — GitHub PAT with `read:packages` (for `@thorprovider/*`)
282
256
 
283
257
  ---
284
258
 
@@ -322,7 +296,6 @@ yarn install
322
296
  ### Standalone usage (from outside monorepo)
323
297
 
324
298
  ```bash
325
- # Requires NODE_AUTH_TOKEN set
326
299
  npx @thorprovider/create-thor-app my-store
327
300
 
328
301
  cd my-store
@@ -364,27 +337,6 @@ yarn dev
364
337
 
365
338
  **Workaround**: Use `--skip-vercel` to skip, or set `VERCEL_TOKEN` and try again. Generate a token at https://vercel.com/account/tokens (Full Account scope).
366
339
 
367
- ### "Region generation failed"
368
-
369
- **Cause**: `--generate-regions` could not connect to the backend (timeout, wrong URL, wrong API key).
370
-
371
- **Behavior**: The scaffold does **not** fail. A fallback English-only `regions-config.ts` is generated automatically.
372
-
373
- **Fix**: Verify credentials in `.env`, then run:
374
- ```bash
375
- cd projects/my-store
376
- yarn generate:regions
377
- ```
378
-
379
- ### "`--generate-regions` skipped: requires dependencies"
380
-
381
- **Cause**: `--generate-regions` was used together with `--skip-install`.
382
-
383
- **Fix**: Install dependencies first, then run region generation manually:
384
- ```bash
385
- yarn install && yarn generate:regions
386
- ```
387
-
388
340
  ### "yarn install failed — run it manually"
389
341
 
390
342
  **Cause**: Missing dependencies or network issues.
@@ -458,10 +410,9 @@ The package is structured for maintainability:
458
410
  | `src/helpers/vercel.ts` | Vercel project creation via REST API |
459
411
  | `src/helpers/prompts.ts` | Shared TTY-aware interactive prompts |
460
412
  | `src/helpers/install.ts` | Yarn install wrapper |
461
- | `src/helpers/env.ts` | .env + .npmrc creation (accepts overrides for backend flags) |
462
- | `src/helpers/site-config.ts` | Patches `config/site.config.ts` with `--preset` / `--site-url` |
413
+ | `src/helpers/env.ts` | .env creation (accepts backend overrides) |
463
414
  | `src/helpers/agents-dir.ts` | .agents/ directory generation (AGENTS.md + context/ + skills/) |
464
- | `tsup.config.ts` | Build config + template bundling hook (copies regions script) |
415
+ | `tsup.config.ts` | Build config + template bundling hook |
465
416
 
466
417
  ### Dual-mode detection
467
418