Skip to content

Commit b3bafa0

Browse files
committed
feat: update react-materialize to v3
1 parent 59c183f commit b3bafa0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+897
-348
lines changed

client/craco.config.js

Lines changed: 64 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
/* eslint-disable */
2-
const path = require('path');
3-
const { whenProd, POSTCSS_MODES, paths } = require('@craco/craco');
4-
const ImageminPlugin = require('imagemin-webpack-plugin').default;
5-
const imageminMozjpeg = require('imagemin-mozjpeg');
6-
const imageminJpegRecompress = require('imagemin-jpeg-recompress');
7-
const imageminPngquant = require('imagemin-pngquant');
8-
const imageminZopfli = require('imagemin-zopfli');
9-
const imageminGiflossy = require('imagemin-giflossy');
10-
const imageminWebp = require('imagemin-webp');
11-
const CompressionPlugin = require('compression-webpack-plugin');
12-
const HtmlCriticalPlugin = require('html-critical-webpack-plugin');
13-
const CleanWebpackPlugin = require('clean-webpack-plugin');
2+
const path = require('path')
3+
const { whenProd, POSTCSS_MODES, paths } = require('@craco/craco')
4+
const CompressionPlugin = require('compression-webpack-plugin')
5+
const HtmlCriticalPlugin = require('html-critical-webpack-plugin')
6+
const ImageminPlugin = require('imagemin-webpack')
7+
const imageminGiflossy = require('imagemin-giflossy')
8+
const imageminMozJpeg = require('imagemin-mozjpeg')
9+
const imageminPngquant = require('imagemin-pngquant')
10+
const imageminSvgo = require('imagemin-svgo')
11+
const ImageminWebpWebpackPlugin = require('imagemin-webp-webpack-plugin')
1412

15-
const { NODE_ENV } = process.env;
13+
const { NODE_ENV } = process.env
1614

1715
module.exports = function() {
1816
return {
1917
style: {
2018
modules: {
21-
localIdentName: '[sha1:hash:hex:4]'
19+
localIdentName: '[sha1:hash:hex:4]',
2220
},
2321
postcss: {
24-
mode: POSTCSS_MODES.file
25-
}
22+
mode: POSTCSS_MODES.file,
23+
},
2624
},
2725
babel: whenProd(() => ({
2826
comments: false,
@@ -35,47 +33,53 @@ module.exports = function() {
3533
{
3634
'react-router-dom': {
3735
transform: 'react-router-dom/${member}',
38-
preventFullImport: true
39-
}
40-
}
36+
preventFullImport: true,
37+
},
38+
},
4139
],
42-
'babel-plugin-transform-react-class-to-function'
43-
]
40+
'babel-plugin-transform-react-class-to-function',
41+
],
4442
})),
4543
webpack: {
4644
plugins:
4745
NODE_ENV === 'development'
48-
? [new CleanWebpackPlugin(['build'])]
46+
? []
4947
: [
50-
new CleanWebpackPlugin(['build']),
5148
new ImageminPlugin({
52-
plugins: [
53-
imageminPngquant({
54-
speed: 1,
55-
quality: 98 //lossy settings
56-
}),
57-
imageminZopfli({
58-
more: true
59-
}),
60-
imageminMozjpeg({ progressive: true, quality: 80 }),
61-
imageminJpegRecompress({
62-
loops: 6,
63-
min: 40,
64-
max: 85,
65-
quality: 'low'
66-
}),
67-
imageminGiflossy({
68-
optimizationLevel: 3,
69-
optimize: 3, //keep-empty: Preserve empty transparent frames
70-
lossy: 2
71-
}),
72-
imageminWebp({ quality: 50 })
49+
bail: false, // Ignore errors on corrupted images
50+
cache: false,
51+
imageminOptions: {
52+
plugins: [
53+
imageminGiflossy({
54+
interlaced: true,
55+
optimizationLevel: 3,
56+
}),
57+
imageminMozJpeg({
58+
quality: 70,
59+
progressive: true,
60+
}),
61+
imageminPngquant({
62+
speed: 1,
63+
quality: [0.85, 1], //lossy settings
64+
optimizationLevel: 5,
65+
strip: true,
66+
}),
67+
imageminSvgo({
68+
removeViewBox: true,
69+
}),
70+
],
71+
},
72+
}),
73+
new ImageminWebpWebpackPlugin({
74+
config: [
75+
{
76+
test: /\.webp/,
77+
options: {
78+
quality: 50,
79+
},
80+
},
7381
],
74-
svgo: {
75-
removeViewBox: false
76-
}
7782
}),
78-
new CompressionPlugin(),
7983
new HtmlCriticalPlugin({
8084
base: path.join(path.resolve(__dirname), 'build/'),
8185
src: 'index.html',
@@ -84,9 +88,10 @@ module.exports = function() {
8488
minify: true,
8589
extract: true,
8690
penthouse: {
87-
blockJSRequests: false
88-
}
89-
})
91+
blockJSRequests: false,
92+
},
93+
}),
94+
new CompressionPlugin(),
9095
],
9196
alias: {
9297
components: path.join(paths.appSrc, 'components'),
@@ -95,8 +100,8 @@ module.exports = function() {
95100
style: path.join(paths.appSrc, 'style'),
96101
libs: path.join(paths.appSrc, 'libs'),
97102
assets: path.join(paths.appSrc, 'assets'),
98-
vendor: path.join(paths.appSrc, 'vendor')
99-
}
103+
vendor: path.join(paths.appSrc, 'vendor'),
104+
},
100105
},
101106
jest: {
102107
configure: {
@@ -108,14 +113,11 @@ module.exports = function() {
108113
'^style(.*)$': '<rootDir>/src/style$1',
109114
'^libs(.*)$': '<rootDir>/src/libs$1',
110115
'^assets(.*)$': '<rootDir>/src/assets$1',
111-
'^vendor(.*)$': '<rootDir>/src/vendor$1'
116+
'^vendor(.*)$': '<rootDir>/src/vendor$1',
112117
},
113118
moduleDirectories: ['node_modules', 'src'],
114-
testPathIgnorePatterns: [
115-
'<rootDir>/cypress/',
116-
'<rootDir>/node_modules/'
117-
]
118-
}
119-
}
120-
};
121-
};
119+
testPathIgnorePatterns: ['<rootDir>/cypress/', '<rootDir>/node_modules/'],
120+
},
121+
},
122+
}
123+
}

