@asd14/vblocks 5.2.0 β†’ 5.4.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
@@ -28,8 +28,8 @@ Apps share one `package.json` and `node_modules/`. A new app reuses the
28
28
  installed packages
29
29
 
30
30
  **πŸ€– Optimized for AI agents**
31
- The agent's context holds only the app: no Webpack, PostCSS or TypeScript
32
- config to write, read or fix
31
+ The agent's context holds only the app: no Webpack, PostCSS or TypeScript config
32
+ to write, read or fix
33
33
 
34
34
  > [!IMPORTANT]
35
35
  > VBlocks needs Node `^22.22.3`, `^24.15.0` or `>=26.0`.
@@ -48,11 +48,16 @@ config to write, read or fix
48
48
  - [Replace a default config](#replace-a-default-config)
49
49
  - [Style with Tailwind](#style-with-tailwind)
50
50
  - [Add VBlocks to an existing project](#add-vblocks-to-an-existing-project)
51
- - [Commands](#commands)
52
- - [`vblocks init`](#vblocks-init)
53
- - [`vblocks serve`](#vblocks-serve)
54
- - [`vblocks build`](#vblocks-build)
55
- - [`vblocks eject`](#vblocks-eject)
51
+ - [References](#references)
52
+ - [Commands](#commands)
53
+ - [`vblocks init`](#vblocks-init)
54
+ - [`vblocks serve`](#vblocks-serve)
55
+ - [`vblocks build`](#vblocks-build)
56
+ - [`vblocks eject`](#vblocks-eject)
57
+ - [Templates](#templates)
58
+ - [`plain`](#plain)
59
+ - [`xyflow`](#xyflow)
60
+ - [`xyflow-tabs`](#xyflow-tabs)
56
61
  - [License](#license)
57
62
 
58
63
  <!-- vim-markdown-toc -->
@@ -67,20 +72,21 @@ Order this README by three principles. Each settles one decision:
67
72
  - **Colocation**, the place of a fact. A caveat sits on the step or option it
68
73
  limits, in a NOTE when it is tangential or points at another section
69
74
 
70
- Each section is one DiΓ‘taxis type (https://diataxis.fr): Quick Start is a
71
- tutorial, How to is how-to guides, Vocabulary and Commands are reference.
75
+ Each section is one DiΓ‘taxis type (https://diataxis.fr):
76
+ - Quick Start -> Tutorial
77
+ - How to -> How-to guides
78
+ - Vocabulary, Commands and Templates -> Reference
72
79
  -->
73
80
 
74
81
  ## Quick Start
75
82
 
76
- <!--
77
- DiΓ‘taxis: tutorial. The fewest steps to a working bundle. It shows enough of
78
- VBlocks for the reader to decide whether VBlocks fits their project.
79
- -->
80
-
81
83
  <!--
82
84
  Using "scaffold", the field's word for what `init` does, eg. Yeoman and
83
85
  create-vite use it.
86
+
87
+ Using the `my-vblocks-` prefix, the package name, so a reader who tries several
88
+ scaffolders spots the folder at a glance, as with `vite-project` and
89
+ `nuxt-app`.
84
90
  -->
85
91
 
86
92
  1. **Scaffold a minimal React project**
@@ -143,10 +149,7 @@ Several apps, eg. demos or MVP sketches, can share one `package.json` and one
143
149
  ```diff
144
150
  sketches/
145
151
  + β”œβ”€ flow-diagram/
146
- + β”‚ β”œβ”€ src/
147
- + β”‚ β”‚ β”œβ”€ index.tsx
148
- + β”‚ β”‚ β”œβ”€ index.html
149
- + β”‚ β”‚ └─ index.css
152
+ + β”‚ β”œβ”€ src/ # the files of the xyflow template
150
153
  + β”‚ β”œβ”€ postcss.config.js
151
154
  + β”‚ └─ tsconfig.json
152
155
  β”œβ”€ .gitignore
@@ -162,24 +165,22 @@ Several apps, eg. demos or MVP sketches, can share one `package.json` and one
162
165
  ## Vocabulary
163
166
 
164
167
  <!--
165
- Vocabulary follows Quick Start. The reader sees the terms used, then reads
166
- their definitions. How to is the first section that assumes the reader knows
167
- them.
168
+ Keep Vocabulary after Quick Start since the reader has no context to place
169
+ the definitions in.
168
170
  -->
169
171
 
170
172
  | Term | Means |
171
173
  | :----------------- | :------------------------------------------------------------ |
174
+ | **Plumbing** | The project files `init` writes: `package.json`, `.gitignore` |
172
175
  | **Project folder** | The folder with `package.json` |
173
176
  | **App folder** | The folder with `src/index.tsx` and `src/index.html` |
174
- | **Plumbing** | The project files `init` writes: `package.json`, `.gitignore` |
175
177
  | **Bundle** | The files `build` writes to `dist/` |
176
178
 
177
179
  ## How to
178
180
 
179
181
  <!--
180
- DiΓ‘taxis: how-to. Each ### names a pain as the task that relieves it. Order
181
- the guides by how early the Quick Start reader has the pain. A guide for
182
- another reader, eg. one with an existing app, goes last.
182
+ Each ### names a pain as the task that relieves it. Order the guides by how
183
+ early the Quick Start reader has the pain.
183
184
  -->
184
185
 
185
186
  ### Use environment variables
@@ -197,8 +198,8 @@ another reader, eg. one with an existing app, goes last.
197
198
  ```
198
199
 
199
200
  Webpack replaces each `process.env["NAME"]` with the value of `NAME`, and
200
- `undefined` when `.env` does not set it. The bundle leaves out every variable
201
- your code does not read.
201
+ `undefined` when `.env` does not set it. Webpack leaves out of the bundle every
202
+ variable your code does not read.
202
203
 
203
204
  > [!WARNING]
204
205
  > Never expose a secret, eg. an API key, through `process.env`. Anyone who loads
@@ -218,16 +219,17 @@ import { Component } from "@self/components"
218
219
  ```
219
220
 
220
221
  > [!NOTE]
221
- > VBlocks never reads your `tsconfig.json`, so `tsc` needs the alias too. The
222
- > `tsconfig.json` that [`vblocks init`](#vblocks-init) writes already has it.
223
- > Otherwise, add:
222
+ > VBlocks compiles TypeScript with SWC and does not typecheck. Run `tsc`
223
+ > yourself. Your `tsconfig.json` needs the same alias as Webpack.
224
+ > The `tsconfig.json` that [`vblocks init`](#vblocks-init) writes already has
225
+ > it. Otherwise, add:
224
226
  >
225
- > ```json
226
- > {
227
- > "compilerOptions": {
228
- > "paths": { "@self/*": ["./src/*"] }
229
- > }
230
- > }
227
+ > ```diff
228
+ > {
229
+ > "compilerOptions": {
230
+ > + "paths": { "@self/*": ["./src/*"] }
231
+ > }
232
+ > }
231
233
  > ```
232
234
 
233
235
  ### Use CSS Modules
@@ -255,21 +257,26 @@ import { Component } from "@self/components"
255
257
  `development` mode
256
258
 
257
259
  > [!NOTE]
258
- > The [client types](src/types/client.d.ts) declare `.css` imports and other
259
- > common client specific extensions like `.png`, `.ttf` etc.
260
+ > The [client types](src/types/client.d.ts) declare `.css`, image and font
261
+ > imports
260
262
 
261
263
  ### Replace a default config
262
264
 
263
- Each of these configs in your app folder replaces the default of the same name:
265
+ Each config in your app folder replaces the default of the same name:
264
266
 
265
267
  - `webpack.config.js`
266
268
  - `postcss.config.js`
269
+ - `postcss-preset-env`, which compiles nesting, `oklch()` and `color-mix()`
270
+ for older browsers and adds vendor prefixes
271
+ - `cssnano` in `production`
267
272
  - `.swcrc`
273
+ - browser targets `> 0.25%, not dead`
268
274
 
269
275
  1. **[Eject](#vblocks-eject) the default into your app folder**
270
276
 
271
277
  ```sh
272
- npx vblocks eject swc > flow-diagram/.swcrc
278
+ cd flow-diagram
279
+ npx vblocks eject swc > .swcrc
273
280
  ```
274
281
 
275
282
  2. **Update the ejected file**
@@ -292,7 +299,8 @@ VBlocks does not include Tailwind. Add it through a `postcss.config.js` in your
292
299
  app folder:
293
300
 
294
301
  > [!NOTE]
295
- > The `xyflow` template of [`vblocks init`](#vblocks-init) has this setup.
302
+ > The `xyflow` and `xyflow-tabs` templates of [`vblocks init`](#vblocks-init)
303
+ > have this setup.
296
304
 
297
305
  1. **Install Tailwind and the Tailwind plugin for PostCSS**
298
306
 
@@ -352,144 +360,131 @@ app folder:
352
360
  npm install --save-dev @asd14/vblocks # needs react and react-dom ^18 or ^19
353
361
  ```
354
362
 
355
- 2. **Ensure `index.tsx` and `index.html` are in `src/`**
363
+ 2. **Add the [client types](src/types/client.d.ts) and the
364
+ [`@self`](#stop-using--everywhere) alias to your `tsconfig.json`**
365
+
366
+ ```diff
367
+ {
368
+ "compilerOptions": {
369
+ + "types": ["@asd14/vblocks/client"],
370
+ + "paths": { "@self/*": ["./src/*"] }
371
+ }
372
+ }
373
+ ```
374
+
375
+ 3. **Ensure `index.tsx` and `index.html` are in `src/`**
356
376
 
357
377
  > [!NOTE]
358
378
  > VBlocks builds `dist/index.html` from `src/index.html` and adds the script and
359
379
  > stylesheet tags to it. Drop the tag that loads your entry, eg. Vite's
360
380
  > `<script type="module" src="/src/main.tsx"></script>`.
361
381
 
362
- 3. **Start a development server**
382
+ 4. **Start a development server**
363
383
 
364
384
  ```sh
365
385
  npx vblocks serve
366
386
  ```
367
387
 
368
- ## Commands
388
+ ## References
369
389
 
370
- <!--
371
- DiΓ‘taxis: reference. Mirror SYNOPSIS and OPTIONS of `vblocks --help`, in the
372
- same words. Each option and operand is a term, a line break, then its
373
- description, like OPTIONS in a man page.
374
- -->
390
+ ### Commands
375
391
 
376
- ### `vblocks init`
392
+ #### `vblocks init`
377
393
 
378
394
  Write a template's plumbing, app, or both into `<directory>`.
379
395
 
380
396
  ```text
381
- vblocks init <directory> [--template <name>] [--only <app|plumbing>]
397
+ vblocks init <directory>
398
+ [--template <plain|xyflow|xyflow-tabs>]
399
+ [--only <app|plumbing>]
382
400
  ```
383
401
 
384
- - `<directory>`\
385
- The folder to write into. It must be missing or empty
386
- - `--template <name>`\
387
- `plain`, or `xyflow` with React Flow and Tailwind (default: `plain`)
388
- - `--only <app|plumbing>`\
389
- Write one part of the template (default: both)
402
+ - `<directory>`
403
+ - The folder to write into. It must be missing or empty
404
+ - `--template` (default: `plain`)
405
+ - The template to write, see [Templates](#templates)
406
+ - `--only` (default: both)
407
+ - Write one part of the template
390
408
  - `plumbing`: `package.json`, `.gitignore`
391
409
  - `app`: `src/`, `tsconfig.json` and the template's configs. `init` adds the
392
410
  template's dependencies to the `package.json` of the
393
411
  [project folder](#vocabulary), the nearest folder above `<directory>` with a
394
412
  `package.json`. Without that folder, `init` fails
395
413
 
396
- **Example**:
397
-
398
- <!--
399
- Using the `my-vblocks-` prefix, the package name, so a reader who tries several
400
- scaffolders spots the folder at a glance, as with `vite-project` and
401
- `nuxt-app`.
402
- -->
403
-
404
- ```sh
405
- npx @asd14/vblocks init my-vblocks-flow --template xyflow
406
- cd my-vblocks-flow
407
- npm install
408
- ```
409
-
410
- ### `vblocks serve`
414
+ #### `vblocks serve`
411
415
 
412
416
  Start the development server.
413
417
 
414
418
  - Runs at `http://localhost:8080`, or the next free port
415
- - Listens on this machine only. Pass `--host 0.0.0.0` to listen on the network
419
+ - Listens on `localhost`, so another device on your network, eg. a phone, cannot
420
+ open the page
416
421
  - Opens the page in the browser
417
422
 
418
423
  ```text
419
- vblocks serve [--mode <mode>] [--prefix <directory>] [--analyze] [--log-level <level>] [<webpack option>...]
424
+ vblocks serve
425
+ [--mode <development|production>]
426
+ [--prefix <directory>]
427
+ [--analyze]
428
+ [--log-level <error|warn|info|verbose>]
429
+ [<webpack option>...]
420
430
  ```
421
431
 
422
- - `--mode <mode>`\
423
- The Webpack mode, `development` or `production` (default: `development`).
424
- React Refresh runs only in `development`
425
- - `--prefix <directory>`\
426
- The [app folder](#vocabulary), which must exist (default: the current folder)
427
- - `--analyze`\
428
- Run the bundle analyzer, on a free port
429
- - `--log-level <level>`\
430
- How much Webpack, its development server and npm print: `error`, `warn`,
431
- `info` or `verbose` (default: `warn`)
432
- - `<webpack option>`\
433
- Any other [`webpack serve`](https://webpack.js.org/api/cli/) option. VBlocks
434
- passes it to Webpack unchanged
435
-
436
- **Example**:
432
+ - `--mode` (default: `development`)
433
+ - The Webpack mode
434
+ - React Refresh runs only in `development`
435
+ - `--prefix` (default: the current folder)
436
+ - The [app folder](#vocabulary), which must exist
437
+ - `--analyze`
438
+ - Run the bundle analyzer, on a free port
439
+ - `--log-level` (default: `warn`)
440
+ - How much Webpack, its development server and npm print
441
+ - `<webpack option>...`
442
+ - Any other [`webpack serve`](https://webpack.js.org/api/cli/) option, passed
443
+ unchanged, eg. `--host 0.0.0.0` to listen on the network
437
444
 
438
- ```sh
439
- cd my-vblocks-flow
440
- npx vblocks serve
441
- # ↓↓↓
442
- # npx webpack serve --config <webpack config> \
443
- # --env entryDir=<app folder> \
444
- # --mode development \
445
- # ...
446
- ```
445
+ #### `vblocks build`
447
446
 
448
- ### `vblocks build`
447
+ Build the app into a bundle in the `dist/` of the app folder.
449
448
 
450
- Build the app into a bundle in the `dist/` of the app folder. Without
451
- `--single-file`, `build`:
449
+ By default, `build`:
452
450
 
453
451
  - Writes JS and CSS files with content-hashed names
454
452
  - Writes a `react` chunk, and a `vendors` chunk when your other dependencies
455
453
  total over 20 KB (10 KB in `development`)
454
+ - Inlines `jpg`, `gif`, `png` and `svg` files up to 10 KB
455
+ - Writes larger to `dist/` with content-hashed names
456
+ - Writes `woff`, `woff2`, `ttf` and `eot` files to `dist/fonts/`
457
+ - Copies `src/public/favicon.svg` and `src/public/robots.txt` of your app, or
458
+ the defaults of VBlocks
456
459
 
457
460
  ```text
458
- vblocks build [--mode <mode>] [--prefix <directory>] [--single-file] [--log-level <level>] [<webpack option>...]
461
+ vblocks build
462
+ [--mode <development|production>]
463
+ [--prefix <directory>]
464
+ [--single-file]
465
+ [--log-level <error|warn|info|verbose>]
466
+ [<webpack option>...]
459
467
  ```
460
468
 
461
- - `--mode <mode>`\
462
- The Webpack mode, `development` or `production` (default: `production`). In
463
- `production`, `build` minifies JS and HTML, and the default PostCSS config
464
- runs cssnano, which minifies CSS
465
- - `--prefix <directory>`\
466
- The [app folder](#vocabulary), which must exist (default: the current folder)
467
- - `--single-file`\
468
- `build` writes one standalone `dist/index.html`, every asset inlined
469
+ - `--mode` (default: `production`)
470
+ - The Webpack mode
471
+ - In `production`, `build` minifies JS, HTML and, with the default PostCSS
472
+ config, CSS
473
+ - `--prefix` (default: the current folder)
474
+ - The [app folder](#vocabulary), which must exist
475
+ - `--single-file`
476
+ - Write one standalone `dist/index.html`, every asset inlined
469
477
  - A browser opens the file from disk, with no server and no network
470
478
  - The bundle has no `robots.txt`
471
- - Keep the route in the URL hash. On `file://`, `history.pushState` to another
472
- path throws
473
- - `--log-level <level>`\
474
- How much Webpack and npm print: `error`, `warn`, `info` or `verbose` (default:
475
- `warn`)
476
- - `<webpack option>`\
477
- Any other [`webpack build`](https://webpack.js.org/api/cli/) option, eg.
478
- `--stats errors-only`. VBlocks passes it to Webpack unchanged
479
-
480
- **Example**:
481
-
482
- ```sh
483
- cd my-vblocks-flow
484
- npx vblocks build
485
- # ↓↓↓
486
- # npx webpack build --config <webpack config> \
487
- # --env entryDir=<app folder> \
488
- # --mode production \
489
- # ...
490
- ```
479
+ - Keep the route in the URL hash
480
+ - On `file://`, `history.pushState` to another path throws
481
+ - `--log-level` (default: `warn`)
482
+ - How much Webpack and npm print
483
+ - `<webpack option>...`
484
+ - Any other [`webpack build`](https://webpack.js.org/api/cli/) option, passed
485
+ unchanged, eg. `--stats errors-only`
491
486
 
492
- ### `vblocks eject`
487
+ #### `vblocks eject`
493
488
 
494
489
  Print a default config to stdout.
495
490
 
@@ -497,10 +492,10 @@ Print a default config to stdout.
497
492
  vblocks eject <webpack|postcss|swc>
498
493
  ```
499
494
 
500
- - `<webpack|postcss|swc>`\
501
- The config to print
495
+ - `<webpack|postcss|swc>`
496
+ - The config to print
502
497
 
503
- Save the output in your app folder to
498
+ Run it in your app folder and save the output there, to
504
499
  [replace the default](#replace-a-default-config):
505
500
 
506
501
  ```sh
@@ -509,76 +504,54 @@ npx vblocks eject postcss > postcss.config.js
509
504
  npx vblocks eject swc > .swcrc
510
505
  ```
511
506
 
512
- <!--
513
- PARKED: sort each fact below into an existing section or a new one, or drop
514
- it. The client types and the PostCSS default have no home yet.
515
-
516
- ## Details
507
+ ### Templates
517
508
 
518
- ### TypeScript
509
+ Every app gets `src/index.html`, `src/index.css` and `tsconfig.json`. Each
510
+ template adds its own files, and sets the `<title>` of `src/index.html`. A
511
+ template's file replaces the common one of the same path, eg. `xyflow` has its
512
+ own `src/index.css`.
519
513
 
520
- VBlocks does not check types and never reads your `tsconfig.json`. It only
521
- compiles TypeScript with SWC.
514
+ #### `plain`
522
515
 
523
- For convenience, VBlocks provides client types in
524
- [`client.d.ts`](src/types/client.d.ts) for:
525
-
526
- - `.css` imports
527
- - Image and font imports
528
- - `process.env`
529
-
530
- You can use them in your `tsconfig.json`:
531
-
532
- ```json
533
- {
534
- "compilerOptions": {
535
- "types": ["@asd14/vblocks/client"]
536
- }
537
- }
538
- ```
516
+ `src/index.tsx` renders a heading. Adds no packages.
539
517
 
540
- > [!NOTE]
541
- > The `tsconfig.json` that [`vblocks init`](#vblocks-init) writes has the client
542
- > types and the [`@self`](#stop-using--everywhere) alias.
518
+ #### `xyflow`
543
519
 
544
- ### PostCSS
520
+ One diagram, and a details panel for the selected node or edge. Adds
521
+ `@xyflow/react`, `tailwindcss` and `@tailwindcss/postcss` to the `package.json`
522
+ of the project folder. Writes a `postcss.config.js` that runs Tailwind into the
523
+ app folder.
545
524
 
546
- The default `postcss.config.js`:
547
-
548
- ```js
549
- /**
550
- * @param {{ mode: "production" | "development" | "none" }} api
551
- */
552
- export default ({ mode }) => ({
553
- plugins: {
554
- "postcss-preset-env": {
555
- stage: 2,
556
- },
557
- "cssnano": mode === "production" && {
558
- preset: "default",
559
- },
560
- },
561
- })
562
- ```
525
+ ```text
526
+ src/
527
+ β”œβ”€β”€ index.tsx # the layout: header, diagram, details panel, the selected id
528
+ β”œβ”€β”€ diagram.tsx # the nodes and edges, placed and sized in grid cells
529
+ β”œβ”€β”€ details.tsx # the panel for the selected node or edge
530
+ β”œβ”€β”€ ui/zoom-level.tsx # the zoom level, and a Reset to 100%
531
+ └── utils/grid.ts # CELL_SIZE and toPixels
532
+ ```
563
533
 
564
- > [!NOTE]
565
- > `postcss-preset-env` compiles nesting, `oklch()` and `color-mix()` for older
566
- > browsers and adds vendor prefixes.
534
+ To show another topic, rewrite `diagram.tsx` and `details.tsx`.
567
535
 
568
- ### Asset Handling
536
+ #### `xyflow-tabs`
569
537
 
570
- - **Images** - the build inlines `jpg`, `gif`, `png` and `svg` files up to 10 KB
571
- - **Fonts** - the build writes `woff`, `woff2`, `ttf` and `eot` files to
572
- `dist/fonts/`
573
- - **Favicon and `robots.txt`** - yours or the default. With `--single-file`, the
574
- build inlines the favicon and leaves `robots.txt` out
538
+ One tab per diagram, each with its own details panel. Adds the same packages and
539
+ `postcss.config.js` as `xyflow`.
575
540
 
576
- ## How It Works
541
+ ```text
542
+ src/
543
+ β”œβ”€β”€ index.tsx # the layout: header, tab bar, details panel, the selected id
544
+ β”œβ”€β”€ pages/
545
+ β”‚ β”œβ”€β”€ build/
546
+ β”‚ β”‚ β”œβ”€β”€ diagram.tsx # the nodes and edges of one tab, in grid cells
547
+ β”‚ β”‚ └── details.tsx # the panel for its selected node or edge
548
+ β”‚ └── serve/ # the same two files
549
+ β”œβ”€β”€ ui/zoom-level.tsx # the zoom level, and a Reset to 100%
550
+ └── utils/grid.ts # CELL_SIZE and toPixels
551
+ ```
577
552
 
578
- VBlocks is a POSIX shell script that runs Webpack. The script exports
579
- `VB_POSTCSS_CONFIG` and `VB_SWC_CONFIG`, the paths of the configs it picked. The
580
- Webpack config reads them.
581
- -->
553
+ To add a tab, add a folder in `pages/` and add it to the tab list in
554
+ `index.tsx`.
582
555
 
583
556
  ## License
584
557
 
package/bin/vblocks.sh CHANGED
@@ -6,11 +6,21 @@ set -eu
6
6
  # vblocks - Run Webpack with the configs of VBlocks, write a project or an app
7
7
  #
8
8
  # SYNOPSIS
9
- # vblocks init <directory> [--template <name>] [--only <app|plumbing>]
10
- # vblocks serve [--mode <mode>] [--prefix <directory>] [--analyze]
11
- # [--log-level <level>] [<webpack option>...]
12
- # vblocks build [--mode <mode>] [--prefix <directory>] [--single-file]
13
- # [--log-level <level>] [<webpack option>...]
9
+ # vblocks init <directory>
10
+ # [--template <plain|xyflow|xyflow-tabs>]
11
+ # [--only <app|plumbing>]
12
+ # vblocks serve
13
+ # [--mode <development|production>]
14
+ # [--prefix <directory>]
15
+ # [--analyze]
16
+ # [--log-level <error|warn|info|verbose>]
17
+ # [<webpack option>...]
18
+ # vblocks build
19
+ # [--mode <development|production>]
20
+ # [--prefix <directory>]
21
+ # [--single-file]
22
+ # [--log-level <error|warn|info|verbose>]
23
+ # [<webpack option>...]
14
24
  # vblocks eject <webpack|postcss|swc>
15
25
  # vblocks -h | --help
16
26
  #
@@ -33,7 +43,7 @@ set -eu
33
43
  # serve and build pass every option not listed under OPTIONS to Webpack.
34
44
  #
35
45
  # OPTIONS
36
- # --template <name> init: plain or xyflow (default: plain)
46
+ # --template <name> init: plain, xyflow or xyflow-tabs (default: plain)
37
47
  # --only <app|plumbing> init: write only the app or only the plumbing.
38
48
  # init adds the app's dependencies to the
39
49
  # project folder: the nearest folder above
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@asd14/vblocks",
4
- "version": "5.2.0",
4
+ "version": "5.4.0",
5
5
  "description": "Zero-config React builds, as a static site or a single HTML file",
6
6
  "keywords": [
7
7
  "react",
@@ -64,22 +64,22 @@
64
64
  "browserslist": "^4.29.3",
65
65
  "copy-webpack-plugin": "^14.0.0",
66
66
  "css-loader": "^7.1.5",
67
- "cssnano": "^9.6.0",
67
+ "cssnano": "^9.9.0",
68
68
  "dotenv-webpack": "^9.0.0",
69
69
  "html-webpack-plugin": "^5.6.8",
70
70
  "mini-css-extract-plugin": "^2.10.2",
71
- "postcss": "^8.5.29",
71
+ "postcss": "^8.5.30",
72
72
  "postcss-loader": "^8.2.1",
73
73
  "postcss-preset-env": "^11.6.1",
74
74
  "react-refresh": "^0.19.0",
75
75
  "swc-loader": "^0.2.7",
76
- "webpack": "^5.111.1",
76
+ "webpack": "^5.112.0",
77
77
  "webpack-bundle-analyzer": "^5.4.0",
78
78
  "webpack-cli": "^7.2.3",
79
79
  "webpack-dev-server": "^6.0.0"
80
80
  },
81
81
  "devDependencies": {
82
- "@asd14/eslint-config": "^15.4.0",
82
+ "@asd14/eslint-config": "^16.0.0",
83
83
  "@asd14/prettier-config": "^1.5.0",
84
84
  "@asd14/semantic-release-config": "^1.0.1",
85
85
  "@asd14/ts-config": "^1.6.0",
@@ -10,6 +10,8 @@ import MiniCssExtractPlugin from "mini-css-extract-plugin"
10
10
  import webpack from "webpack"
11
11
  import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer"
12
12
 
13
+ // `bin/vblocks.sh` sets them to the PostCSS and SWC configs it picked, the
14
+ // app's own or the default
13
15
  const VB_SWC_CONFIG = process.env["VB_SWC_CONFIG"]
14
16
  const VB_POSTCSS_CONFIG = process.env["VB_POSTCSS_CONFIG"]
15
17
 
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+
3
+ # Runs in the app folder, after `vblocks init` copies the app files
4
+
5
+ set -eu
6
+
7
+ # Name the page in the browser tab.
8
+ # `sed -i` differs between GNU and BSD, so write a copy and move it over
9
+ sed 's|<title>.*</title>|<title>Hello World :: VBlocks</title>|' src/index.html >src/index.html.tmp
10
+ mv -- src/index.html.tmp src/index.html