@cavulsqa/create 0.1.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 +63 -0
- package/bin/create.mjs +142 -0
- package/lib/scaffold.mjs +124 -0
- package/package.json +60 -0
- package/templates/f7-app/.claude/rules/data-fetching.md +67 -0
- package/templates/f7-app/.claude/rules/database.md +65 -0
- package/templates/f7-app/.claude/rules/framework7-ui.md +79 -0
- package/templates/f7-app/.claude/rules/modules.md +43 -0
- package/templates/f7-app/.claude/rules/native.md +47 -0
- package/templates/f7-app/.claude/skills/f7-design/SKILL.md +67 -0
- package/templates/f7-app/.claude/skills/f7-design/components.md +49 -0
- package/templates/f7-app/.claude/skills/f7-design/icons.md +52 -0
- package/templates/f7-app/.claude/skills/module-architecture/SKILL.md +65 -0
- package/templates/f7-app/.claude/skills/module-architecture/file-templates.md +183 -0
- package/templates/f7-app/.claude/skills/reactive-data/SKILL.md +89 -0
- package/templates/f7-app/.claude/skills/reactive-data/testing.md +55 -0
- package/templates/f7-app/CLAUDE.md +105 -0
- package/templates/f7-app/auto-imports.d.ts +667 -0
- package/templates/f7-app/capacitor.config.ts +14 -0
- package/templates/f7-app/components.d.ts +59 -0
- package/templates/f7-app/index.html +15 -0
- package/templates/f7-app/package.json +51 -0
- package/templates/f7-app/src/App.vue +72 -0
- package/templates/f7-app/src/app/tabs.ts +25 -0
- package/templates/f7-app/src/assets/css/app.css +1 -0
- package/templates/f7-app/src/assets/css/icons.css +50 -0
- package/templates/f7-app/src/assets/fonts/material-icons-outlined.woff2 +0 -0
- package/templates/f7-app/src/assets/fonts/material-icons-round.woff2 +0 -0
- package/templates/f7-app/src/domains/sales/sales.repository.ts +458 -0
- package/templates/f7-app/src/env.d.ts +23 -0
- package/templates/f7-app/src/locales/en.json +179 -0
- package/templates/f7-app/src/locales/fr.json +179 -0
- package/templates/f7-app/src/main.ts +50 -0
- package/templates/f7-app/src/modules/demo/components/DemoBusLog.vue +26 -0
- package/templates/f7-app/src/modules/demo/components/DemoCreateOrderSheet.vue +160 -0
- package/templates/f7-app/src/modules/demo/components/DemoOrderList.vue +73 -0
- package/templates/f7-app/src/modules/demo/components/DemoPipelineBenchmark.vue +52 -0
- package/templates/f7-app/src/modules/demo/components/DemoStatCards.vue +63 -0
- package/templates/f7-app/src/modules/demo/composables/useReactiveDemo.ts +168 -0
- package/templates/f7-app/src/modules/demo/router/routes/demo.routes.ts +34 -0
- package/templates/f7-app/src/modules/demo/views/DemoView.vue +126 -0
- package/templates/f7-app/src/modules/demo/views/OrderDetailView.vue +131 -0
- package/templates/f7-app/src/modules/demo/views/OrderSearchView.vue +106 -0
- package/templates/f7-app/src/modules/home/composables/useHomeFeatures.ts +133 -0
- package/templates/f7-app/src/modules/home/router/routes/home.routes.ts +29 -0
- package/templates/f7-app/src/modules/home/views/FeatureDetailView.vue +108 -0
- package/templates/f7-app/src/modules/home/views/HomeView.vue +53 -0
- package/templates/f7-app/src/modules/settings/router/routes/settings.routes.ts +16 -0
- package/templates/f7-app/src/modules/settings/views/SettingsView.vue +126 -0
- package/templates/f7-app/src/plugins/capacitor/index.ts +14 -0
- package/templates/f7-app/src/plugins/capacitor/useAndroidBackButton.ts +68 -0
- package/templates/f7-app/src/plugins/capacitor/useKeyboard.ts +61 -0
- package/templates/f7-app/src/plugins/capacitor/useSplashScreen.ts +11 -0
- package/templates/f7-app/src/plugins/capacitor/useStatusBar.ts +15 -0
- package/templates/f7-app/src/plugins/framework7.plugin.ts +41 -0
- package/templates/f7-app/src/plugins/i18n.plugin.ts +10 -0
- package/templates/f7-app/src/plugins/seed.plugin.ts +17 -0
- package/templates/f7-app/src/plugins/sqlite.plugin.ts +21 -0
- package/templates/f7-app/src/router/global/global.routes.ts +16 -0
- package/templates/f7-app/src/router/index.ts +18 -0
- package/templates/f7-app/src/shared/components/error/404.vue +12 -0
- package/templates/f7-app/src/shared/components/metrics/MetricsPanel.vue +79 -0
- package/templates/f7-app/src/shared/composables/theme/useAppTheme.ts +68 -0
- package/templates/f7-app/src/shared/composables/useTabbarVisibility.ts +50 -0
- package/templates/f7-app/src/shared/database/database.ts +86 -0
- package/templates/f7-app/src/shared/database/index.ts +3 -0
- package/templates/f7-app/src/shared/database/migrations.ts +81 -0
- package/templates/f7-app/src/shared/database/queries.ts +22 -0
- package/templates/f7-app/src/shared/database/schema.ts +59 -0
- package/templates/f7-app/src/shared/utils/resolvers/resolvers.ts +152 -0
- package/templates/f7-app/tests/icons.test.ts +81 -0
- package/templates/f7-app/tests/sales.repository.test.ts +329 -0
- package/templates/f7-app/tsconfig.json +21 -0
- package/templates/f7-app/tsconfig.node.json +14 -0
- package/templates/f7-app/vite.config.ts +95 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# App instructions
|
|
2
|
+
|
|
3
|
+
An offline-first mobile app: Vue 3 + Framework7 + Capacitor over a local SQLite database that
|
|
4
|
+
screens read reactively. Generated from `@cavulsqa/template-f7-app`.
|
|
5
|
+
|
|
6
|
+
**SQLite is the source of truth.** There is no server in this template. A screen reads the local
|
|
7
|
+
database and a write to the local database refreshes it. If you add a backend, it syncs _into_
|
|
8
|
+
SQLite — it does not become the thing screens read.
|
|
9
|
+
|
|
10
|
+
## Stack
|
|
11
|
+
|
|
12
|
+
Vue 3.5 `<script setup lang="ts">` · Framework7 9 (+ framework7-vue 8) · Capacitor 8 (Android
|
|
13
|
+
first) · Kysely over `@capacitor-community/sqlite` · vue-i18n · Tailwind 4 · Vite+ (`vp`).
|
|
14
|
+
|
|
15
|
+
Data layer comes from three published packages, not from this repo:
|
|
16
|
+
|
|
17
|
+
| Package | What it gives you |
|
|
18
|
+
| ------------------------ | ------------------------------------------------------------------ |
|
|
19
|
+
| `@cavulsqa/mobile-db` | The Capacitor SQLite dialect, migrations, transaction-aware writes |
|
|
20
|
+
| `@cavulsqa/reactive-db` | Change bus, result cache, visibility gate, query metrics |
|
|
21
|
+
| `@cavulsqa/reactive-vue` | `useReactiveQuery` and the Framework7 page-visibility adapter |
|
|
22
|
+
|
|
23
|
+
Do not vendor or fork them. If one is wrong, fix it there and bump the version.
|
|
24
|
+
|
|
25
|
+
## Layout
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
src/
|
|
29
|
+
├── app/ tabs.ts — the tab bar as data
|
|
30
|
+
├── router/ index.ts aggregates module routes; global/ holds the catch-all
|
|
31
|
+
├── domains/ <domain>/<domain>.repository.ts — SQL, no Vue
|
|
32
|
+
├── modules/ <feature>/{router/routes,views,components,composables}
|
|
33
|
+
├── shared/ database/, composables/, components/, utils/
|
|
34
|
+
├── plugins/ framework7, capacitor/, i18n, sqlite bootstrap
|
|
35
|
+
└── locales/ en.json, fr.json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
A module owns its routes, views, components and composables. A `domain` owns SQL and nothing else —
|
|
39
|
+
no `ref`, no lifecycle, no Framework7. `shared` is for things two modules genuinely both need;
|
|
40
|
+
"might need later" is not a reason to put something there.
|
|
41
|
+
|
|
42
|
+
## Hard rules
|
|
43
|
+
|
|
44
|
+
Detailed rules live in `.claude/rules/`, and `.claude/skills/` holds the workflows:
|
|
45
|
+
|
|
46
|
+
| Skill | Reach for it when |
|
|
47
|
+
| --------------------- | ---------------------------------------------------------------------- |
|
|
48
|
+
| `f7-design` | Building or changing any screen, component or layout |
|
|
49
|
+
| `reactive-data` | Any query, mutation, repository, migration, or a screen not refreshing |
|
|
50
|
+
| `module-architecture` | Adding a feature, or deciding where a file belongs |
|
|
51
|
+
|
|
52
|
+
The short version of the rules, each earned by a real bug:
|
|
53
|
+
|
|
54
|
+
- **Never import an `f7-*` component.** `Framework7VueResolver` imports it where it is used. A
|
|
55
|
+
manual import is a merge conflict with the resolver and a sign you did not read
|
|
56
|
+
`.claude/rules/framework7-ui.md`.
|
|
57
|
+
- **Never write a CSS background, height or safe-area rule.** Framework7's theme owns those.
|
|
58
|
+
`assets/css/app.css` is one line — the Tailwind import — and `icons.css` is font wiring. If a
|
|
59
|
+
screen looks wrong, you are fighting the theme, not missing CSS.
|
|
60
|
+
- **An icon name is verified against the font, never guessed.** framework7-icons is a ligature
|
|
61
|
+
font: a wrong name renders _nothing at all_, silently. `tests/icons.test.ts` checks every name in
|
|
62
|
+
the app against the ttf. Run it.
|
|
63
|
+
- **A reactive query's `tables` must list exactly what its function reads.** Under-list and the
|
|
64
|
+
screen goes stale with no error. See `.claude/rules/data-fetching.md`.
|
|
65
|
+
- **Every write goes through `rdb`**, never `getDatabase().db`. `rdb` announces the tables it
|
|
66
|
+
touched; a raw write is invisible to every query watching them.
|
|
67
|
+
- **`queryKey` is an identity, not a label.** Default to `uniqueQueryKey()`.
|
|
68
|
+
- **An inserted id comes from `insertId`, never `.returning(...)`.** Inside a transaction the
|
|
69
|
+
SQLite plugin executes the statement and drops its RETURNING rows, so the insert succeeds and
|
|
70
|
+
kysely reports `no result`. See `.claude/rules/database.md`.
|
|
71
|
+
- **Money is integer cents.** A float total is a rounding bug waiting to happen.
|
|
72
|
+
- **`f7route` and `f7router` are props**, not imports: `defineProps<{ f7route: Router.Route }>()`.
|
|
73
|
+
- **In locale files, `@` and `|` are message syntax.** `@` starts a linked message and `|` a plural
|
|
74
|
+
branch. A literal `@` must be `{'@'}` or the whole locale file fails to compile.
|
|
75
|
+
- **No comments that narrate.** A comment explains a non-obvious _why_ — a platform quirk, an
|
|
76
|
+
invariant, a measured trade-off. Never what the next line does, never a task reference.
|
|
77
|
+
|
|
78
|
+
## Verification
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
vp check # format, lint, type-check the workspace
|
|
82
|
+
vp test # the repository and icon tests
|
|
83
|
+
pnpm type-check # vue-tsc, the gate for anything touching .vue
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`vue-tsc` and `vp check` disagree by design: `vp check` compiles `vite.config.ts` under a separate
|
|
87
|
+
tsconfig because vite-plus bundles its own Vite while the unplugins take it as a peer. Both must
|
|
88
|
+
pass.
|
|
89
|
+
|
|
90
|
+
**Type-checking is not verification for UI.** A screen that compiles can still render an empty
|
|
91
|
+
box — that is how seven invisible icons and a blank-page bootstrap both shipped. If you changed
|
|
92
|
+
something visual, say plainly that you have not seen it run.
|
|
93
|
+
|
|
94
|
+
## What not to do
|
|
95
|
+
|
|
96
|
+
- Do not add a state library. Two composables and the change bus cover this app; Pinia earns its
|
|
97
|
+
place when there is cross-module state that outlives a screen, not before.
|
|
98
|
+
- Do not add a data-fetching library. If you need a shared cache across screens, read the note in
|
|
99
|
+
`@cavulsqa/reactive-vue`'s README about driving TanStack Query from the bus rather than growing
|
|
100
|
+
`useReactiveQuery`.
|
|
101
|
+
- Do not assume the toolchain. Capacitor 8 compiles against **JDK 21** - an older default JDK
|
|
102
|
+
fails with `invalid source release: 21` from inside capacitor-android, which reads as a
|
|
103
|
+
Capacitor bug and is not one.
|
|
104
|
+
- Do not build for the web. `vp dev` in a browser runs sql.js in memory so the app is inspectable;
|
|
105
|
+
the target is a device, and anything that only works in a browser is not done.
|