@asd14/vblocks 6.4.0 → 7.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 CHANGED
@@ -3,91 +3,73 @@
3
3
 
4
4
  # @asd14/vblocks
5
5
 
6
- > Zero-config React builds, as a static site or a single HTML file
6
+ > Zero-config React builds of an SPA (single-page application), as a folder or a
7
+ > single HTML file
7
8
 
8
- **✂️ Zero config**\
9
- Needs only `src/index.tsx` and `src/index.html`
9
+ VBlocks is a zero-config React bundler, like Create React App or Parcel. It has
10
+ no SSR (server-side rendering) or SSG (static site generation), as Next.js does.
11
+
12
+ **✂️ Zero config**
13
+
14
+ - Needs only `src/index.tsx` and `src/index.html`
10
15
 
11
16
  <!--
12
17
  Using "Maximal support" to pair with "Zero config" above: nothing to set up, and
13
18
  everything set up.
14
19
  -->
15
20
 
16
- **🔋 Maximal support**\
17
- SWC, PostCSS, CSS Modules, MDX, React Refresh, Dotenv
18
-
19
- <!--
20
- PARKED until SSG is finished, then name both outputs: SPA and SSG.
21
+ **🔋 Maximal support**
21
22
 
22
- **📄 Static website**
23
- Builds to `dist/`, for any static host
24
- -->
23
+ - SWC, PostCSS, CSS Modules, MDX, React Refresh, `.env` files
25
24
 
26
- **📦 Several apps, one install**\
27
- Apps share one `package.json` and `node_modules/`. A new app reuses the
28
- installed packages
25
+ **📦 Several apps, one install**
29
26
 
30
- **🤖 Optimized for AI agents**\
31
- The agent's context contains only the app: no Webpack, PostCSS or TypeScript
32
- config to write, read or fix
27
+ - Apps share one `package.json` and `node_modules/`. A new app reuses the
28
+ installed packages
33
29
 
