@asd14/vblocks 2.0.0 → 2.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
@@ -5,19 +5,17 @@
5
5
 
6
6
  > 📜 POSIX + 📦 Webpack, an unlikely story!
7
7
 
8
- ## Features
8
+ - **Minimal configs** - Needs only `src/index.tsx` and `src/index.html`
9
+ - **Built in** - SWC, PostCSS (CSS Modules configured), MDX, React Refresh,
10
+ Dotenv, bundle analyzer
9
11
 
10
- - **No configs** - All you need are `src/index.tsx` and `src/index.html`
11
- - **Built in** - SWC for TypeScript, PostCSS, CSS Modules, MDX, React Refresh,
12
- bundle analyzer
12
+ ## Table of contents
13
13
 
14
14
  <!-- vim-markdown-toc GFM -->
15
15
 
16
16
  - [Installation](#installation)
17
17
  - [Peer Dependencies](#peer-dependencies)
18
- - [Usage](#usage)
19
- - [Quick Start](#quick-start)
20
- - [Project Structure](#project-structure)
18
+ - [Quick Start](#quick-start)
21
19
  - [Configuration](#configuration)
22
20
  - [Commands](#commands)
23
21
  - [`vblocks init`](#vblocks-init)
@@ -56,19 +54,28 @@ npm install react react-dom
56
54
  > [!IMPORTANT]
57
55
  > VBlocks needs React `^18` or `^19`.
58
56
 
59
- ## Usage
60
-
61
- ### Quick Start
57
+ ## Quick Start
62
58
 
63
59
  Create a project and start the dev server:
64
60
 
65
61
  ```sh
66
- npx @asd14/vblocks init my-app
67
- cd my-app
62
+ npx @asd14/vblocks init my-vblocks-app
63
+ cd my-vblocks-app
68
64
  npm install
69
65
  npm start
70
66
  ```
71
67
 
68
+ ```text
69
+ my-vblocks-app/
70
+ ├── src/
71
+ │ ├── index.tsx # Application entry point
72
+ │ ├── index.html # HTML template
73
+ │ └── index.css # Global CSS
74
+ ├── .gitignore # Minimal set
75
+ ├── tsconfig.json # TypeScript config for React
76
+ └── package.json # Scripts and dependencies (react, react-dom)
77
+ ```
78
+
72
79
  Run a command in a project that has VBlocks installed:
73
80
 
74
81
  ```sh
@@ -78,23 +85,8 @@ npx vblocks serve
78
85
  # Build for production
79
86
  npx vblocks build
80
87
 
81
- # Print the default Webpack config
82
- npx vblocks eject webpack
83
- ```
84
-
85
- ### Project Structure
86
-
87
- ```text
88
- your-project/
89
- ├── src/
90
- │ ├── index.tsx # Application entry point
91
- │ ├── index.html # HTML template
92
- │ ├── index.css # Global CSS (optional)
93
- │ └── public/
94
- │ ├── favicon.svg # Favicon (optional)
95
- │ └── robots.txt # Crawler instructions (optional)
96
- ├── .env # Environment variables (optional)
97
- └── dist/ # Build output
88
+ # Save the default Webpack config in your project root
89
+ npx vblocks eject webpack > webpack.config.js
98
90
  ```
99
91
 
100
92
  ## Configuration
@@ -115,7 +107,7 @@ npx vblocks eject postcss > postcss.config.js
115
107
  > [!NOTE]
116
108
  > VBlocks does not merge your config with the default, with two exceptions:
117
109
  >
118
- > - `.swcrc -> env.targets`: VBlocks adds the default when yours has none
110
+ > - `.swcrc -> env.targets`: VBlocks adds the default when yours is missing
119
111
  > - `.swcrc -> jsc.transform.react.refresh`: VBlocks adds the React Refresh
120
112
  > transform when `serve` runs in `development` mode
121
113
 
@@ -123,75 +115,40 @@ npx vblocks eject postcss > postcss.config.js
123
115
 
124
116
  ### `vblocks init`
125
117
 
126
- ```text
127
- vblocks init <directory> [--template <name>]
128
- ```
129
-
130
118
  Creates a project in `<directory>` from a template.
131
119
 
132
- | Parameter | Required | Default | Description |
133
- | ------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------ |
134
- | `<directory>` | yes | none | The project root. `init` creates it when it is missing and fails when it exists and is not empty |
135
- | `--template <name>` | no | `plain` | The template to copy: `plain` or `xyflow-playground` |
136
-
137
- | Template | `src/index.tsx` | `dependencies` | Tailwind |
138
- | ------------------- | ------------------------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
139
- | `plain` | Hello World! | `react`, `react-dom` | no |
140
- | `xyflow-playground` | Renders a graph of nodes you can drag and connect | `react`, `react-dom`, [`@xyflow/react`](https://reactflow.dev) | yes, `package.json`, `postcss.config.js` and `src/index.css` hold [the setup](#does-vblocks-support-tailwind) |
141
-
142
- `init` writes:
143
-
144
120
  ```text
145
- <directory>/
146
- ├── src/
147
- │ ├── index.tsx # Application entry point
148
- │ ├── index.html # HTML template
149
- │ └── index.css # Global CSS
150
- ├── .gitignore # node_modules, dist, .env
151
- ├── package.json
152
- ├── postcss.config.js # Only in xyflow-playground
153
- └── tsconfig.json
121
+ vblocks init <directory> [--template <plain|xyflow>]
154
122
  ```
155
123
 
156
- Run `init` through `npx @asd14/vblocks`. `init` installs no dependencies, so
157
- install them next:
124
+ **Example**:
158
125
 
159
126
  ```sh
160
- npx @asd14/vblocks init my-flow --template xyflow-playground
161
- cd my-flow
127
+ npx @asd14/vblocks init my-vblock-flow --template xyflow
128
+ cd my-vblock-flow
162
129
  npm install
163
130
  ```
164
131
 
165
132
  ### `vblocks serve`
166
133
 
167
- ```text
168
- vblocks serve [--mode <mode>] [<webpack option>...]
169
- ```
170
-
171
- Starts the dev server. Without `--port`, it listens on `http://localhost:8080`.
134
+ Starts a React Refresh enabled development server.
172
135
 
173
- | Parameter | Required | Default | Description |
174
- | ------------------ | -------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
175
- | `--mode <mode>` | no | `development` | The Webpack mode, `development` or `production`. React Refresh runs only in `development` |
176
- | `<webpack option>` | no | none | Any other [`webpack serve`](https://webpack.js.org/configuration/dev-server/) option, eg. `--port 3000` or `--no-open`. VBlocks passes it to Webpack unchanged |
136
+ - Runs at `http://localhost:8080`, auto-opens in browser
137
+ - Runs bundle analyzer at `http://127.0.0.1:8888`
177
138
 
178
- The dev server:
179
-
180
- - Replaces changed modules without a page reload, with Hot Module Replacement
181
- and React Refresh
182
- - Opens the browser
183
- - Runs the bundle analyzer at `http://127.0.0.1:8888`. VBlocks does not open it
184
- in the browser
185
- - Serves `index.html` for every unknown path, for applications that use the
186
- History API
139
+ ```text
140
+ vblocks serve [--mode <development|production>] [<webpack option>...]
141
+ ```
187
142
 
188
- **Runs**:
143
+ **Example**:
189
144
 
190
145
  ```sh
191
- npx webpack serve --config <webpack config> \
192
- --env entryDir=<project root> \
193
- --mode development \
194
- [...your arguments]
146
+ cd my-vblock-flow
147
+ vblocks serve
148
+ # ↓
149
+ # npx webpack serve --config <webpack config> \
150
+ # --env entryDir=<project root> \
151
+ # --mode development
195
152
  ```
196
153
 
197
154
  ### `vblocks build`
@@ -416,8 +373,7 @@ npx vblocks eject postcss > postcss.config.js
416
373
  @import "tailwindcss";
417
374
  ```
418
375
 
419
- The `xyflow-playground` template of [`vblocks init`](#vblocks-init) has this
420
- setup.
376
+ The `xyflow` template of [`vblocks init`](#vblocks-init) has this setup.
421
377
 
422
378
  ## License
423
379
 
package/bin/vblocks.sh CHANGED
@@ -15,11 +15,11 @@
15
15
  #
16
16
  # Usage Examples:
17
17
  # ---
18
- # npx vblocks init my-app # Create a project in ./my-app
19
- # npx vblocks init my-flow --template xyflow-playground
20
- # npx vblocks build # Build for production
21
- # npx vblocks serve # Start dev server
22
- # npx vblocks eject webpack > webpack.config.js # Customize a config
18
+ # npx vblocks init my-app # Create a project in ./my-app
19
+ # npx vblocks init my-flow --template xyflow # Create a project with a specific template
20
+ # npx vblocks build # Build for production
21
+ # npx vblocks serve # Start dev server
22
+ # npx vblocks eject webpack > webpack.config.js # Customize a config
23
23
  # =============================================================================
24
24
 
25
25
  # Directory where this script is located and
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": "2.0.0",
4
+ "version": "2.1.0",
5
5
  "description": "󱆃 POSIX +  Webpack, an unlikely story!",
6
6
  "license": "MIT",
7
7
  "sideEffects": false,