client/package.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
"lint:css:fix": "stylelint src/**/**/*.css --fix",
4444
"pretty:js": "prettier --write src/**/**/*.js",
4545
"pretty:css": "prettier --write src/**/*.css",
46+
"assets": "run-s assets:resize assets:webp",
47+
"assets:resize": "env-cmd .env node src/libs/images/resizeAll.js",
48+
"assets:webp": "node src/libs/images/toWebP.js",
4649
"storybook": "start-storybook -p 9009 -s public",
4750
"build-storybook": "build-storybook -s public"
4851
},
@@ -85,7 +88,6 @@
8588
"babel-plugin-transform-imports": "^1.5.1",
8689
"babel-plugin-transform-react-class-to-function": "^1.2.0",
8790
"babel-plugin-transform-react-remove-prop-types": "^0.4.21",
88-
"clean-webpack-plugin": "^1.0.0",
8991
"compression-webpack-plugin": "^2.0.0",
9092
"conventional-changelog-cli": "^2.0.11",
9193
"cross-env": "^5.2.0",
@@ -104,12 +106,11 @@
104106
"html-critical-webpack-plugin": "^2.1.0",
105107
"husky": "^1.2.1",
106108
"imagemin-giflossy": "^5.1.10",
107-
"imagemin-jpeg-recompress": "^6.0.0",
108109
"imagemin-mozjpeg": "^8.0.0",
109-
"imagemin-pngquant": "^6.0.0",
110-
"imagemin-webp": "^5.0.0",
111-
"imagemin-webpack-plugin": "^2.3.0",
112-
"imagemin-zopfli": "^5.1.0",
110+
"imagemin-pngquant": "^7.0.0",
111+
"imagemin-svgo": "^7.0.0",
112+
"imagemin-webp-webpack-plugin": "^3.1.0",
113+
"imagemin-webpack": "^4.1.0",
113114
"lint-staged": "^8.0.4",
114115
"npm-run-all": "^4.1.5",
115116
"postcss-assets": "^5.0.0",
@@ -126,6 +127,8 @@
126127
"prettier": "^1.15.3",
127128
"react-test-renderer": "^16.6.3",
128129
"release-it": "^9.1.0",
130+
"sharp": "^0.22.0",
131+
"sqip": "^0.3.3",
129132
"start-server-and-test": "^1.7.11",
130133
"storybook-react-router": "^1.0.2",
131134
"stylelint": "^9.9.0",

client/public/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,9 @@
1717
<noscript> You need to enable JavaScript to run this app. </noscript>
1818
<div id="root"></div>
1919
</body>
20+
21+
<script
22+
crossorigin="anonymous"
23+
src="https://polyfill.io/v3/polyfill.js?features=es5,es6,es7,IntersectionObserver,HTMLPictureElement&flags=gated&rum=true"
24+
></script>
2025
</html>
Lines changed: 1 addition & 0 deletions
Loading
42.1 KB
Loading
Lines changed: 1 addition & 0 deletions
Loading
97.9 KB
Loading

client/src/assets/img/home.svg

Lines changed: 1 addition & 0 deletions
Loading

client/src/assets/img/home.webp

273 KB
Loading

client/src/assets/img/index.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import classDiagramPng from './class-diagram.png'
2+
import classDiagramWebP from './class-diagram.webp'
3+
import classDiagramSvg from './class-diagram.svg'
4+
import restructuredClassDiagramPng from './restructured-class-diagram.png'
5+
import restructuredClassDiagramWebP from './restructured-class-diagram.webp'
6+
import restructuredClassDiagramSvg from './restructured-class-diagram.svg'
7+
import conferenceJpg from './conference.jpg'
8+
import conferenceWebP from './conference.webp'
9+
import conferenceSvg from './conference.svg'
10+
import homeJpg from './home.jpg'
11+
import homeWebP from './home.webp'
12+
import homeSvg from './home.svg'
13+
import OrganizationJpg from './organization.jpg'
14+
import OrganizationWebP from './organization.webp'
15+
import OrganizationSvg from './organization.svg'
16+
17+
export {
18+
classDiagramPng,
19+
classDiagramWebP,
20+
classDiagramSvg,
21+
restructuredClassDiagramPng,
22+
restructuredClassDiagramWebP,
23+
restructuredClassDiagramSvg,
24+
conferenceJpg,
25+
conferenceWebP,
26+
conferenceSvg,
27+
homeJpg,
28+
homeWebP,
29+
homeSvg,
30+
OrganizationJpg,
31+
OrganizationWebP,
32+
OrganizationSvg,
33+
}

0 commit comments

Comments
 (0)