@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/.sh41/skills/use-vblocks/SKILL.md +118 -0
- package/README.md +184 -304
- package/bin/vblocks +3 -2
- package/bin/vblocks.d/build +51 -12
- package/bin/vblocks.d/eject +17 -7
- package/bin/vblocks.d/init +52 -32
- package/bin/vblocks.d/lib/os.sh +188 -0
- package/bin/vblocks.d/lib/terminal.sh +57 -0
- package/bin/vblocks.d/serve +35 -12
- package/bin/vblocks.d/vblocks.sh +13 -2
- package/bin/vblocks.d/webpack.sh +110 -11
- package/defaults/.browserslistrc +2 -0
- package/defaults/.swcrc +1 -2
- package/defaults/webpack.config.js +65 -29
- package/docs/DECISIONS.md +4 -0
- package/docs/REFERENCE.md +321 -0
- package/docs/decisions/01.resolve-dependency-vblocks-folder.md +43 -0
- package/docs/decisions/02.read-browserslist-config.md +36 -0
- package/package.json +12 -10
- package/template/_common/README.md +49 -0
- package/template/_common/app/.env.example +1 -1
- package/template/plain/README.md +19 -0
- package/template/xyflow/README.md +28 -0
- package/template/xyflow-tabs/README.md +33 -0
- package/types/client.d.ts +21 -5
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: use-vblocks
|
|
3
|
+
description: |
|
|
4
|
+
Writes, serves and builds a React app with @asd14/vblocks. Use when the User
|
|
5
|
+
wants to create a React app or build a React page into one HTML file, or when
|
|
6
|
+
the project's package.json has @asd14/vblocks.
|
|
7
|
+
metadata:
|
|
8
|
+
version: "0.1.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
VBlocks is a zero-config React bundler, like Create React App or Parcel. It
|
|
12
|
+
builds and serves an SPA (single-page application), as a folder or a single HTML
|
|
13
|
+
file. It has no SSR (server-side rendering) or SSG (static site generation), as
|
|
14
|
+
Next.js does.
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
<!-- sh41: copied from the features at the top of README.md. Update both
|
|
19
|
+
together -->
|
|
20
|
+
|
|
21
|
+
- An app needs only `src/index.tsx` and `src/index.html`
|
|
22
|
+
- VBlocks supports SWC, PostCSS, CSS Modules, MDX, React Refresh and `.env`
|
|
23
|
+
files
|
|
24
|
+
- Several apps can share one `package.json` and `node_modules/`
|
|
25
|
+
- In development, the Agentation toolbar sends UI annotations to an agent
|
|
26
|
+
|
|
27
|
+
## TL;DR
|
|
28
|
+
|
|
29
|
+
- Scaffold an app, from the template `plain`, `xyflow` or `xyflow-tabs`:\
|
|
30
|
+
`npx @asd14/vblocks init {{path/to/app}} --template {{plain}}`
|
|
31
|
+
- Add VBlocks to an existing project, with `react` and `react-dom` 18 or 19:\
|
|
32
|
+
`npm install --save-dev @asd14/vblocks`
|
|
33
|
+
- Start the development server, at `http://localhost:8080` or the next free
|
|
34
|
+
port. It opens the browser:\
|
|
35
|
+
`npx vblocks serve`
|
|
36
|
+
- Start it on a port, without the browser. Webpack takes each option after
|
|
37
|
+
`--`:\
|
|
38
|
+
`npx vblocks serve -- --port {{8099}} --no-open`
|
|
39
|
+
- Start the server of one app, in a project folder that contains several:\
|
|
40
|
+
`npx vblocks serve --prefix {{path/to/app}}`
|
|
41
|
+
- Build the production bundle into `dist/`:\
|
|
42
|
+
`npx vblocks build`
|
|
43
|
+
- Build one standalone `dist/index.html`, every asset inlined:\
|
|
44
|
+
`npx vblocks build --single-file`
|
|
45
|
+
- Typecheck. SWC strips the types without checking them:\
|
|
46
|
+
`npx tsc`
|
|
47
|
+
- Import from the app's `src/` through `@self`, a path alias, not a package:\
|
|
48
|
+
`import { {{Button}} } from "@self/{{components/button.tsx}}"`
|
|
49
|
+
- Read a variable of the `.env` in the app folder:\
|
|
50
|
+
`process.env["{{NAME}}"]`
|
|
51
|
+
- Import a file as text:\
|
|
52
|
+
`import {{text}} from "{{./note.txt}}?raw"`
|
|
53
|
+
- Import a Markdown or MDX file as a component:\
|
|
54
|
+
`import {{Intro}} from "{{./intro.mdx}}"`
|
|
55
|
+
|
|
56
|
+
## Conventions
|
|
57
|
+
|
|
58
|
+
- Write no Webpack, PostCSS or SWC config. The defaults cover a React app
|
|
59
|
+
- For an advanced use, eg. a micro-frontend, eject the default with
|
|
60
|
+
`vblocks eject` and edit the copy
|
|
61
|
+
- Put each concern that `src/index.tsx` imports in its own
|
|
62
|
+
`src/index.<concern>.tsx`, eg. `index.app.tsx` defines `App`
|
|
63
|
+
|
|
64
|
+
## Index
|
|
65
|
+
|
|
66
|
+
<!-- sh41: tools/get-skill-index-lines --write recomputes the lines and the
|
|
67
|
+
counts after each edit of the docs -->
|
|
68
|
+
|
|
69
|
+
Paths are relative to the package root: the VBlocks repo, or
|
|
70
|
+
`node_modules/@asd14/vblocks/` in the project folder.
|
|
71
|
+
|
|
72
|
+
**`README.md`**, 492 lines:
|
|
73
|
+
|
|
74
|
+
- "## Quick Start" L:68-116
|
|
75
|
+
- "### Keep several apps in one project" L:120-163
|
|
76
|
+
- "### Use `.env` variables" L:165-189
|
|
77
|
+
- "### Import from `src/` with `@self`" L:191-212
|
|
78
|
+
- "### Use CSS Modules" L:214-239
|
|
79
|
+
- "### Import a file as text" L:241-252
|
|
80
|
+
- "### Write a page in Markdown or MDX" L:254-273
|
|
81
|
+
- "### Pick the browsers" L:275-292
|
|
82
|
+
- "### Replace a default config" L:294-324
|
|
83
|
+
- "### Style with Tailwind" L:326-382
|
|
84
|
+
- "### Send UI annotations to an AI agent" L:384-402
|
|
85
|
+
- "### Open the page from another device" L:404-411
|
|
86
|
+
- "### Build a single HTML file" L:413-424
|
|
87
|
+
- "### Add VBlocks to an existing project" L:426-463
|
|
88
|
+
- "## More docs" L:465-472
|
|
89
|
+
- "## Develop" L:474-488
|
|
90
|
+
|
|
91
|
+
**`docs/REFERENCE.md`**, 321 lines:
|
|
92
|
+
|
|
93
|
+
- "## Domain Vocabulary" L:19-27
|
|
94
|
+
- "### `vblocks`" L:31-67
|
|
95
|
+
- "### `vblocks init`" L:69-121
|
|
96
|
+
- "### `vblocks serve`" L:123-181
|
|
97
|
+
- "### `vblocks build`" L:183-256
|
|
98
|
+
- "### `vblocks eject`" L:258-296
|
|
99
|
+
- "## Templates" L:298-313
|
|
100
|
+
- "## Environment variables" L:315-321
|
|
101
|
+
|
|
102
|
+
**`template/`**:
|
|
103
|
+
|
|
104
|
+
- **`_common/README.md`**, 49 lines:
|
|
105
|
+
- "## Plumbing" L:9-25
|
|
106
|
+
- "## App" L:27-49
|
|
107
|
+
- **`plain/README.md`**, 19 lines
|
|
108
|
+
- **`xyflow/README.md`**, 28 lines
|
|
109
|
+
- **`xyflow-tabs/README.md`**, 33 lines
|
|
110
|
+
|
|
111
|
+
**`docs/decisions/`**:
|
|
112
|
+
|
|
113
|
+
- `01.resolve-dependency-vblocks-folder.md`, 43 lines
|
|
114
|
+
- `02.read-browserslist-config.md`, 36 lines
|
|
115
|
+
|
|
116
|
+
**`types/`**:
|
|
117
|
+
|
|
118
|
+
- `client.d.ts`, 137 lines
|