@xh/hoist-dev-utils 16.1.0 → 16.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 +9 -23
- package/configureRsbuild.d.ts +4 -1
- package/configureRsbuild.js +30 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -227,29 +227,15 @@ The following files will be automatically bundled in your app's `manifest.json`
|
|
|
227
227
|
+ `favicon-512.png` (512px x 512px)
|
|
228
228
|
+ `apple-touch-icon.png` (180px x 180px)
|
|
229
229
|
|
|
230
|
-
### Generating favicons
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
```shell
|
|
241
|
-
# Not required if installed via Homebrew!
|
|
242
|
-
ln -s /Applications/Inkscape.app/Contents/MacOS/inkscape \
|
|
243
|
-
/usr/local/bin/inkscape
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
Then run the script, passing a path to the SVG file as the argument. The command below assumes that you have
|
|
247
|
-
`hoist-dev-utils` checked out as a sibling of your top-level project directory, and that you are running the command
|
|
248
|
-
from within `$projectDir/client-app/public`:
|
|
249
|
-
|
|
250
|
-
```shell
|
|
251
|
-
../../../hoist-dev-utils/svg-favicon.sh favicon.svg
|
|
252
|
-
```
|
|
230
|
+
### Generating favicons with the Toolbox Favicon Designer
|
|
231
|
+
|
|
232
|
+
Use the [Favicon Designer](https://toolbox.xh.io/favicons/) example app in Toolbox to create a
|
|
233
|
+
full favicon set. Pick any Font Awesome Pro glyph, choose colors, a backdrop shape and padding, and
|
|
234
|
+
preview the result in browser tabs and on a phone home screen. Download a zip of `favicon.svg`,
|
|
235
|
+
`favicon-192.png`, `favicon-512.png` and `apple-touch-icon.png`, unzip it into your app's
|
|
236
|
+
`client-app/public` folder, and paste the generated `configureRsbuild()` snippet into
|
|
237
|
+
`rsbuild.config.mjs`. The design is encoded in the page URL, and in a comment within the generated
|
|
238
|
+
`favicon.svg`, so you can reopen and tweak it later.
|
|
253
239
|
|
|
254
240
|
## ESLint Configuration
|
|
255
241
|
|
package/configureRsbuild.d.ts
CHANGED
|
@@ -170,7 +170,10 @@ declare namespace configureRsbuild {
|
|
|
170
170
|
devGrailsPort?: number | string;
|
|
171
171
|
/** Port on which to start the dev server (historic name). Default 3000. Dev-mode only. */
|
|
172
172
|
devWebpackPort?: number | string;
|
|
173
|
-
/**
|
|
173
|
+
/**
|
|
174
|
+
* Path to open when the dev server starts. Unset to open nothing. Also where the dev server
|
|
175
|
+
* redirects the bare root `/` - unset, the `app` entry or a sole entry. Dev-mode only.
|
|
176
|
+
*/
|
|
174
177
|
devServerOpenPage?: string;
|
|
175
178
|
/**
|
|
176
179
|
* `true` to run the dev server over SSL with a self-signed cert, or Node
|
package/configureRsbuild.js
CHANGED
|
@@ -142,7 +142,8 @@ const hoistReactPkg = resolveAppPackage('@xh/hoist', basePath),
|
|
|
142
142
|
* @param {number} [env.devGrailsPort] - port of local Grails server. Dev-mode only.
|
|
143
143
|
* @param {number} [env.devWebpackPort] - port on which to start the dev server. (Historic name retained.) Dev-mode only.
|
|
144
144
|
* @param {string} [env.devServerOpenPage] - path to auto-open when the dev server starts. Leave null to disable
|
|
145
|
-
* automatic page open on startup.
|
|
145
|
+
* automatic page open on startup. Also where the dev server redirects a request for the bare root `/` -
|
|
146
|
+
* unset, that redirect goes to the `app` entry, or to the only entry if there is one. Dev-mode only.
|
|
146
147
|
* @param {boolean} [env.devLiveReload=true] - false to stop the dev server from reloading the page when an edit
|
|
147
148
|
* cannot be hot-swapped (the equivalent of webpack-dev-server's `--no-live-reload`). Hot-swaps of CSS and
|
|
148
149
|
* Fast-Refresh-eligible components still apply; other edits are rebuilt but not applied until a manual
|
|
@@ -298,6 +299,22 @@ async function configureRsbuild(env) {
|
|
|
298
299
|
clientAppNames = clientApps.map(it => it.name),
|
|
299
300
|
appEntryPoints = Object.fromEntries(clientApps.map(it => [it.name, it.path]));
|
|
300
301
|
|
|
302
|
+
// Dev-server redirect target for the bare root, which has no entry of its own and would
|
|
303
|
+
// otherwise 404 - the open page when set, else the `app` entry, else a sole entry. Skipped
|
|
304
|
+
// for prod builds, and `URL.parse` returns null rather than throwing on a malformed value.
|
|
305
|
+
const openPagePath =
|
|
306
|
+
!prodBuild && env.devServerOpenPage
|
|
307
|
+
? URL.parse(env.devServerOpenPage, 'http://localhost/')?.pathname
|
|
308
|
+
: null,
|
|
309
|
+
devRootRedirect =
|
|
310
|
+
openPagePath && openPagePath !== '/'
|
|
311
|
+
? openPagePath
|
|
312
|
+
: clientAppNames.includes('app')
|
|
313
|
+
? '/app/'
|
|
314
|
+
: clientAppNames.length === 1
|
|
315
|
+
? `/${clientAppNames[0]}/`
|
|
316
|
+
: null;
|
|
317
|
+
|
|
301
318
|
// Hoist-react's polyfills.js (a single `core-js/stable` import) is prepended to every app
|
|
302
319
|
// entry. With SWC's preset-env in `entry` mode (see `tools.swc` below), that import is
|
|
303
320
|
// rewritten into the specific polyfills needed for the configured target browsers.
|
|
@@ -565,6 +582,18 @@ async function configureRsbuild(env) {
|
|
|
565
582
|
to: `/${appName}/index.html`
|
|
566
583
|
}))
|
|
567
584
|
},
|
|
585
|
+
// Redirect the bare root to a default app, as the `location = /` block in
|
|
586
|
+
// Hoist's nginx configs does. Runs ahead of Rsbuild's own middleware.
|
|
587
|
+
setup: devRootRedirect
|
|
588
|
+
? ({server}) => {
|
|
589
|
+
server.middlewares.use((req, res, next) => {
|
|
590
|
+
if (req.url !== '/' && !req.url.startsWith('/?')) return next();
|
|
591
|
+
res.statusCode = 302;
|
|
592
|
+
res.setHeader('Location', devRootRedirect);
|
|
593
|
+
res.end();
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
: undefined,
|
|
568
597
|
// Proxy API requests to the Grails backend, mirroring the production nginx setup.
|
|
569
598
|
// Only needed when baseUrl is a relative path (default '/api/') - if baseUrl is
|
|
570
599
|
// an absolute URL, the app will call the remote server directly. Note the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xh/hoist-dev-utils",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.2.0",
|
|
4
4
|
"description": "Rsbuild (Rspack + SWC) build configuration and shared dev dependencies for Hoist React applications.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,21 +25,21 @@
|
|
|
25
25
|
"node": ">=22.15.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@rsbuild/core": "~2.
|
|
28
|
+
"@rsbuild/core": "~2.3.0",
|
|
29
29
|
"@rsbuild/plugin-basic-ssl": "~2.0.0",
|
|
30
30
|
"@rsbuild/plugin-react": "~2.1.1",
|
|
31
31
|
"@rsbuild/plugin-sass": "~2.0.1",
|
|
32
|
-
"@types/lodash": "^4.17.
|
|
32
|
+
"@types/lodash": "^4.17.27",
|
|
33
33
|
"@types/react": "^19.3.0",
|
|
34
34
|
"@types/react-dom": "^19.3.0",
|
|
35
35
|
"@xh/eslint-config": "^8.1.0",
|
|
36
36
|
"changelog-parser": "~4.1.0",
|
|
37
37
|
"lodash": "^4.18.1",
|
|
38
|
-
"sass-embedded": "^1.
|
|
38
|
+
"sass-embedded": "^1.107.1",
|
|
39
39
|
"type-fest": "^5.10.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"prettier": "^3.9.
|
|
42
|
+
"prettier": "^3.9.10"
|
|
43
43
|
},
|
|
44
44
|
"packageManager": "pnpm@12.10.1+sha512.ba40a37eb1a370d60fea8c4cf1d364c13bcccef518e98ad2bcee954f539d38da37458e58261a3fa55e06523450ea0ffff9f497b135be41f2c15c1642bacace6c"
|
|
45
45
|
}
|