34
- - [Agentation](https://www.agentation.com) in development: click an element and
35
- write what to change. The agent gets the note with the element's selector,
36
- text and React components
37
- - A terminal gets color and a header. An agent reads through a pipe, and gets
38
- only the facts
30
+ **🤖 Built for AI agents**
39
31
 
40
- > [!IMPORTANT]\
41
- > VBlocks needs Node `^22.22.3`, `^24.15.0` or `>=26.0`.
32
+ - **[`use-vblocks`](.sh41/skills/use-vblocks/SKILL.md) skill**: teaches an agent
33
+ to write, serve and build a VBlocks app
34
+ - **[Agentation](https://www.agentation.com) in development**: click an element
35
+ and write what to change. The agent gets the annotation with the element's
36
+ selector, text and React components
37
+ - **Small context**:
38
+ - By default, the agent does not write, read or fix a Webpack, PostCSS or SWC
39
+ config
40
+ - VBlocks shows you color, icons and a header in a terminal. When an agent
41
+ runs VBlocks, it gets the same facts without them
42
42
 
43
43
  ## Table of contents
44
44
 
45
45
  <!-- vim-markdown-toc GFM -->
46
46
 
47
47
  - [Quick Start](#quick-start)
48
- - [Several apps in one project](#several-apps-in-one-project)
49
- - [Vocabulary](#vocabulary)
50
48
  - [How to](#how-to)
51
- - [Use environment variables](#use-environment-variables)
52
- - [Stop using `../../../` everywhere](#stop-using--everywhere)
49
+ - [Keep several apps in one project](#keep-several-apps-in-one-project)
50
+ - [Use `.env` variables](#use-env-variables)
51
+ - [Import from `src/` with `@self`](#import-from-src-with-self)
53
52
  - [Use CSS Modules](#use-css-modules)
54
53
  - [Import a file as text](#import-a-file-as-text)
54
+ - [Write a page in Markdown or MDX](#write-a-page-in-markdown-or-mdx)
55
+ - [Pick the browsers](#pick-the-browsers)
55
56
  - [Replace a default config](#replace-a-default-config)
56
57
  - [Style with Tailwind](#style-with-tailwind)
58
+ - [Send UI annotations to an AI agent](#send-ui-annotations-to-an-ai-agent)
59
+ - [Open the page from another device](#open-the-page-from-another-device)
60
+ - [Build a single HTML file](#build-a-single-html-file)
57
61
  - [Add VBlocks to an existing project](#add-vblocks-to-an-existing-project)
58
- - [References](#references)
59
- - [Commands](#commands)
60
- - [`vblocks init`](#vblocks-init)
61
- - [`vblocks serve`](#vblocks-serve)
62
- - [Agentation](#agentation)
63
- - [`vblocks build`](#vblocks-build)
64
- - [`vblocks eject`](#vblocks-eject)
65
- - [Templates](#templates)
66
- - [`plain`](#plain)
67
- - [`xyflow`](#xyflow)
68
- - [`xyflow-tabs`](#xyflow-tabs)
62
+ - [More docs](#more-docs)
63
+ - [Develop](#develop)
69
64
  - [License](#license)
70
65
 
71
66
  <!-- vim-markdown-toc -->
72
67
 
73
- <!--
74
- Order this README by three principles. Each settles one decision:
75
-
76
- - **Pain relief**, the order of sections. The section that relieves the most
77
- pain for the least reading comes first
78
- - **Progressive disclosure**, the depth of a section. A section uses only what
79
- the sections above it showed
80
- - **Colocation**, the place of a fact. A caveat sits on the step or option it
81
- limits, in a NOTE when it is tangential or points at another section
82
-
83
- Each section is one Diátaxis type (https://diataxis.fr):
84
- - Quick Start -> Tutorial
85
- - How to -> How-to guides
86
- - Vocabulary, Commands and Templates -> Reference
87
- -->
88
-
89
68
  ## Quick Start
90
69
 
70
+ > [!IMPORTANT]\
71
+ > VBlocks needs Node `^22.22.3`, `^24.15.0` or `>=26.0`.
72
+
91
73
  <!--
92
74
  Using "scaffold", the field's word for what `init` does, eg. Yeoman and
93
75
  create-vite use it.
@@ -124,19 +106,25 @@ scaffolders spots the folder at a glance, as with `vite-project` and
124
106
  npx vblocks serve
125
107
  ```
126
108
 
109
+ The server runs at `http://localhost:8080`, or the next free port. It opens
110
+ the page in the browser.
111
+
127
112
  3. **Build**
128
113
 
129
114
  ```sh
130
- npx vblocks build # production bundle in dist/
131
- npx vblocks build --single-file # one dist/index.html, every asset inlined
115
+ npx vblocks build # production bundle in dist/
132
116
  ```
133
117
 
134
- ### Several apps in one project
118
+ ## How to
119
+
120
+ ### Keep several apps in one project
135
121
 
136
122
  Several apps, eg. demos or MVP sketches, can share one `package.json` and one
137
- `node_modules/`:
123
+ `node_modules/`. The [project folder](docs/REFERENCE.md#domain-vocabulary)
124
+ contains the plumbing, and each
125
+ [app folder](docs/REFERENCE.md#domain-vocabulary) contains one app:
138
126
 
139
- 1. **Add the plumbing**
127
+ 1. **Create the project folder**
140
128
 
141
129
  ```sh
142
130
  npx @asd14/vblocks init sketches --only plumbing
@@ -174,27 +162,7 @@ Several apps, eg. demos or MVP sketches, can share one `package.json` and one
174
162
  npx vblocks serve --prefix flow-diagram
175
163
  ```
176
164
 
177
- ## Vocabulary
178
-
179
- <!--
180
- Keep Vocabulary after Quick Start since the reader has no context to place
181
- the definitions in.
182
- -->
183
-
184
- | Term | Means |
185
- | :----------------- | :------------------------------------------------------------ |
186
- | **Plumbing** | The project files `init` writes: `package.json`, `.gitignore` |
187
- | **Project folder** | The folder with `package.json` |
188
- | **App folder** | The folder with `src/index.tsx` and `src/index.html` |
189
-
190
- ## How to
191
-
192
- <!--
193
- Each ### names a pain as the task that relieves it. Order the guides by how
194
- early the Quick Start reader has the pain.
195
- -->
196
-
197
- ### Use environment variables
165
+ ### Use `.env` variables
198
166
 
199
167
  1. **Create a `.env` file in your app folder**
200
168
 
@@ -217,10 +185,10 @@ variable your code does not read.
217
185
  > the page can read it.
218
186
 
219
187
  > [!NOTE]\
220
- > The [client types](types/client.d.ts) declare `process.env` and nothing else
221
- > from Node, because Webpack replaces nothing else.
188
+ > The [client types](types/client.d.ts) declare only `process.env`. The browser
189
+ > has no other part of Node's `process`.
222
190
 
223
- ### Stop using `../../../` everywhere
191
+ ### Import from `src/` with `@self`
224
192
 
225
193
  VBlocks resolves `@self` to the `src/` of your app folder:
226
194
 
@@ -232,8 +200,8 @@ import { Button } from "@self/components/button.tsx"
232
200
  > [!NOTE]\
233
201
  > VBlocks compiles TypeScript with SWC and does not typecheck. Run `tsc`
234
202
  > yourself. Your `tsconfig.json` needs the same alias as Webpack.
235
- > The `tsconfig.json` that [`vblocks init`](#vblocks-init) writes already has
236
- > it. Otherwise, add:
203
+ > The `tsconfig.json` that [`vblocks init`](docs/REFERENCE.md#vblocks-init)
204
+ > writes already has it. Otherwise, add:
237
205
  >
238
206
  > ```diff
239
207
  > {
@@ -260,20 +228,19 @@ import { Button } from "@self/components/button.tsx"
260
228
  /* src/button.tsx */
261
229
  import styles from "./button.module.css"
262
230
 
263
- export const Button = () => <button className={styles.primaryButton} />
231
+ export const Button = () => <button className={styles["primaryButton"]} />
264
232
  ```
265
233
 
266
- - **camelCase keys** - `.primary-button` becomes `styles.primaryButton`
267
- - **Class names** - a bare hash in `production` mode, `[local]__[hash]` in
268
- `development` mode
234
+ Each class name is a bare hash in `production` mode, and `[local]__[hash]` in
235
+ `development` mode.
269
236
 
270
237
  > [!NOTE]\
271
- > The [client types](types/client.d.ts) declare `.css`, image and font imports.
238
+ > The [client types](types/client.d.ts) declare each `*.module.css` import as an
239
+ > object of class names.
272
240
 
273
241
  ### Import a file as text
274
242
 
275
- Add `?raw` to the import path. The import returns the file's contents as a
276
- string, as in Vite:
243
+ Add `?raw` to the import path, as in Vite:
277
244
 
278
245
  ```tsx
279
246
  import greeting from "./greeting.txt?raw"
@@ -281,32 +248,78 @@ import greeting from "./greeting.txt?raw"
281
248
  ```
282
249
 
283
250
  > [!NOTE]\
284
- > The [client types](types/client.d.ts) type each `?raw` import as a `string`.
251
+ > The [client types](types/client.d.ts) declare each `?raw` import as a
252
+ > `string`.
253
+
254
+ ### Write a page in Markdown or MDX
255
+
256
+ Import an `.md` or `.mdx` file as a React component:
257
+
258
+ ```tsx
259
+ import Intro from "./intro.mdx"
260
+
261
+ const App = () => <Intro />
262
+ ```
263
+
264
+ Pass `components` to replace the element MDX renders for a tag, eg. each `#`
265
+ heading:
266
+
267
+ ```tsx
268
+ <Intro components={{ h1: Title }} />
269
+ ```
270
+
271
+ > [!NOTE]\
272
+ > The [client types](types/client.d.ts) declare each `.md` and `.mdx` import as
273
+ > a React component.
274
+
275
+ ### Pick the browsers
276
+
277
+ SWC, Webpack and `postcss-preset-env` compile for the browsers of the app's
278
+ browserslist config, from the app folder up:
279
+
280
+ - a `.browserslistrc`
281
+ - or the `browserslist` field of `package.json`
282
+
283
+ Without one, they compile for the VBlocks default, `> 0.25%, not dead`.
284
+
285
+ 1. **Eject the default into your app folder**
286
+
287
+ ```sh
288
+ npx vblocks eject browserslist > .browserslistrc
289
+ ```
290
+
291
+ 2. **Update the query**, see
292
+ [the queries of browserslist](https://github.com/browserslist/browserslist#queries)
285
293
 
286
294
  ### Replace a default config
287
295
 
288
- Each config in your app folder replaces the default of the same name:
296
+ A config in your app folder replaces the VBlocks default of the same name:
289
297
 
290
298
  - `webpack.config.js`
291
299
  - `postcss.config.js`, the default runs:
292
300
  - `postcss-preset-env`, which compiles nesting, `oklch()` and `color-mix()`
293
301
  for older browsers and adds vendor prefixes
294
302
  - `cssnano` in `production`
295
- - `.swcrc`, the default targets `> 0.25%, not dead`
303
+ - `.swcrc`
304
+ - `.browserslistrc`, the default `> 0.25%, not dead`
296
305
 
297
- 1. **[Eject](#vblocks-eject) the default into your app folder**
306
+ 1. **[Eject](docs/REFERENCE.md#vblocks-eject) the default into your app folder**
298
307
 
299
308
  ```sh
300
309
  cd my-vblocks-app
301
310
  npx vblocks eject swc > .swcrc
302
311
  ```
303
312
 
313
+ An ejected config loads its plugins and loaders from the project folder, not
314
+ from VBlocks. Install them there.
315
+
304
316
  2. **Update the ejected file**
305
317
 
306
318
  > [!NOTE]\
307
319
  > VBlocks does not merge your config with the default, with two exceptions:
308
320
  >
309
- > - `.swcrc -> env.targets`: VBlocks adds the default when yours is missing
321
+ > - `.swcrc -> env.path`: VBlocks adds the app folder when yours is missing, so
322
+ > SWC reads the browserslist config
310
323
  > - `.swcrc -> jsc.transform.react.refresh`: VBlocks adds the React Refresh
311
324
  > transform when `serve` runs in `development` mode
312
325
 
@@ -316,8 +329,8 @@ VBlocks does not include Tailwind. Add it through a `postcss.config.js` in your
316
329
  app folder:
317
330
 
318
331
  > [!NOTE]\
319
- > The `xyflow` and `xyflow-tabs` templates of [`vblocks init`](#vblocks-init)
320
- > have this setup.
332
+ > The `xyflow` and `xyflow-tabs` templates of
333
+ > [`vblocks init`](docs/REFERENCE.md#vblocks-init) have this setup.
321
334
 
322
335
  1. **Install Tailwind, its PostCSS plugin and cssnano, which the ejected config
323
336
  imports**
@@ -364,8 +377,51 @@ app folder:
364
377
  `src/`.
365
378
 
366
379
  - Without it, Tailwind scans the folder you run VBlocks from. With
367
- [`--prefix`](#vblocks-build), that is the project folder, which contains
368
- every app. Each app's CSS then also gets the classes of the other apps
380
+ [`--prefix`](docs/REFERENCE.md#vblocks-build), that is the project folder,
381
+ which contains every app. Each app's CSS then also gets the classes of the
382
+ other apps
383
+
384
+ ### Send UI annotations to an AI agent
385
+
386
+ [Agentation](https://www.agentation.com) is a toolbar to send annotations on the
387
+ UI to a coding agent. `vblocks init` writes it into `src/index.tsx`. The toolbar
388
+ shows in `development` mode, the default of `serve`.
389
+
390
+ 1. **Configure the agentation-mcp server**, see
391
+ [Agentation's docs](https://www.agentation.com/mcp)
392
+
393
+ 2. **Set `AGENTATION_ENDPOINT` in the `.env` of the app folder**, as in
394
+ `.env.example`
395
+
396
+ ```env
397
+ AGENTATION_ENDPOINT=http://localhost:4747
398
+ ```
399
+
400
+ > [!NOTE]\
401
+ > Agentation's license is PolyForm Shield 1.0.0, not MIT. To remove Agentation,
402
+ > remove its lines from `src/index.tsx` and run `npm uninstall agentation`.
403
+
404
+ ### Open the page from another device
405
+
406
+ The server listens on `localhost`, so another device cannot open the page. Pass
407
+ `-- --host 0.0.0.0` to expose it to the network:
408
+
409
+ ```sh
410
+ npx vblocks serve -- --host 0.0.0.0
411
+ ```
412
+
413
+ ### Build a single HTML file
414
+
415
+ `--single-file` builds one standalone `dist/index.html`, every asset inlined,
416
+ with no `robots.txt`:
417
+
418
+ ```sh
419
+ npx vblocks build --single-file
420
+ ```
421
+
422
+ > [!IMPORTANT]\
423
+ > A browser opens it from disk. There, `history.pushState` to another path
424
+ > throws, so keep the route in the URL hash.
369
425
 
370
426
  ### Add VBlocks to an existing project
371
427
 
@@ -376,7 +432,7 @@ app folder:
376
432
  ```
377
433
 
378
434
  2. **Add the [client types](types/client.d.ts) and the
379
- [`@self`](#stop-using--everywhere) alias to your `tsconfig.json`**
435
+ [`@self`](#import-from-src-with-self) alias to your `tsconfig.json`**
380
436
 
381
437
  ```diff
382
438
  {
@@ -392,220 +448,44 @@ app folder:
392
448
  > TypeScript's `nodenext` resolution requires. VBlocks resolves it to
393
449
  > `button.tsx`.
394
450
 
395
- 3. **Move `index.tsx` and `index.html` into `src/`**
451
+ 3. **Put your entry at `src/index.tsx` and your page at `src/index.html`**
396
452
 
397
- > [!NOTE]\
398
- > VBlocks builds `dist/index.html` from `src/index.html` and adds the script and
399
- > stylesheet tags to it. Remove the tag that loads your entry, eg. Vite's
400
- > `<script type="module" src="/src/main.tsx"></script>`.
453
+ 4. **Remove the tag that loads your entry from `src/index.html`**, eg. Vite's
454
+ `<script type="module" src="/src/main.tsx"></script>`
455
+
456
+ VBlocks builds `dist/index.html` from `src/index.html` and adds the script
457
+ and stylesheet tags to it.
401
458
 
402
- 4. **Start a development server**
459
+ 5. **Start a development server**
403
460
 
404
461
  ```sh
405
462
  npx vblocks serve
406
463
  ```
407
464
 
408
- ## References
409
-
410
- ### Commands
411
-
412
- Each command prints its own help with `--help`, eg. `npx vblocks serve --help`.
413
-
414
- #### `vblocks init`
415
-
416
- Write a template's plumbing, app, or both into `<directory>`.
417
-
418
- ```text
419
- vblocks init <directory>
420
- [--template <plain|xyflow|xyflow-tabs>]
421
- [--only <app|plumbing>]
422
- ```
423
-
424
- - `<directory>`
425
- - The folder to write into. It must be missing or empty
426
- - `--template` (default: `plain`)
427
- - The template to write, see [Templates](#templates)
428
- - `--only` (default: both)
429
- - Write one part of the template
430
- - `plumbing`: `package.json`, `.gitignore`
431
- - `app`: `src/`, `.env.example`, `tsconfig.json` and the template's configs.
432
- `init` adds the template's dependencies to the `package.json` of the
433
- [project folder](#vocabulary), the parent of `<directory>`. Without a
434
- `package.json` there, `init` fails
435
-
436
- #### `vblocks serve`
437
-
438
- Start the development server.
439
-
440
- - Runs at `http://localhost:8080`, or the next free port
441
- - Shows the [Agentation](#agentation) toolbar (`vblocks init` writes it into
442
- `src/index.tsx`)
443
- - Listens on `localhost`, so another device on your network, eg. a phone, cannot
444
- open the page
445
- - Opens the page in the browser
446
-
447
- ```text
448
- vblocks serve
449
- [--mode <development|production>]
450
- [--prefix <directory>]
451
- [--analyze]
452
- [--log-level <error|warn|info|verbose>]
453
- [-- <webpack option>...]
454
- ```
455
-
456
- - `--mode` (default: `development`)
457
- - The Webpack mode
458
- - React Refresh and the Agentation toolbar run only in `development`
459
- - `--prefix` (default: the current folder)
460
- - The [app folder](#vocabulary), which must exist
461
- - `--analyze`
462
- - Run the bundle analyzer, on a free port
463
- - `--log-level` (default: `warn`)
464
- - How much Webpack and its development server print
465
- - `-- <webpack option>...`
466
- - Any [`webpack serve`](https://webpack.js.org/api/cli/) option
467
- - `serve` passes each one to Webpack unchanged
468
- - eg. `-- --host 0.0.0.0`, to listen on the network
469
-
470
- ##### Agentation
471
-
472
- [Agentation](https://www.agentation.com) is a toolbar for UI feedback to a
473
- coding agent.
474
-
475
- - Configure the agentation-mcp server, see
476
- [Agentation's docs](https://www.agentation.com/mcp)
477
- - Set `AGENTATION_ENDPOINT` in the `.env` of the app folder, as in
478
- `.env.example`
479
-
480
- > [!NOTE]\
481
- > Agentation's license is PolyForm Shield 1.0.0, not MIT. To remove Agentation,
482
- > remove its lines from `src/index.tsx` and run `npm uninstall agentation`.
483
-
484
- #### `vblocks build`
485
-
486
- Build the app into a bundle in the `dist/` of the app folder.
465
+ ## More docs
487
466
 
488
- By default, `build`:
467
+ - **Reference**: every command, template and environment variable, in
468
+ [docs/REFERENCE.md](docs/REFERENCE.md)
469
+ - **Decisions**: why the code is this way, in
470
+ [docs/DECISIONS.md](docs/DECISIONS.md)
471
+ - **Release history**: what each version added, fixed and removed, in
472
+ [GitHub releases](https://github.com/asd-xiv/vblocks/releases)
489
473
 
490
- - Writes JS and CSS files with content-hashed names
491
- - Writes a `react` chunk, and a `vendors` chunk when your other dependencies
492
- total over 20 KB (10 KB in `development`)
493
- - Inlines `jpg`, `gif`, `png` and `svg` files up to 10 KB
494
- - Writes larger images to `dist/` with content-hashed names
495
- - Writes `woff`, `woff2`, `ttf` and `eot` files to `dist/fonts/`
496
- - Copies `src/public/favicon.svg` and `src/public/robots.txt` of your app, or
497
- the defaults of VBlocks
474
+ ## Develop
498
475
 
499
476
  ```text
500
- vblocks build
501
- [--mode <development|production>]
502
- [--prefix <directory>]
503
- [--single-file|--single]
504
- [--log-level <error|warn|info|verbose>]
505
- [-- <webpack option>...]
477
+ vblocks/
478
+ ├── bin/ # vblocks, and one file per command in vblocks.d/
479
+ ├── defaults/ # the configs that eject prints
480
+ ├── template/ # the templates of init
481
+ └── types/ # client.d.ts
506
482
  ```
507
483
 
508
- - `--mode` (default: `production`)
509
- - The Webpack mode
510
- - In `production`, `build` minifies JS, HTML and, with the default PostCSS
511
- config, CSS
512
- - `--prefix` (default: the current folder)
513
- - The [app folder](#vocabulary), which must exist
514
- - `--single-file|--single`
515
- - Write one standalone `dist/index.html`, every asset inlined
516
- - A browser opens the file from disk, with no server and no network
517
- - The bundle has no `robots.txt`
518
- - Keep the route in the URL hash
519
- - On `file://`, `history.pushState` to another path throws
520
- - `--log-level` (default: `warn`)
521
- - How much Webpack prints
522
- - `-- <webpack option>...`
523
- - Any [`webpack build`](https://webpack.js.org/api/cli/) option
524
- - `build` passes each one to Webpack unchanged
525
- - eg. `-- --devtool source-map`, to write source maps
526
-
527
- #### `vblocks eject`
528
-
529
- Print a default config to stdout.
530
-
531
- ```text
532
- vblocks eject <webpack|postcss|swc>
533
- ```
534
-
535
- - `<webpack|postcss|swc>`
536
- - The config to print
537
-
538
- Run it in your app folder and save the output there, to
539
- [replace the default](#replace-a-default-config):
540
-
541
- ```sh
542
- npx vblocks eject webpack > webpack.config.js
543
- npx vblocks eject postcss > postcss.config.js
544
- npx vblocks eject swc > .swcrc
545
- ```
546
-
547
- An ejected config loads its plugins and loaders from your project. Install them
548
- in the project folder, eg. `postcss-preset-env` and `cssnano` for the PostCSS
549
- config.
550
-
551
- ### Templates
552
-
553
- Every template scaffolds:
554
-
555
- ```text
556
- src/
557
- ├── index.tsx # mounts App, and the Agentation toolbar in development
558
- ├── index.app.tsx # App, one per template
559
- ├── index.html
560
- └── index.css # the global CSS and its @imports, a Webpack entry of its
561
- # own, so no .tsx needs to import it
562
- .env.example # AGENTATION_ENDPOINT
563
- tsconfig.json
564
- ```
565
-
566
- - Adds `agentation` to the `devDependencies` of the project folder
567
- - Each `src/index.<concern>.tsx` defines one concern of `src/index.tsx`, eg.
568
- `index.app.tsx` defines App
569
-
570
- #### `plain`
571
-
572
- "Hello World!" in `src/index.app.tsx`.
573
-
574
- - Adds no other packages
575
-
576
- #### `xyflow`
577
-
578
- One diagram, and a details panel for the selected node or edge.
579
-
580
- - Adds `@xyflow/react`, `tailwindcss`, `@tailwindcss/postcss` and `cssnano` to
581
- the `package.json` of the project folder
582
- - Writes a `postcss.config.js` that configures Tailwind
583
-
584
- ```text
585
- src/
586
- ├── index.app.tsx # the layout: header, diagram, details panel, the selected id
587
- ├── diagram.tsx # the nodes and edges, placed and sized in grid cells
588
- ├── details.tsx # the panel for the selected node or edge
589
- └── utils/grid.ts # CELL_SIZE and toPixels
590
- ```
591
-
592
- #### `xyflow-tabs`
593
-
594
- One tab per diagram, each with its own details panel.
595
-
596
- - Adds the same packages and `postcss.config.js` as `xyflow`
597
-
598
- ```text
599
- src/
600
- ├── index.app.tsx # the layout: header, tab bar, details panel, the selected id
601
- ├── pages/
602
- │ ├── build/
603
- │ │ ├── diagram.tsx # the nodes and edges of one tab, in grid cells
604
- │ │ └── details.tsx # the panel for its selected node or edge
605
- │ └── serve/ # the same two files
606
- ├── ui/zoom-level.tsx # the zoom level, and a Reset to 100%
607
- └── utils/grid.ts # CELL_SIZE and toPixels
608
- ```
484
+ | Script | Does |
485
+ | :------------------ | :----------------------------------------------------------------- |
486
+ | `npm run lint` | Runs ESLint |
487
+ | `npm run typecheck` | Typechecks the code and the client types |
488
+ | `npm run unit-test` | Typechecks, builds and serves every template `vblocks init` writes |
609
489
 
610
490
  ## License
611
491
 
package/bin/vblocks CHANGED
@@ -3,7 +3,8 @@
3
3
  set -eu
4
4
 
5
5
  # NAME
6
- # vblocks - Zero-config React builds, as a static site or a single HTML file
6
+ # vblocks - Zero-config React builds of an SPA (single-page application), as
7
+ # a folder or a single HTML file
7
8
  #
8
9
  # SYNOPSIS
9
10
  # vblocks <command> [OPTIONS]
@@ -35,7 +36,7 @@ set -eu
35
36
  # vblocks init, vblocks serve, vblocks build, vblocks eject
36
37
 
37
38
  # npm links the command to this file, so "$0" names the link. realpath follows
38
- # it to the package, where vblocks.d/ holds the commands
39
+ # it to the package, where vblocks.d/ contains the commands
39
40
  _SCRIPT_DIR="$(dirname "$(realpath "$0")")/vblocks.d"
40
41
  # shellcheck source=vblocks.d/lib/log.sh
41
42
  . "$_SCRIPT_DIR/lib/log.sh"