tutuca 0.9.16 → 0.9.17

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
@@ -59,6 +59,79 @@ Zero-dependency batteries included SPA framework.
59
59
  </html>
60
60
  ```
61
61
 
62
+ ## CLI
63
+
64
+ Tutuca ships a single-file CLI (`dist/tutuca-cli.js`) for inspecting, linting,
65
+ documenting, and rendering components defined in an ES module. The module just
66
+ needs to export `getComponents()` and, for render-time commands, `getExamples()`
67
+ in the storybook shape `{ title, description?, groups?, items: [{ title, description?, value, view? }] }`.
68
+
69
+ ### Setup
70
+
71
+ ```sh
72
+ npm install --save-dev tutuca jsdom
73
+ # prettier is optional, only needed for --pretty
74
+ npm install --save-dev prettier
75
+ ```
76
+
77
+ The package exposes `tutuca` via `bin`, so `npx tutuca` (or a global `npm i -g tutuca jsdom`) just works. `jsdom` is a peer dep because it's only needed for `render`, `lint`, `doctor`, and `stresstest`.
78
+
79
+ ### Commands
80
+
81
+ ```
82
+ tutuca <module-path> <command> [args] [flags]
83
+ tutuca stresstest [--iterations N] [--seed S]
84
+ tutuca help [command]
85
+ ```
86
+
87
+ | Command | What it does |
88
+ |---|---|
89
+ | `info` | Export inventory and counts for the module |
90
+ | `list` | List components and their fields/views |
91
+ | `examples` | List the examples defined in the module's section |
92
+ | `docs [name]` | Component API docs — all, or one by name |
93
+ | `lint [name]` | Run lint checks — all, or one by name (exit 2 on errors) |
94
+ | `render [name] [--title t] [--view v]` | Render examples to HTML |
95
+ | `doctor` | Lint + render smoke test over the whole module |
96
+ | `stresstest` | VDOM fuzz test, no module required |
97
+
98
+ Global flags: `-f, --format <cli\|md\|json\|html>`, `-o, --output <file>`, `--pretty`, `--quiet`, `-h, --help`.
99
+ Exit codes: `0` ok, `1` usage, `2` lint errors, `3` render crash.
100
+
101
+ ### Usage examples
102
+
103
+ ```sh
104
+ # Summary of what the module exports
105
+ npx tutuca ./src/components.js info
106
+
107
+ # API docs for one component, as markdown
108
+ npx tutuca ./src/components.js docs Button --format md -o docs/button.md
109
+
110
+ # Render every example to HTML, pretty-printed
111
+ npx tutuca ./src/components.js render --format html --pretty -o dist/examples.html
112
+
113
+ # Render a single named example
114
+ npx tutuca ./src/components.js render Button --title "Disabled state"
115
+
116
+ # Lint just one component (exit 2 if findings)
117
+ npx tutuca ./src/components.js lint Button
118
+
119
+ # CI smoke test — lints and renders everything
120
+ npx tutuca ./src/components.js doctor
121
+
122
+ # Fuzz the VDOM engine
123
+ npx tutuca stresstest --iterations 10000 --seed 42
124
+ ```
125
+
126
+ ### Wrapping
127
+
128
+ The invocation stays short even without wrapping, but common patterns:
129
+
130
+ - **`package.json` scripts** — `"docs": "tutuca ./src/components.js docs"`
131
+ - **Shell alias** — `tut() { npx tutuca ./src/components.js "$@"; }`, then `tut render Button`
132
+ - **`justfile` / `Makefile`** — one recipe per subcommand, passing through positionals
133
+ - **Programmatic** — `import "tutuca/cli"` (the bundled entry) for custom build integration
134
+
62
135
  ## License
63
136
 
64
137
  MIT