create-apexjs 0.6.2 → 0.6.4
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/package.json +1 -1
- package/templates/default/AGENTS.md +8 -3
- package/templates/default/pages/about.alpine +1 -1
- package/templates/default/pages/blog/[slug].alpine +1 -1
- package/templates/default/pages/blog/index.alpine +1 -1
- package/templates/default/pages/index.alpine +1 -1
- package/templates/features/auth/pages/account.alpine +1 -1
- package/templates/features/data/pages/guestbook.alpine +1 -1
- package/templates/features/i18n/pages/hello.alpine +1 -1
package/package.json
CHANGED
|
@@ -20,6 +20,7 @@ an MCP tool**. This file tells you (the agent) how to work here effectively.
|
|
|
20
20
|
apex make page dashboard # pages/dashboard.alpine (a route → /dashboard)
|
|
21
21
|
apex make component Card # components/Card.alpine (<Card /> in templates)
|
|
22
22
|
apex make component ui/Navbar # group in a folder → components/ui/Navbar.alpine (<UiNavbar />)
|
|
23
|
+
apex make client # app.client.ts — register Alpine plugins/directives/magics
|
|
23
24
|
apex make model Post title:string body:string # models/Post.ts → migration + REST + MCP CRUD
|
|
24
25
|
apex make api webhooks # server/api/webhooks.ts (defineApexRoute; also an MCP tool)
|
|
25
26
|
apex make service Billing # services/BillingService.ts
|
|
@@ -32,7 +33,7 @@ apex check # type-check (tsc --noEmit; fast with the nati
|
|
|
32
33
|
apex build --preset vercel # build + Vercel config (also: netlify, docker); then deploy
|
|
33
34
|
apex test # run Vitest
|
|
34
35
|
```
|
|
35
|
-
`apex make <kind> …` kinds: `page component api service store layout middleware test model migration auth`.
|
|
36
|
+
`apex make <kind> …` kinds: `page component api service store layout middleware test model migration auth client`.
|
|
36
37
|
|
|
37
38
|
## Project structure
|
|
38
39
|
```
|
|
@@ -48,18 +49,22 @@ locales/*.json i18n catalogs. (from `apex extend i18n`)
|
|
|
48
49
|
services/*.ts Business logic (classes). Keep routes thin; delegate here.
|
|
49
50
|
stores/*.ts Global SSR-safe state ($store.x).
|
|
50
51
|
composables/*.ts Reusable client logic (useX) for <script client>.
|
|
52
|
+
app.client.ts Optional. Default-exports (Alpine) => {…}, run BEFORE Alpine.start() —
|
|
53
|
+
register Alpine plugins ($persist, x-intersect, x-mask…), directives, magics.
|
|
51
54
|
shared/*.ts Types shared by server + client.
|
|
52
55
|
tests/*.test.ts Vitest. createTestApp boots the whole app in-process.
|
|
53
56
|
```
|
|
54
57
|
|
|
55
58
|
## The `.alpine` single-file component
|
|
59
|
+
`.alpine` is **TypeScript-only** — `<script>` blocks are always TS; `lang` is optional
|
|
60
|
+
(a `lang="js"` is a parse error).
|
|
56
61
|
```alpine
|
|
57
|
-
<script server
|
|
62
|
+
<script server>
|
|
58
63
|
// Runs on the server. loader() data becomes the page's x-data (real HTML first).
|
|
59
64
|
export function loader() { return { title: 'Hello' } }
|
|
60
65
|
export function head() { return { title: 'Hello' } } // SEO
|
|
61
66
|
</script>
|
|
62
|
-
<script client
|
|
67
|
+
<script client>
|
|
63
68
|
// Optional client-only logic; import composables here.
|
|
64
69
|
</script>
|
|
65
70
|
<template x-data>
|