@asd14/vblocks 6.0.0 → 6.2.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 +27 -23
- package/bin/vblocks +14 -63
- package/bin/vblocks.d/build +58 -10
- package/bin/vblocks.d/eject +35 -4
- package/bin/vblocks.d/init +78 -15
- package/bin/vblocks.d/serve +58 -9
- package/bin/vblocks.d/vblocks.sh +5 -2
- package/bin/vblocks.d/webpack.sh +12 -22
- package/defaults/postcss.config.js +14 -0
- package/{src → defaults}/webpack.config.js +33 -20
- package/package.json +18 -13
- package/template/xyflow/app/postcss.config.js +9 -8
- package/template/xyflow/post-init-app.sh +1 -0
- package/template/xyflow-tabs/app/postcss.config.js +9 -8
- package/template/xyflow-tabs/post-init-app.sh +1 -0
- package/{src/types → types}/client.d.ts +1 -1
- package/src/postcss.config.js +0 -13
- /package/{src → defaults}/.swcrc +0 -0
- /package/{src → defaults/src}/public/favicon.svg +0 -0
- /package/{src → defaults/src}/public/robots.txt +0 -0
package/README.md
CHANGED
|
@@ -153,7 +153,7 @@ Several apps, eg. demos or MVP sketches, can share one `package.json` and one
|
|
|
153
153
|
+ │ ├─ postcss.config.js
|
|
154
154
|
+ │ └─ tsconfig.json
|
|
155
155
|
├─ .gitignore
|
|
156
|
-
! └─ package.json # + @xyflow/react, tailwindcss, @tailwindcss/postcss
|
|
156
|
+
! └─ package.json # + @xyflow/react, tailwindcss, @tailwindcss/postcss, cssnano
|
|
157
157
|
```
|
|
158
158
|
|
|
159
159
|
3. **Start a development server for one app**
|
|
@@ -206,8 +206,8 @@ variable your code does not read.
|
|
|
206
206
|
> the page can read it.
|
|
207
207
|
|
|
208
208
|
> [!NOTE]
|
|
209
|
-
> The [client types](
|
|
210
|
-
>
|
|
209
|
+
> The [client types](types/client.d.ts) declare `process.env` and nothing else
|
|
210
|
+
> from Node, because Webpack replaces nothing else.
|
|
211
211
|
|
|
212
212
|
### Stop using `../../../` everywhere
|
|
213
213
|
|
|
@@ -257,8 +257,7 @@ import { Component } from "@self/components"
|
|
|
257
257
|
`development` mode
|
|
258
258
|
|
|
259
259
|
> [!NOTE]
|
|
260
|
-
> The [client types](
|
|
261
|
-
> imports.
|
|
260
|
+
> The [client types](types/client.d.ts) declare `.css`, image and font imports.
|
|
262
261
|
|
|
263
262
|
### Replace a default config
|
|
264
263
|
|
|
@@ -297,10 +296,11 @@ app folder:
|
|
|
297
296
|
> The `xyflow` and `xyflow-tabs` templates of [`vblocks init`](#vblocks-init)
|
|
298
297
|
> have this setup.
|
|
299
298
|
|
|
300
|
-
1. **Install Tailwind
|
|
299
|
+
1. **Install Tailwind, the Tailwind plugin for PostCSS and cssnano, which the
|
|
300
|
+
ejected config imports**
|
|
301
301
|
|
|
302
302
|
```sh
|
|
303
|
-
npm install --save-dev tailwindcss @tailwindcss/postcss
|
|
303
|
+
npm install --save-dev tailwindcss @tailwindcss/postcss cssnano
|
|
304
304
|
```
|
|
305
305
|
|
|
306
306
|
2. **Eject the default PostCSS config into your app folder**
|
|
@@ -312,18 +312,16 @@ app folder:
|
|
|
312
312
|
3. **Replace `postcss-preset-env` with the Tailwind plugin**
|
|
313
313
|
|
|
314
314
|
```diff
|
|
315
|
+
+import tailwindcss from "@tailwindcss/postcss"
|
|
316
|
+
import cssnano from "cssnano"
|
|
317
|
+
-import postcssPresetEnv from "postcss-preset-env"
|
|
318
|
+
|
|
315
319
|
export default ({ mode }) => ({
|
|
316
|
-
plugins:
|
|
317
|
-
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
+ optimize: mode === "production",
|
|
322
|
-
+ },
|
|
323
|
-
"cssnano": mode === "production" && {
|
|
324
|
-
preset: "default",
|
|
325
|
-
},
|
|
326
|
-
},
|
|
320
|
+
plugins: [
|
|
321
|
+
- postcssPresetEnv({ stage: 2 }),
|
|
322
|
+
+ tailwindcss({ optimize: mode === "production" }),
|
|
323
|
+
...(mode === "production" ? [cssnano({ preset: "default" })] : []),
|
|
324
|
+
],
|
|
327
325
|
})
|
|
328
326
|
```
|
|
329
327
|
|
|
@@ -355,7 +353,7 @@ app folder:
|
|
|
355
353
|
npm install --save-dev @asd14/vblocks # needs react and react-dom ^18 or ^19
|
|
356
354
|
```
|
|
357
355
|
|
|
358
|
-
2. **Add the [client types](
|
|
356
|
+
2. **Add the [client types](types/client.d.ts) and the
|
|
359
357
|
[`@self`](#stop-using--everywhere) alias to your `tsconfig.json`**
|
|
360
358
|
|
|
361
359
|
```diff
|
|
@@ -384,6 +382,8 @@ app folder:
|
|
|
384
382
|
|
|
385
383
|
### Commands
|
|
386
384
|
|
|
385
|
+
Each command prints its own help with `--help`, eg. `npx vblocks serve --help`.
|
|
386
|
+
|
|
387
387
|
#### `vblocks init`
|
|
388
388
|
|
|
389
389
|
Write a template's plumbing, app, or both into `<directory>`.
|
|
@@ -457,7 +457,7 @@ By default, `build`:
|
|
|
457
457
|
vblocks build
|
|
458
458
|
[--mode <development|production>]
|
|
459
459
|
[--prefix <directory>]
|
|
460
|
-
[--single-file]
|
|
460
|
+
[--single-file|--single]
|
|
461
461
|
[--log-level <error|warn|info|verbose>]
|
|
462
462
|
[-- <webpack option>...]
|
|
463
463
|
```
|
|
@@ -468,7 +468,7 @@ vblocks build
|
|
|
468
468
|
config, CSS
|
|
469
469
|
- `--prefix` (default: the current folder)
|
|
470
470
|
- The [app folder](#vocabulary), which must exist
|
|
471
|
-
- `--single-file`
|
|
471
|
+
- `--single-file|--single`
|
|
472
472
|
- Write one standalone `dist/index.html`, every asset inlined
|
|
473
473
|
- A browser opens the file from disk, with no server and no network
|
|
474
474
|
- The bundle has no `robots.txt`
|
|
@@ -501,6 +501,10 @@ npx vblocks eject postcss > postcss.config.js
|
|
|
501
501
|
npx vblocks eject swc > .swcrc
|
|
502
502
|
```
|
|
503
503
|
|
|
504
|
+
An ejected config loads its plugins and loaders from your project. Install them
|
|
505
|
+
in the project folder, eg. `postcss-preset-env` and `cssnano` for the PostCSS
|
|
506
|
+
config.
|
|
507
|
+
|
|
504
508
|
### Templates
|
|
505
509
|
|
|
506
510
|
All templates scaffold `src/index.html`, `src/index.css` and `tsconfig.json`.
|
|
@@ -515,8 +519,8 @@ All templates scaffold `src/index.html`, `src/index.css` and `tsconfig.json`.
|
|
|
515
519
|
|
|
516
520
|
One diagram, and a details panel for the selected node or edge.
|
|
517
521
|
|
|
518
|
-
- Adds `@xyflow/react`, `tailwindcss
|
|
519
|
-
`package.json` of the project folder
|
|
522
|
+
- Adds `@xyflow/react`, `tailwindcss`, `@tailwindcss/postcss` and `cssnano` to
|
|
523
|
+
the `package.json` of the project folder
|
|
520
524
|
- Writes a `postcss.config.js` that configures Tailwind
|
|
521
525
|
|
|
522
526
|
```text
|
package/bin/vblocks
CHANGED
|
@@ -3,85 +3,36 @@
|
|
|
3
3
|
set -eu
|
|
4
4
|
|
|
5
5
|
# NAME
|
|
6
|
-
# vblocks -
|
|
6
|
+
# vblocks - Zero-config React builds, as a static site or a single HTML file
|
|
7
7
|
#
|
|
8
8
|
# SYNOPSIS
|
|
9
|
-
# vblocks
|
|
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>...]
|
|
24
|
-
# vblocks eject <webpack|postcss|swc>
|
|
9
|
+
# vblocks <command> [OPTIONS]
|
|
25
10
|
# vblocks -h | --help
|
|
26
11
|
#
|
|
27
12
|
# DESCRIPTION
|
|
28
|
-
#
|
|
29
|
-
# webpack.config.js, postcss.config.js or .swcrc, replaces the VBlocks
|
|
30
|
-
# default of the same name.
|
|
13
|
+
# Each command prints its own help with --help.
|
|
31
14
|
#
|
|
32
|
-
#
|
|
33
|
-
#
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
# Print each file it adds, updates or drops, then the next
|
|
38
|
-
# steps.
|
|
39
|
-
# serve Start the development server
|
|
40
|
-
# build Build the app into dist/ in the app folder. Print each file
|
|
41
|
-
# in dist/, its size and the total
|
|
42
|
-
# eject Print a default config, to save in the app folder
|
|
43
|
-
#
|
|
44
|
-
# serve and build pass every option after -- to Webpack, unchanged.
|
|
15
|
+
# ARGUMENTS
|
|
16
|
+
# command init Write a template into a folder
|
|
17
|
+
# serve Start the development server of an app
|
|
18
|
+
# build Build an app into dist/ in its folder
|
|
19
|
+
# eject Print a default config of VBlocks
|
|
45
20
|
#
|
|
46
21
|
# OPTIONS
|
|
47
|
-
#
|
|
48
|
-
# --only <app|plumbing> init: write only the app or only the plumbing.
|
|
49
|
-
# With app, init adds the app's dependencies to
|
|
50
|
-
# the package.json in the parent folder of
|
|
51
|
-
# <directory>. Without that file, init exits 3
|
|
52
|
-
# --mode <mode> serve, build: the Webpack mode, development or
|
|
53
|
-
# production (default: development for serve,
|
|
54
|
-
# production for build)
|
|
55
|
-
# --prefix <directory> serve, build: the app folder (default: the
|
|
56
|
-
# current folder)
|
|
57
|
-
# --single-file build: one standalone dist/index.html, every
|
|
58
|
-
# asset inlined
|
|
59
|
-
# --analyze serve: run the bundle analyzer, on a free port
|
|
60
|
-
# --log-level <level> serve, build: how much Webpack and its dev server
|
|
61
|
-
# print: error, warn, info or verbose (default:
|
|
62
|
-
# warn)
|
|
63
|
-
# -h, --help Print this help
|
|
64
|
-
#
|
|
65
|
-
# ENVIRONMENT
|
|
66
|
-
# NO_COLOR When non-empty, print without color, the tool icons or the
|
|
67
|
-
# header
|
|
22
|
+
# -h, --help Print this help
|
|
68
23
|
#
|
|
69
24
|
# EXAMPLE
|
|
70
25
|
# npx @asd14/vblocks init my-app
|
|
71
|
-
# npx
|
|
72
|
-
# npx @asd14/vblocks init demos/flow --template xyflow --only app
|
|
73
|
-
# cd demos && npx vblocks build --prefix flow --single-file
|
|
74
|
-
# npx vblocks serve -- --host 0.0.0.0
|
|
75
|
-
# npx vblocks eject postcss > postcss.config.js
|
|
26
|
+
# npx vblocks serve --help
|
|
76
27
|
#
|
|
77
28
|
# EXIT CODES
|
|
78
29
|
# 0 Done
|
|
79
|
-
# 2
|
|
80
|
-
#
|
|
81
|
-
#
|
|
30
|
+
# 2 No command, or an unknown command
|
|
31
|
+
#
|
|
32
|
+
# A command exits with the codes its help lists.
|
|
82
33
|
#
|
|
83
34
|
# SEE ALSO
|
|
84
|
-
#
|
|
35
|
+
# vblocks init, vblocks serve, vblocks build, vblocks eject
|
|
85
36
|
|
|
86
37
|
# npm links the command to this file, so "$0" names the link. realpath follows
|
|
87
38
|
# it to the package, where vblocks.d/ holds the commands
|
package/bin/vblocks.d/build
CHANGED
|
@@ -1,9 +1,55 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# NAME
|
|
4
|
+
# vblocks build - Build an app into dist/ in its folder
|
|
4
5
|
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
6
|
+
# SYNOPSIS
|
|
7
|
+
# vblocks build
|
|
8
|
+
# [--mode <development|production>]
|
|
9
|
+
# [--prefix <directory>]
|
|
10
|
+
# [--single-file|--single]
|
|
11
|
+
# [--log-level <error|warn|info|verbose>]
|
|
12
|
+
# [-- <webpack option>...]
|
|
13
|
+
#
|
|
14
|
+
# DESCRIPTION
|
|
15
|
+
# The app folder holds src/index.tsx and src/index.html. A config in it,
|
|
16
|
+
# webpack.config.js, postcss.config.js or .swcrc, replaces the VBlocks
|
|
17
|
+
# default of the same name. So do src/public/robots.txt and
|
|
18
|
+
# src/public/favicon.svg.
|
|
19
|
+
#
|
|
20
|
+
# Print the app folder, the VBlocks folder and the files Webpack runs with,
|
|
21
|
+
# then build. Print each file in dist/, its size and the total.
|
|
22
|
+
#
|
|
23
|
+
# OPTIONS
|
|
24
|
+
# --mode <mode> The Webpack mode, development or production
|
|
25
|
+
# (default: production)
|
|
26
|
+
# --prefix <directory> The app folder, which must exist (default: the
|
|
27
|
+
# current folder)
|
|
28
|
+
# --single-file, --single Build one standalone dist/index.html, every
|
|
29
|
+
# asset inlined, with no robots.txt. An ejected
|
|
30
|
+
# webpack.config.js must read env.single
|
|
31
|
+
# --log-level <level> How much Webpack prints: error, warn, info or
|
|
32
|
+
# verbose (default: warn)
|
|
33
|
+
# -- <webpack option>... Pass each option to Webpack, unchanged
|
|
34
|
+
# -h, --help Print this help
|
|
35
|
+
#
|
|
36
|
+
# ENVIRONMENT
|
|
37
|
+
# NO_COLOR When non-empty, print without color, the icons or the header
|
|
38
|
+
#
|
|
39
|
+
# EXAMPLE
|
|
40
|
+
# npx vblocks build
|
|
41
|
+
# cd demos && npx vblocks build --prefix flow --single-file
|
|
42
|
+
# npx vblocks build -- --devtool source-map
|
|
43
|
+
#
|
|
44
|
+
# EXIT CODES
|
|
45
|
+
# 0 Done
|
|
46
|
+
# 2 Invalid usage, or Webpack rejected an option or the config
|
|
47
|
+
# 3 Could not run: a missing tool, or a failed Webpack run
|
|
48
|
+
#
|
|
49
|
+
# SEE ALSO
|
|
50
|
+
# vblocks, vblocks serve, vblocks eject, webpack
|
|
51
|
+
|
|
52
|
+
# vblocks runs this file. Never call it directly.
|
|
7
53
|
|
|
8
54
|
set -eu
|
|
9
55
|
|
|
@@ -60,6 +106,10 @@ _print_build_files() {
|
|
|
60
106
|
|
|
61
107
|
while [ "$#" -gt 0 ]; do
|
|
62
108
|
case "$1" in
|
|
109
|
+
-h | --help)
|
|
110
|
+
_show_help "$0"
|
|
111
|
+
exit 0
|
|
112
|
+
;;
|
|
63
113
|
--prefix)
|
|
64
114
|
[ "$#" -lt 2 ] && _fail 2 "--prefix needs a folder"
|
|
65
115
|
_PREFIX_DIR=$2
|
|
@@ -108,18 +158,16 @@ _export_version
|
|
|
108
158
|
# ╰───
|
|
109
159
|
|
|
110
160
|
_APP_DIR=$(cd -- "${_PREFIX_DIR:-.}" && pwd)
|
|
111
|
-
_WEBPACK_CONFIG=$(
|
|
112
|
-
_POSTCSS_CONFIG=$(
|
|
113
|
-
_SWC_CONFIG=$(
|
|
161
|
+
_WEBPACK_CONFIG=$(_pick_file "$_APP_DIR" webpack.config.js)
|
|
162
|
+
_POSTCSS_CONFIG=$(_pick_file "$_APP_DIR" postcss.config.js)
|
|
163
|
+
_SWC_CONFIG=$(_pick_file "$_APP_DIR" .swcrc)
|
|
114
164
|
# A single file has no robots.txt next to it. Webpack drops an --env with an
|
|
115
165
|
# empty value, so the config gets no robotsPath
|
|
116
166
|
_ROBOTS_FILE=""
|
|
117
167
|
if [ -z "$_IS_SINGLE_FILE" ]; then
|
|
118
|
-
_ROBOTS_FILE=$(_pick_file
|
|
119
|
-
"$_APP_DIR/src/public/robots.txt" "$_VB_DIR/src/public/robots.txt")
|
|
168
|
+
_ROBOTS_FILE=$(_pick_file "$_APP_DIR" src/public/robots.txt)
|
|
120
169
|
fi
|
|
121
|
-
_FAVICON_FILE=$(_pick_file
|
|
122
|
-
"$_APP_DIR/src/public/favicon.svg" "$_VB_DIR/src/public/favicon.svg")
|
|
170
|
+
_FAVICON_FILE=$(_pick_file "$_APP_DIR" src/public/favicon.svg)
|
|
123
171
|
|
|
124
172
|
_ARTIFACT="SPA bundle"
|
|
125
173
|
if [ -n "$_IS_SINGLE_FILE" ]; then
|
package/bin/vblocks.d/eject
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# NAME
|
|
4
|
+
# vblocks eject - Print a default config of VBlocks
|
|
4
5
|
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
6
|
+
# SYNOPSIS
|
|
7
|
+
# vblocks eject <config>
|
|
8
|
+
#
|
|
9
|
+
# DESCRIPTION
|
|
10
|
+
# Print the config to stdout. Save it in the app folder, and serve and
|
|
11
|
+
# build run with it in place of the VBlocks default.
|
|
12
|
+
#
|
|
13
|
+
# An ejected config loads its plugins and loaders from the project folder,
|
|
14
|
+
# not from VBlocks. Install them there.
|
|
15
|
+
#
|
|
16
|
+
# ARGUMENTS
|
|
17
|
+
# config webpack, postcss or swc. Save each as webpack.config.js,
|
|
18
|
+
# postcss.config.js or .swcrc
|
|
19
|
+
#
|
|
20
|
+
# OPTIONS
|
|
21
|
+
# -h, --help Print this help
|
|
22
|
+
#
|
|
23
|
+
# EXAMPLE
|
|
24
|
+
# npx vblocks eject postcss > postcss.config.js
|
|
25
|
+
#
|
|
26
|
+
# EXIT CODES
|
|
27
|
+
# 0 Done
|
|
28
|
+
# 2 Invalid usage
|
|
29
|
+
#
|
|
30
|
+
# SEE ALSO
|
|
31
|
+
# vblocks, vblocks serve, vblocks build
|
|
32
|
+
|
|
33
|
+
# vblocks runs this file. Never call it directly.
|
|
7
34
|
|
|
8
35
|
set -eu
|
|
9
36
|
|
|
@@ -24,6 +51,10 @@ _EJECT_CONFIG="" # eject <config>
|
|
|
24
51
|
[ "$#" -ne 1 ] && _fail 2 -v available_configs "webpack,postcss,swc" "eject needs one config"
|
|
25
52
|
|
|
26
53
|
case "$1" in
|
|
54
|
+
-h | --help)
|
|
55
|
+
_show_help "$0"
|
|
56
|
+
exit 0
|
|
57
|
+
;;
|
|
27
58
|
webpack) _EJECT_CONFIG="webpack.config.js" ;;
|
|
28
59
|
postcss) _EJECT_CONFIG="postcss.config.js" ;;
|
|
29
60
|
swc) _EJECT_CONFIG=".swcrc" ;;
|
|
@@ -34,5 +65,5 @@ esac
|
|
|
34
65
|
# │ Main
|
|
35
66
|
# ╰───
|
|
36
67
|
|
|
37
|
-
cat -- "$_VB_DIR/
|
|
68
|
+
cat -- "$_VB_DIR/defaults/$_EJECT_CONFIG"
|
|
38
69
|
exit 0
|
package/bin/vblocks.d/init
CHANGED
|
@@ -1,9 +1,53 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# NAME
|
|
4
|
+
# vblocks init - Write a template into a folder
|
|
4
5
|
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
6
|
+
# SYNOPSIS
|
|
7
|
+
# vblocks init <directory>
|
|
8
|
+
# [--template <plain|xyflow|xyflow-tabs>]
|
|
9
|
+
# [--only <app|plumbing>]
|
|
10
|
+
#
|
|
11
|
+
# DESCRIPTION
|
|
12
|
+
# A template has two parts: the plumbing, which holds the files of the
|
|
13
|
+
# project folder, and the app, which holds the files of the app folder.
|
|
14
|
+
# After each part, run its post-init hooks in <directory>.
|
|
15
|
+
#
|
|
16
|
+
# Print the project folder and each file init adds, updates or drops, then
|
|
17
|
+
# the next steps.
|
|
18
|
+
#
|
|
19
|
+
# ARGUMENTS
|
|
20
|
+
# directory The folder to write into, missing or empty
|
|
21
|
+
#
|
|
22
|
+
# OPTIONS
|
|
23
|
+
# --template <name> The template, plain, xyflow or xyflow-tabs (default:
|
|
24
|
+
# plain)
|
|
25
|
+
# --only <part> Write only the app or only the plumbing (default:
|
|
26
|
+
# both). With app, init adds the template's
|
|
27
|
+
# dependencies to the package.json of the project
|
|
28
|
+
# folder, the parent of <directory>. That package.json
|
|
29
|
+
# must exist
|
|
30
|
+
# -h, --help Print this help
|
|
31
|
+
#
|
|
32
|
+
# ENVIRONMENT
|
|
33
|
+
# NO_COLOR When non-empty, print without color or the header
|
|
34
|
+
#
|
|
35
|
+
# EXAMPLE
|
|
36
|
+
# npx @asd14/vblocks init my-app
|
|
37
|
+
# npx @asd14/vblocks init demos --only plumbing
|
|
38
|
+
# npx @asd14/vblocks init demos/flow --template xyflow --only app
|
|
39
|
+
#
|
|
40
|
+
# EXIT CODES
|
|
41
|
+
# 0 Done
|
|
42
|
+
# 2 Invalid usage, an unknown template, or a <directory> that is not empty
|
|
43
|
+
# or not a folder
|
|
44
|
+
# 3 Could not run: a missing tool, no package.json in the project folder,
|
|
45
|
+
# a folder init could not add, or a failed copy or hook
|
|
46
|
+
#
|
|
47
|
+
# SEE ALSO
|
|
48
|
+
# vblocks, vblocks serve, node, npm
|
|
49
|
+
|
|
50
|
+
# vblocks runs this file. Never call it directly.
|
|
7
51
|
|
|
8
52
|
set -eu
|
|
9
53
|
|
|
@@ -35,6 +79,21 @@ _shorten_path() {
|
|
|
35
79
|
esac
|
|
36
80
|
}
|
|
37
81
|
|
|
82
|
+
# _quote_path <path>
|
|
83
|
+
#
|
|
84
|
+
# Print <path> in single quotes, so a shell reads it back as one word. A
|
|
85
|
+
# leading "~/" stays out of the quotes, so the shell still expands it.
|
|
86
|
+
_quote_path() {
|
|
87
|
+
# shellcheck disable=SC2088 # a literal "~", for display
|
|
88
|
+
case "$1" in
|
|
89
|
+
"~/"*) qp_home="~/" qp_path=${1#"~/"} ;;
|
|
90
|
+
*) qp_home="" qp_path=$1 ;;
|
|
91
|
+
esac
|
|
92
|
+
|
|
93
|
+
# End the quotes, add an escaped quote, open them again: ' becomes '\''
|
|
94
|
+
printf "%s'%s'\n" "$qp_home" "$(printf '%s' "$qp_path" | sed "s/'/'\\\\''/g")"
|
|
95
|
+
}
|
|
96
|
+
|
|
38
97
|
# ╭───
|
|
39
98
|
# │ Domain primitives
|
|
40
99
|
# ╰───
|
|
@@ -157,27 +216,27 @@ _print_init_summary() {
|
|
|
157
216
|
|
|
158
217
|
# _print_next_steps <parts> <init-dir> <project-dir> <init-abs-dir>
|
|
159
218
|
#
|
|
160
|
-
# Print the
|
|
161
|
-
#
|
|
219
|
+
# Print the next step and its command, in one line: for the plumbing, the init
|
|
220
|
+
# of an app, otherwise the install and the serve of the app. <init-dir> is
|
|
221
|
+
# <directory> as init prints it. <project-dir> and <init-abs-dir> are the
|
|
222
|
+
# absolute paths of the project folder and of <directory>.
|
|
162
223
|
_print_next_steps() {
|
|
163
224
|
case "$1" in
|
|
164
225
|
plumbing)
|
|
165
|
-
|
|
166
|
-
|
|
226
|
+
_info -v add_cmd "npx @asd14/vblocks init $(_quote_path "$2")/your-app-name --only app" \
|
|
227
|
+
"Next, add an app"
|
|
167
228
|
;;
|
|
168
229
|
app)
|
|
169
|
-
|
|
230
|
+
pns_cd=""
|
|
170
231
|
if [ "$3" != "$PWD" ]; then
|
|
171
|
-
|
|
232
|
+
pns_cd="cd $(_quote_path "$(_shorten_path "$3")") && "
|
|
172
233
|
fi
|
|
173
|
-
|
|
174
|
-
|
|
234
|
+
_info -v serve_cmd "${pns_cd}npm install && npx vblocks serve --prefix $(_quote_path "${4#"$3"/}")" \
|
|
235
|
+
"Next, serve the app"
|
|
175
236
|
;;
|
|
176
237
|
*)
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
printf ' npm install\n'
|
|
180
|
-
printf ' npx vblocks serve\n'
|
|
238
|
+
_info -v serve_cmd "cd $(_quote_path "$2") && npm install && npx vblocks serve" \
|
|
239
|
+
"Next, serve the app"
|
|
181
240
|
;;
|
|
182
241
|
esac
|
|
183
242
|
}
|
|
@@ -188,6 +247,10 @@ _print_next_steps() {
|
|
|
188
247
|
|
|
189
248
|
while [ "$#" -gt 0 ]; do
|
|
190
249
|
case "$1" in
|
|
250
|
+
-h | --help)
|
|
251
|
+
_show_help "$0"
|
|
252
|
+
exit 0
|
|
253
|
+
;;
|
|
191
254
|
--template)
|
|
192
255
|
[ "$#" -lt 2 ] && _fail 2 -v available_templates "$(_list_templates)" "--template needs a name"
|
|
193
256
|
_TEMPLATE=$2
|
package/bin/vblocks.d/serve
CHANGED
|
@@ -1,8 +1,55 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# NAME
|
|
4
|
+
# vblocks serve - Start the development server of an app
|
|
4
5
|
#
|
|
5
|
-
#
|
|
6
|
+
# SYNOPSIS
|
|
7
|
+
# vblocks serve
|
|
8
|
+
# [--mode <development|production>]
|
|
9
|
+
# [--prefix <directory>]
|
|
10
|
+
# [--analyze]
|
|
11
|
+
# [--log-level <error|warn|info|verbose>]
|
|
12
|
+
# [-- <webpack option>...]
|
|
13
|
+
#
|
|
14
|
+
# DESCRIPTION
|
|
15
|
+
# The app folder holds src/index.tsx and src/index.html. A config in it,
|
|
16
|
+
# webpack.config.js, postcss.config.js or .swcrc, replaces the VBlocks
|
|
17
|
+
# default of the same name. So do src/public/robots.txt and
|
|
18
|
+
# src/public/favicon.svg.
|
|
19
|
+
#
|
|
20
|
+
# Print the app folder, the VBlocks folder and the files Webpack runs with,
|
|
21
|
+
# then start the server.
|
|
22
|
+
#
|
|
23
|
+
# OPTIONS
|
|
24
|
+
# --mode <mode> The Webpack mode, development or production
|
|
25
|
+
# (default: development)
|
|
26
|
+
# --prefix <directory> The app folder, which must exist (default: the
|
|
27
|
+
# current folder)
|
|
28
|
+
# --analyze Run the bundle analyzer, on a free port. An
|
|
29
|
+
# ejected webpack.config.js must read
|
|
30
|
+
# env.analyze
|
|
31
|
+
# --log-level <level> How much Webpack and its development server
|
|
32
|
+
# print: error, warn, info or verbose (default:
|
|
33
|
+
# warn)
|
|
34
|
+
# -- <webpack option>... Pass each option to Webpack, unchanged
|
|
35
|
+
# -h, --help Print this help
|
|
36
|
+
#
|
|
37
|
+
# ENVIRONMENT
|
|
38
|
+
# NO_COLOR When non-empty, print without color, the icons or the header
|
|
39
|
+
#
|
|
40
|
+
# EXAMPLE
|
|
41
|
+
# npx vblocks serve
|
|
42
|
+
# npx vblocks serve --prefix flow -- --host 0.0.0.0
|
|
43
|
+
#
|
|
44
|
+
# EXIT CODES
|
|
45
|
+
# 0 Done
|
|
46
|
+
# 2 Invalid usage, or Webpack rejected an option or the config
|
|
47
|
+
# 3 Could not run: a missing tool, or a failed Webpack run
|
|
48
|
+
#
|
|
49
|
+
# SEE ALSO
|
|
50
|
+
# vblocks, vblocks build, vblocks eject, webpack
|
|
51
|
+
|
|
52
|
+
# vblocks runs this file. Never call it directly.
|
|
6
53
|
|
|
7
54
|
set -eu
|
|
8
55
|
|
|
@@ -27,6 +74,10 @@ _SHOULD_ANALYZE="" # --analyze, "true" or ""
|
|
|
27
74
|
|
|
28
75
|
while [ "$#" -gt 0 ]; do
|
|
29
76
|
case "$1" in
|
|
77
|
+
-h | --help)
|
|
78
|
+
_show_help "$0"
|
|
79
|
+
exit 0
|
|
80
|
+
;;
|
|
30
81
|
--prefix)
|
|
31
82
|
[ "$#" -lt 2 ] && _fail 2 "--prefix needs a folder"
|
|
32
83
|
_PREFIX_DIR=$2
|
|
@@ -75,13 +126,11 @@ _export_version
|
|
|
75
126
|
# ╰───
|
|
76
127
|
|
|
77
128
|
_APP_DIR=$(cd -- "${_PREFIX_DIR:-.}" && pwd)
|
|
78
|
-
_WEBPACK_CONFIG=$(
|
|
79
|
-
_POSTCSS_CONFIG=$(
|
|
80
|
-
_SWC_CONFIG=$(
|
|
81
|
-
_ROBOTS_FILE=$(_pick_file
|
|
82
|
-
|
|
83
|
-
_FAVICON_FILE=$(_pick_file \
|
|
84
|
-
"$_APP_DIR/src/public/favicon.svg" "$_VB_DIR/src/public/favicon.svg")
|
|
129
|
+
_WEBPACK_CONFIG=$(_pick_file "$_APP_DIR" webpack.config.js)
|
|
130
|
+
_POSTCSS_CONFIG=$(_pick_file "$_APP_DIR" postcss.config.js)
|
|
131
|
+
_SWC_CONFIG=$(_pick_file "$_APP_DIR" .swcrc)
|
|
132
|
+
_ROBOTS_FILE=$(_pick_file "$_APP_DIR" src/public/robots.txt)
|
|
133
|
+
_FAVICON_FILE=$(_pick_file "$_APP_DIR" src/public/favicon.svg)
|
|
85
134
|
|
|
86
135
|
_print_header "$VB_VERSION" "${_BOLD}serve${_RESET}: $_MODE${_SHOULD_ANALYZE:+, analyze}" >&2
|
|
87
136
|
_print_summary "$_APP_DIR" "$_WEBPACK_CONFIG" "$_POSTCSS_CONFIG" "$_SWC_CONFIG" \
|
package/bin/vblocks.d/vblocks.sh
CHANGED
|
@@ -13,8 +13,11 @@ _VB_DIR=$(dirname "$(dirname "$_SCRIPT_DIR")")
|
|
|
13
13
|
# shellcheck source=lib.sh
|
|
14
14
|
. "$_SCRIPT_DIR/lib.sh"
|
|
15
15
|
|
|
16
|
-
# _log reads LOG_NAMESPACE, LOG_LEVEL and NO_LOG_TIME.
|
|
17
|
-
#
|
|
16
|
+
# _log reads LOG_NAMESPACE, LOG_LEVEL and NO_LOG_TIME.
|
|
17
|
+
#
|
|
18
|
+
# - NO_LOG_TIME drops the time, which adds no fact to a message
|
|
19
|
+
# - Send each stderr message through _ok, _info, _warn or _fail
|
|
20
|
+
# - Only the header, the summaries and `help` print on their own
|
|
18
21
|
LOG_NAMESPACE="vblocks"
|
|
19
22
|
LOG_LEVEL="info"
|
|
20
23
|
NO_LOG_TIME="true"
|
package/bin/vblocks.d/webpack.sh
CHANGED
|
@@ -1,22 +1,7 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
|
|
3
|
-
# webpack.sh - The primitives of serve and build: the --log-level
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
# ╭───
|
|
7
|
-
# │ Primitives
|
|
8
|
-
# ╰───
|
|
9
|
-
|
|
10
|
-
# _pick_file <file> <default-file>
|
|
11
|
-
#
|
|
12
|
-
# Print <file> when it exists, otherwise <default-file>.
|
|
13
|
-
_pick_file() {
|
|
14
|
-
if [ -f "$1" ]; then
|
|
15
|
-
printf '%s\n' "$1"
|
|
16
|
-
else
|
|
17
|
-
printf '%s\n' "$2"
|
|
18
|
-
fi
|
|
19
|
-
}
|
|
3
|
+
# webpack.sh - The primitives of serve and build: the --mode and --log-level
|
|
4
|
+
# guards, the defaults, the summary and the Webpack run
|
|
20
5
|
|
|
21
6
|
# ╭───
|
|
22
7
|
# │ Domain primitives
|
|
@@ -48,12 +33,17 @@ _guard_mode() {
|
|
|
48
33
|
esac
|
|
49
34
|
}
|
|
50
35
|
|
|
51
|
-
#
|
|
36
|
+
# _pick_file <app-dir> <path>
|
|
52
37
|
#
|
|
53
|
-
# Print <
|
|
54
|
-
#
|
|
55
|
-
|
|
56
|
-
|
|
38
|
+
# Print <path> in <app-dir> when the file exists, otherwise the default of
|
|
39
|
+
# VBlocks at the same <path> in defaults/. defaults/ is laid out like an app
|
|
40
|
+
# folder.
|
|
41
|
+
_pick_file() {
|
|
42
|
+
if [ -f "$1/$2" ]; then
|
|
43
|
+
printf '%s\n' "$1/$2"
|
|
44
|
+
else
|
|
45
|
+
printf '%s\n' "$_VB_DIR/defaults/$2"
|
|
46
|
+
fi
|
|
57
47
|
}
|
|
58
48
|
|
|
59
49
|
# _print_file_path <file> <app-dir>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import cssnano from "cssnano"
|
|
2
|
+
import postcssPresetEnv from "postcss-preset-env"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Import the plugins, so Node resolves them from this file's folder
|
|
6
|
+
*
|
|
7
|
+
* @param {{ mode: "production" | "development" | "none" }} api
|
|
8
|
+
*/
|
|
9
|
+
export default ({ mode }) => ({
|
|
10
|
+
plugins: [
|
|
11
|
+
postcssPresetEnv({ stage: 2 }),
|
|
12
|
+
...(mode === "production" ? [cssnano({ preset: "default" })] : []),
|
|
13
|
+
],
|
|
14
|
+
})
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/** @typedef {import("webpack").Configuration} WebpackConfiguration */
|
|
2
2
|
|
|
3
3
|
import fs from "node:fs"
|
|
4
|
+
import { createRequire } from "node:module"
|
|
5
|
+
import path from "node:path"
|
|
4
6
|
import "webpack-dev-server"
|
|
7
|
+
import { buildLogger } from "@asd14/fancy-logger/node"
|
|
5
8
|
import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin"
|
|
6
9
|
import CopyPlugin from "copy-webpack-plugin"
|
|
7
10
|
import DotenvPlugin from "dotenv-webpack"
|
|
@@ -10,6 +13,8 @@ import MiniCssExtractPlugin from "mini-css-extract-plugin"
|
|
|
10
13
|
import webpack from "webpack"
|
|
11
14
|
import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer"
|
|
12
15
|
|
|
16
|
+
const logger = buildLogger({ namespace: "vblocks", level: "info" })
|
|
17
|
+
|
|
13
18
|
/**
|
|
14
19
|
* Read the SWC config, set the browser targets it lacks, and turn on React
|
|
15
20
|
* Refresh when `hasReactRefresh` is true
|
|
@@ -24,6 +29,10 @@ const loadSwcConfig = (path, { hasReactRefresh }) => {
|
|
|
24
29
|
|
|
25
30
|
return {
|
|
26
31
|
...typedConfig,
|
|
32
|
+
// VBlocks picks one .swcrc, from the app folder or its defaults. Without
|
|
33
|
+
// this, SWC also reads the .swcrc of the folder VBlocks runs in, eg. the
|
|
34
|
+
// package around the app
|
|
35
|
+
swcrc: false,
|
|
27
36
|
env: {
|
|
28
37
|
targets: "> 0.25%, not dead",
|
|
29
38
|
...typedConfig.env,
|
|
@@ -102,17 +111,6 @@ const getCssLoaders = ({ classScope, isProduction, postcssConfigPath }) => [
|
|
|
102
111
|
},
|
|
103
112
|
]
|
|
104
113
|
|
|
105
|
-
/**
|
|
106
|
-
* Print one line of VBlocks: a verb, then its subject. The `[vblocks]` prefix
|
|
107
|
-
* lets the reader tell it apart from the lines of Webpack
|
|
108
|
-
*
|
|
109
|
-
* @param {string} verb
|
|
110
|
-
* @param {string} subject
|
|
111
|
-
*/
|
|
112
|
-
const log = (verb, subject) => {
|
|
113
|
-
process.stdout.write(`[vblocks] ${verb.padEnd(7)} ${subject}\n`)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
114
|
/**
|
|
117
115
|
* Serve prints at most this many files per compile, then a count of the rest
|
|
118
116
|
*/
|
|
@@ -128,7 +126,7 @@ const MAX_REPORTED_FILE_EVENTS = 5
|
|
|
128
126
|
const reportFileEvents = appDir => compiler => {
|
|
129
127
|
/** @type {Set<string> | undefined} */
|
|
130
128
|
let previousFiles
|
|
131
|
-
/** @type {Array<[
|
|
129
|
+
/** @type {Array<["Updated" | "Added" | "Dropped", string]>} */
|
|
132
130
|
let fileEvents = []
|
|
133
131
|
|
|
134
132
|
// The watcher also reports editor swap files and folders, eg. the src/ that
|
|
@@ -140,11 +138,11 @@ const reportFileEvents = appDir => compiler => {
|
|
|
140
138
|
previousFiles?.has(file) &&
|
|
141
139
|
fs.statSync(file, { throwIfNoEntry: false })?.isFile()
|
|
142
140
|
) {
|
|
143
|
-
fileEvents.push(["
|
|
141
|
+
fileEvents.push(["Updated", file])
|
|
144
142
|
}
|
|
145
143
|
}
|
|
146
144
|
for (const file of watcher.removedFiles ?? []) {
|
|
147
|
-
if (previousFiles?.has(file)) fileEvents.push(["
|
|
145
|
+
if (previousFiles?.has(file)) fileEvents.push(["Dropped", file])
|
|
148
146
|
}
|
|
149
147
|
})
|
|
150
148
|
|
|
@@ -159,15 +157,20 @@ const reportFileEvents = appDir => compiler => {
|
|
|
159
157
|
.filter(file => !file.includes("/node_modules/"))
|
|
160
158
|
.toSorted()
|
|
161
159
|
|
|
162
|
-
for (const file of addedFiles)
|
|
160
|
+
for (const file of addedFiles) {
|
|
161
|
+
fileEvents.push(["Added", file])
|
|
162
|
+
}
|
|
163
163
|
}
|
|
164
164
|
previousFiles = files
|
|
165
165
|
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
const nextFileEvents = fileEvents.slice(0, MAX_REPORTED_FILE_EVENTS)
|
|
167
|
+
for (const [message, file] of nextFileEvents) {
|
|
168
|
+
logger.info(message, { file: file.replace(appDir, "$APP_DIR") })
|
|
168
169
|
}
|
|
169
170
|
if (fileEvents.length > MAX_REPORTED_FILE_EVENTS) {
|
|
170
|
-
|
|
171
|
+
logger.info("More files", {
|
|
172
|
+
count: fileEvents.length - MAX_REPORTED_FILE_EVENTS,
|
|
173
|
+
})
|
|
171
174
|
}
|
|
172
175
|
})
|
|
173
176
|
}
|
|
@@ -439,10 +442,14 @@ export default (
|
|
|
439
442
|
if (typeof address !== "object" || address === null) return
|
|
440
443
|
|
|
441
444
|
const { port } = address
|
|
442
|
-
|
|
445
|
+
logger.info("Started the server", {
|
|
446
|
+
url: `http://localhost:${port}`,
|
|
447
|
+
})
|
|
443
448
|
|
|
444
449
|
if (developmentServer.options.host !== "localhost") {
|
|
445
|
-
|
|
450
|
+
logger.info("Exposed the server to the network", {
|
|
451
|
+
address: `${developmentServer.options.host}:${port}`,
|
|
452
|
+
})
|
|
446
453
|
}
|
|
447
454
|
},
|
|
448
455
|
|
|
@@ -507,6 +514,12 @@ export default (
|
|
|
507
514
|
extensions: [".tsx", ".ts", ".jsx", ".js"],
|
|
508
515
|
alias: {
|
|
509
516
|
"@self": `${entryDir}/src`,
|
|
517
|
+
// React Refresh imports the dev server's client. Use the one VBlocks runs
|
|
518
|
+
"webpack-dev-server": path.dirname(
|
|
519
|
+
createRequire(import.meta.url).resolve(
|
|
520
|
+
"webpack-dev-server/package.json"
|
|
521
|
+
)
|
|
522
|
+
),
|
|
510
523
|
},
|
|
511
524
|
},
|
|
512
525
|
|
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": "6.
|
|
4
|
+
"version": "6.2.0",
|
|
5
5
|
"description": "Zero-config React builds, as a static site or a single HTML file",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"react",
|
|
@@ -34,13 +34,14 @@
|
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
36
|
"bin",
|
|
37
|
-
"
|
|
38
|
-
"template"
|
|
37
|
+
"defaults",
|
|
38
|
+
"template",
|
|
39
|
+
"types"
|
|
39
40
|
],
|
|
40
41
|
"type": "module",
|
|
41
42
|
"exports": {
|
|
42
43
|
"./client": {
|
|
43
|
-
"types": "./
|
|
44
|
+
"types": "./types/client.d.ts"
|
|
44
45
|
},
|
|
45
46
|
"./package.json": "./package.json"
|
|
46
47
|
},
|
|
@@ -53,40 +54,44 @@
|
|
|
53
54
|
"format": "eslint --fix .",
|
|
54
55
|
"----CODE-QA": "",
|
|
55
56
|
"lint": "eslint .",
|
|
56
|
-
"typecheck": "tsc --noEmit",
|
|
57
|
+
"typecheck:code": "tsc --noEmit --project ./.tsconfig/code.json",
|
|
58
|
+
"typecheck:client-types": "tsc --noEmit --project ./.tsconfig/client-types.json",
|
|
59
|
+
"typecheck": "npm run typecheck:code && npm run typecheck:client-types",
|
|
57
60
|
"unit-test:template": "tools/verify-templates",
|
|
58
61
|
"unit-test": "npm run unit-test:template"
|
|
59
62
|
},
|
|
60
63
|
"dependencies": {
|
|
64
|
+
"@asd14/fancy-logger": "^2.0.0",
|
|
61
65
|
"@mdx-js/loader": "^3.1.1",
|
|
62
66
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.6.3",
|
|
63
67
|
"@swc/helpers": "^0.5.23",
|
|
64
|
-
"browserslist": "^4.29.
|
|
68
|
+
"browserslist": "^4.29.5",
|
|
65
69
|
"copy-webpack-plugin": "^14.0.0",
|
|
66
70
|
"css-loader": "^7.1.5",
|
|
67
71
|
"cssnano": "^9.9.0",
|
|
68
72
|
"dotenv-webpack": "^9.0.0",
|
|
69
73
|
"html-webpack-plugin": "^5.6.8",
|
|
70
74
|
"mini-css-extract-plugin": "^2.10.2",
|
|
71
|
-
"postcss": "^8.5.
|
|
75
|
+
"postcss": "^8.5.32",
|
|
72
76
|
"postcss-loader": "^8.2.1",
|
|
73
77
|
"postcss-preset-env": "^11.6.1",
|
|
74
78
|
"react-refresh": "^0.19.0",
|
|
75
79
|
"swc-loader": "^0.2.7",
|
|
76
|
-
"webpack": "^5.112.
|
|
80
|
+
"webpack": "^5.112.2",
|
|
77
81
|
"webpack-bundle-analyzer": "^5.4.0",
|
|
78
82
|
"webpack-cli": "^7.2.3",
|
|
79
|
-
"webpack-dev-server": "^6.
|
|
83
|
+
"webpack-dev-server": "^6.1.0"
|
|
80
84
|
},
|
|
81
85
|
"devDependencies": {
|
|
82
|
-
"@asd14/eslint-config": "^16.
|
|
86
|
+
"@asd14/eslint-config": "^16.2.0",
|
|
83
87
|
"@asd14/prettier-config": "^1.5.0",
|
|
84
|
-
"@asd14/semantic-release-config": "^1.0
|
|
88
|
+
"@asd14/semantic-release-config": "^1.1.0",
|
|
85
89
|
"@asd14/ts-config": "^1.6.0",
|
|
86
|
-
"@commitlint/cli": "^21.2.
|
|
87
|
-
"@commitlint/config-conventional": "^21.2.
|
|
90
|
+
"@commitlint/cli": "^21.2.4",
|
|
91
|
+
"@commitlint/config-conventional": "^21.2.4",
|
|
88
92
|
"@tailwindcss/postcss": "^4.3.3",
|
|
89
93
|
"@types/dotenv-webpack": "^7.0.8",
|
|
94
|
+
"@types/react": "^19.3.0",
|
|
90
95
|
"@types/webpack-bundle-analyzer": "^4.7.0",
|
|
91
96
|
"@xyflow/react": "^12.12.0",
|
|
92
97
|
"eslint": "^9.39.5",
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import tailwindcss from "@tailwindcss/postcss"
|
|
2
|
+
import cssnano from "cssnano"
|
|
3
|
+
|
|
1
4
|
/**
|
|
5
|
+
* Import the plugins, so Node resolves them from this file's folder
|
|
6
|
+
*
|
|
2
7
|
* @param {{ mode: "production" | "development" | "none" }} api
|
|
3
8
|
*/
|
|
4
9
|
export default ({ mode }) => ({
|
|
5
|
-
plugins:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"cssnano": mode === "production" && {
|
|
10
|
-
preset: "default",
|
|
11
|
-
},
|
|
12
|
-
},
|
|
10
|
+
plugins: [
|
|
11
|
+
tailwindcss({ optimize: mode === "production" }),
|
|
12
|
+
...(mode === "production" ? [cssnano({ preset: "default" })] : []),
|
|
13
|
+
],
|
|
13
14
|
})
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import tailwindcss from "@tailwindcss/postcss"
|
|
2
|
+
import cssnano from "cssnano"
|
|
3
|
+
|
|
1
4
|
/**
|
|
5
|
+
* Import the plugins, so Node resolves them from this file's folder
|
|
6
|
+
*
|
|
2
7
|
* @param {{ mode: "production" | "development" | "none" }} api
|
|
3
8
|
*/
|
|
4
9
|
export default ({ mode }) => ({
|
|
5
|
-
plugins:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"cssnano": mode === "production" && {
|
|
10
|
-
preset: "default",
|
|
11
|
-
},
|
|
12
|
-
},
|
|
10
|
+
plugins: [
|
|
11
|
+
tailwindcss({ optimize: mode === "production" }),
|
|
12
|
+
...(mode === "production" ? [cssnano({ preset: "default" })] : []),
|
|
13
|
+
],
|
|
13
14
|
})
|
package/src/postcss.config.js
DELETED
/package/{src → defaults}/.swcrc
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|