@xh/hoist-dev-utils 6.0.0 → 6.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 +13 -9
- package/configureWebpack.js +11 -6
- package/package.json +17 -16
package/README.md
CHANGED
|
@@ -14,9 +14,9 @@ including Webpack Dev Server, Babel, and other essential loaders.
|
|
|
14
14
|
|
|
15
15
|
In most cases this package could be the _only_ dev dependency required by Hoist React apps, although
|
|
16
16
|
apps might wish to configure additional tooling such as stylelint (for linting SASS files) or
|
|
17
|
-
lint-staged (for running linters as a pre-commit git hook). See the
|
|
17
|
+
lint-staged and husky (for running linters as a pre-commit git hook). See the
|
|
18
18
|
[Toolbox package.json](https://github.com/xh/toolbox/blob/develop/client-app/package.json) for
|
|
19
|
-
examples of
|
|
19
|
+
examples of these libraries in action.
|
|
20
20
|
|
|
21
21
|
### Webpack configuration
|
|
22
22
|
|
|
@@ -56,7 +56,6 @@ versioned 1.2.3 release).
|
|
|
56
56
|
See the [Hoist React docs](https://github.com/xh/hoist-react/blob/develop/docs/build-and-deploy.md)
|
|
57
57
|
for step-by-step details on the build process.
|
|
58
58
|
|
|
59
|
-
|
|
60
59
|
### Favicons
|
|
61
60
|
|
|
62
61
|
To include a favicon with your app, provide the `favicon` option to `configureWebpack()`. This can be either
|
|
@@ -71,27 +70,32 @@ return configureWebpack({
|
|
|
71
70
|
```
|
|
72
71
|
|
|
73
72
|
If your app is intended to be used on mobile devices, you may want to also include a wider variety of favicons.
|
|
74
|
-
The following files will be automatically bundled in your app's manifest.json if they are found your
|
|
73
|
+
The following files will be automatically bundled in your app's manifest.json if they are found in your project's
|
|
74
|
+
`/client-app/public` folder:
|
|
75
75
|
|
|
76
76
|
+ `favicon-192.png` (192px x 192px)
|
|
77
77
|
+ `favicon-512.png` (512px x 512px)
|
|
78
78
|
+ `apple-touch-icon.png` (180px x 180px)
|
|
79
79
|
|
|
80
80
|
You can use the `svg-favicon.sh` script to automatically create these favicons from a square SVG. Note that this script
|
|
81
|
-
requires inkscape to be installed. Download the latest version from [https://inkscape.org/](https://inkscape.org/)
|
|
81
|
+
requires inkscape to be installed. Download the latest version from [https://inkscape.org/](https://inkscape.org/) or
|
|
82
|
+
install on Mac via Homebrew with `brew install inkscape`.
|
|
82
83
|
|
|
83
|
-
Inkscape includes a command-line interface which is leveraged by the script. In order for the script to be able to use
|
|
84
|
-
you must first symlink Inkscape to `/usr/local/bin
|
|
84
|
+
Inkscape includes a command-line interface which is leveraged by the script. In order for the script to be able to use
|
|
85
|
+
it, you must first symlink Inkscape to `/usr/local/bin`. (Note this step is _not_ required if you have installed via
|
|
86
|
+
Homebrew.)
|
|
85
87
|
|
|
86
88
|
```shell
|
|
87
89
|
ln -s /Applications/Inkscape.app/Contents/MacOS/inkscape \
|
|
88
90
|
/usr/local/bin/inkscape
|
|
89
91
|
```
|
|
90
92
|
|
|
91
|
-
Then run the script, passing a path to the SVG file as the argument
|
|
93
|
+
Then run the script, passing a path to the SVG file as the argument. The command below assumes that you have
|
|
94
|
+
`hoist-dev-utils` checked out as a sibling of your top-level project directory, and that you are running the command
|
|
95
|
+
from within `$projectDir/client-app/public`:
|
|
92
96
|
|
|
93
97
|
```shell
|
|
94
|
-
|
|
98
|
+
../../../hoist-dev-utils/svg-favicon.sh favicon.svg
|
|
95
99
|
```
|
|
96
100
|
|
|
97
101
|
### ESLint Configuration
|
package/configureWebpack.js
CHANGED
|
@@ -301,10 +301,10 @@ async function configureWebpack(env) {
|
|
|
301
301
|
const appDirPath = path.resolve(srcPath, 'apps'),
|
|
302
302
|
apps = fs
|
|
303
303
|
.readdirSync(appDirPath)
|
|
304
|
-
.filter(f => f.endsWith('.js'))
|
|
304
|
+
.filter(f => f.endsWith('.js') || f.endsWith('.ts'))
|
|
305
305
|
.map(f => {
|
|
306
306
|
return {
|
|
307
|
-
name: f.replace('.js', ''),
|
|
307
|
+
name: f.replace('.js', '').replace('.ts', ''),
|
|
308
308
|
path: path.resolve(appDirPath, f)
|
|
309
309
|
};
|
|
310
310
|
}),
|
|
@@ -374,7 +374,7 @@ async function configureWebpack(env) {
|
|
|
374
374
|
// Add JSX to support imports from .jsx source w/o needing to add the extension.
|
|
375
375
|
// Include "*" to continue supporting other imports that *do* specify an extension
|
|
376
376
|
// within the import statement (i.e. `import './foo.png'`). Yes, it's confusing.
|
|
377
|
-
extensions: ['*', '.js', '.jsx', '.json']
|
|
377
|
+
extensions: ['*', '.js', '.ts', '.jsx', '.tsx', '.json']
|
|
378
378
|
},
|
|
379
379
|
|
|
380
380
|
// Ensure Webpack can find loaders installed both within the top-level node_modules dir for
|
|
@@ -424,15 +424,16 @@ async function configureWebpack(env) {
|
|
|
424
424
|
},
|
|
425
425
|
|
|
426
426
|
//------------------------
|
|
427
|
-
// JS processing
|
|
427
|
+
// JS/TS processing
|
|
428
428
|
// Transpile via Babel, with presets/plugins to support Hoist's use of modern / staged JS features.
|
|
429
429
|
//------------------------
|
|
430
430
|
{
|
|
431
|
-
test: /\.(jsx?)$/,
|
|
431
|
+
test: /\.(jsx?)$|\.(tsx?)$/,
|
|
432
432
|
use: {
|
|
433
433
|
loader: 'babel-loader',
|
|
434
434
|
options: {
|
|
435
435
|
presets: [
|
|
436
|
+
'@babel/preset-typescript',
|
|
436
437
|
'@babel/preset-react',
|
|
437
438
|
[
|
|
438
439
|
'@babel/preset-env',
|
|
@@ -456,6 +457,11 @@ async function configureWebpack(env) {
|
|
|
456
457
|
]
|
|
457
458
|
],
|
|
458
459
|
plugins: [
|
|
460
|
+
// Support Typescript via Babel. `isTSX` option allows use of JSX inline with
|
|
461
|
+
// .js files for older JS apps. Typescript apps must use the .tsx extension for
|
|
462
|
+
// any files containing JSX syntax.
|
|
463
|
+
['@babel/plugin-transform-typescript', {allowDeclareFields: true, isTSX: true}],
|
|
464
|
+
|
|
459
465
|
// Support our current decorator syntax, for MobX and Hoist decorators.
|
|
460
466
|
// See notes @ https://babeljs.io/docs/en/babel-plugin-proposal-decorators#legacy
|
|
461
467
|
['@babel/plugin-proposal-decorators', {legacy: true}],
|
|
@@ -702,7 +708,6 @@ async function configureWebpack(env) {
|
|
|
702
708
|
};
|
|
703
709
|
}
|
|
704
710
|
|
|
705
|
-
|
|
706
711
|
//------------------------
|
|
707
712
|
// Implementation
|
|
708
713
|
//------------------------
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xh/hoist-dev-utils",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "Utilities for configuring builds of Hoist-React client applications.",
|
|
5
5
|
"repository": "github:xh/hoist-dev-utils",
|
|
6
6
|
"homepage": "https://github.com/xh/hoist-dev-utils",
|
|
@@ -11,16 +11,17 @@
|
|
|
11
11
|
"configureWebpack.js"
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@babel/core": "
|
|
15
|
-
"@babel/plugin-proposal-decorators": "
|
|
16
|
-
"@babel/preset-env": "
|
|
17
|
-
"@babel/preset-react": "
|
|
14
|
+
"@babel/core": "^7.20",
|
|
15
|
+
"@babel/plugin-proposal-decorators": "^7.20",
|
|
16
|
+
"@babel/preset-env": "^7.20",
|
|
17
|
+
"@babel/preset-react": "^7.18",
|
|
18
|
+
"@babel/preset-typescript": "^7.18",
|
|
18
19
|
"@cerner/duplicate-package-checker-webpack-plugin": "~2.3.0",
|
|
19
20
|
"@types/lodash": "^4.0.0",
|
|
20
|
-
"@types/react": "^
|
|
21
|
-
"@xh/eslint-config": "
|
|
22
|
-
"autoprefixer": "~10.4.
|
|
23
|
-
"babel-loader": "~
|
|
21
|
+
"@types/react": "^18.0.0",
|
|
22
|
+
"@xh/eslint-config": "^5.0.0",
|
|
23
|
+
"autoprefixer": "~10.4.13",
|
|
24
|
+
"babel-loader": "~9.1.0",
|
|
24
25
|
"babel-plugin-transform-imports": "~2.0.0",
|
|
25
26
|
"case-sensitive-paths-webpack-plugin": "~2.4.0",
|
|
26
27
|
"changelog-parser": "~2.8.1",
|
|
@@ -31,21 +32,21 @@
|
|
|
31
32
|
"html-webpack-plugin": "~5.5.0",
|
|
32
33
|
"html-webpack-tags-plugin": "~3.0.2",
|
|
33
34
|
"lodash": "~4.17.21",
|
|
34
|
-
"mini-css-extract-plugin": "~2.
|
|
35
|
+
"mini-css-extract-plugin": "~2.7.0",
|
|
35
36
|
"postcss": "~8.4.14",
|
|
36
37
|
"postcss-flexbugs-fixes": "~5.0.2",
|
|
37
38
|
"postcss-loader": "~7.0.1",
|
|
38
39
|
"rimraf": "~3.0.2",
|
|
39
|
-
"sass": "~1.
|
|
40
|
-
"sass-loader": "~13.0
|
|
40
|
+
"sass": "~1.56.1",
|
|
41
|
+
"sass-loader": "~13.2.0",
|
|
41
42
|
"sass-material-colors": "~0.0.5",
|
|
42
43
|
"style-loader": "~3.3.1",
|
|
43
44
|
"terser-webpack-plugin": "~5.3.3",
|
|
44
45
|
"url-loader": "~4.1.1",
|
|
45
|
-
"webpack": "~5.
|
|
46
|
-
"webpack-bundle-analyzer": "~4.
|
|
47
|
-
"webpack-cli": "~
|
|
48
|
-
"webpack-dev-server": "~4.
|
|
46
|
+
"webpack": "~5.75.0",
|
|
47
|
+
"webpack-bundle-analyzer": "~4.7.0",
|
|
48
|
+
"webpack-cli": "~5.0.0",
|
|
49
|
+
"webpack-dev-server": "~4.11.1",
|
|
49
50
|
"webpackbar": "~5.0.2"
|
|
50
51
|
}
|
|
51
52
|
}
|