Skip to content

Commit

Permalink
migrated react-scripts form v4 to v5
Browse files Browse the repository at this point in the history
  • Loading branch information
rahuldsce committed Apr 8, 2022
1 parent db8227f commit e37ee3e
Show file tree
Hide file tree
Showing 27 changed files with 3,351 additions and 202 deletions.
59 changes: 58 additions & 1 deletion THIRD-PARTY-NOTICES
Original file line number Diff line number Diff line change
Expand Up @@ -2146,9 +2146,43 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

---------------------------------------------------
License notice for https://github.com/brendanashworth/generate-password
License notice for https://github.com/oliver-la/generate-password-browser
---------------------------------------------------

Copyright for portions of this project ("generate-password-browser") are held by Oliver Lazovic, 2017.
The Copyright for the original work ("generate-password") is held by Brendan Ashworth, 2014.
Copyright statements are listed below.


Modified work:


MIT License

Copyright (c) 2017 Oliver Lazovic

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


Original work:


The MIT License (MIT)

Copyright (c) 2014 Brendan Ashworth
Expand All @@ -2170,3 +2204,26 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

---------------------------------------------------
License notice for https://github.com/browserify/node-util
---------------------------------------------------

Copyright Joyent, Inc. and other Node contributors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
175 changes: 5 additions & 170 deletions craco.config.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,6 @@
/*craco.config.js*/
const path = require('path');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
reactHotReloadPlugin = require('craco-plugin-react-hot-reload');
const loaderNameMatches = function (rule, loaderName) {
return rule && rule.loader && typeof rule.loader === 'string' &&
(rule.loader.indexOf(`${path.sep}${loaderName}${path.sep}`) !== -1 ||
rule.loader.indexOf(`@${loaderName}${path.sep}`) !== -1);
};

const getLoader = function (rules, matcher) {
let loader;
// Array.prototype.some is used to return early if a matcher is found
rules.some(rule => {
return (loader = matcher(rule)
? rule
: getLoader(rule.use || rule.oneOf || (Array.isArray(rule.loader) && rule.loader) || [], matcher));
});

return loader;
};


/**
* configures worker-loader and makes sure each worker goes to a different file, as desired.
Expand All @@ -33,7 +13,7 @@ function makeMultipleWebworkersWork(config){

test: /\.worker\.(c|m)?[tj]s$/i,
type: "javascript/auto",
include: config.module.rules[1].include,
// include: config.module.rules[1].include,
use: [
{
loader: "worker-loader",
Expand All @@ -56,17 +36,7 @@ module.exports = {
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
splitChunks: {
cacheGroups: {
chunks:function(chunk){
return chunk.name !== 'antd-icons';
},
vendors: {
filename: '[name].bundle.js'
}
}
}
minimizer: [new TerserPlugin()]
},
dev: {
useEslint: true
Expand Down Expand Up @@ -106,18 +76,7 @@ module.exports = {
}
},
babel: {
plugins: [
[
'import',
{
'libraryName': 'antd',
'libraryDirectory':
'es',
'style': true
},
'ant'
],
],
plugins: [],
"env": {
"production": {
"plugins": ["transform-remove-console"]// remove all console.log at production build
Expand All @@ -126,135 +85,11 @@ module.exports = {
},
plugins: [
{
plugin: new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
},
{
plugin: reactHotReloadPlugin
plugin: new webpack.WatchIgnorePlugin({ paths: [/^\.\/locale$/, /moment$/] }),
},
{
plugin: {
overrideWebpackConfig: ({webpackConfig}) => {
const lessExtension = /\.less$/;

const fileLoader = getLoader(
webpackConfig.module.rules,
rule => loaderNameMatches(rule, 'file-loader')
);
fileLoader.exclude.push(lessExtension);

const lessRules = {
oneOf: [{
test: lessExtension,
use: [
{
loader: require.resolve('style-loader')
}, {
loader: require.resolve('css-loader')
}, {
loader: require.resolve('less-loader'),
options: {
modifyVars: {
//todo:##########################################
//todo: less variable for antd dark theme
//todo:##########################################
'@light': '#fff',
'@dark': '#000',
'@heading-color': 'fade(@light, 85)',
//'@text-color': 'fade(@light, 65)',
'@text-color': '#fff',
'@text-color-secondary': 'fade(@light, 45)',
'@disabled-color': 'fade(@light, 25)',
'@primary-5': '#0b4c06',
'@primary-6': '#1cecff',
'@primary-color': '#77BD25',
'@outline-color': '@primary-6',
'@icon-color': 'fade(@light, 65)',
'@icon-color-hover': 'fade(@light, 85)',
'@border-color-base': '@border-color-split',
'@btn-default-color': '@heading-color',
'@btn-default-bg': '#444457',
'@btn-default-border': '#444457',
'@btn-ghost-color': 'fade(@light, 45)',
'@btn-ghost-border': 'fade(@light, 45)',
'@input-color': '@text-color',
'@input-bg': 'rgba(0,0,0,.6)',
'@input-disabled-bg': '#1f1f1f',
'@input-placeholder-color': '@text-color-secondary',
'@input-hover-border-color': 'fade(@light, 10)',
'@checkbox-check-color': '#3b3b4d',
'@checkbox-color': '@primary-color',
'@select-border-color': '#3b3b4d',
'@item-active-bg': '#272733',
'@border-color-split': '#17171f',
'@menu-dark-bg': '#001529',
'@body-background': '#30303d',
'@component-background': '#23232e',
'@layout-body-background': '@body-background',
'@tooltip-bg': '#191922',
'@tooltip-arrow-color': '#191922',
'@popover-bg': '#000000',
'@success-color': '#00a854',
'@info-color': '@primary-color',
'@warning-color': '#ffbf00',
'@error-color': '#f04134',
'@menu-bg': 'black',
'@menu-item-active-bg': 'rgba(42,50,66,1)',
'@menu-highlight-color': '@light',
'@card-background': '@component-background',
'@card-hover-border': '#383847',
'@card-actions-background': '#30303d',
'@tail-color': 'fade(@light, 10)',
'@radio-button-bg': 'transparent',
'@radio-button-checked-bg': 'transparent',
'@radio-dot-color': '@primary-color',
'@table-row-hover-bg': '#383847',
'@item-hover-bg': '#383847',
'@alert-text-color': 'fade(@dark, 65%)',
'@tabs-horizontal-padding': '12px 0',
// zIndex': 'notification > popover > tooltip
'@zindex-notification': '1063',
'@zindex-popover': '1061',
'@zindex-tooltip': '1060',
// width
'@anchor-border-width': '1px',
// margin
'@form-item-margin-bottom': '24px',
'@menu-item-vertical-margin': '0px',
'@menu-item-boundary-margin': '0px',
// size
'@font-size-base': '14px',
'@font-size-lg': '16px',
'@screen-xl': '1208px',
'@screen-lg': '1024px',
'@screen-md': '768px',
'@screen-sm': '767.9px',
'@screen-xs': '375px',
'@alert-message-color': '@popover-bg',
'@background-color-light': '@popover-bg',
'@layout-header-background': '@menu-dark-bg',
'@site-text-color': '@text-color',
'@site-border-color-split': 'fade(@light, 5)',
'@site-heading-color': '@heading-color',
'@site-header-box-shadow': '0 0.3px 0.9px rgba(0, 0, 0, 0.12), 0 1.6px 3.6px rgba(0, 0, 0, 0.12)',
'@home-text-color': '@text-color',
'@gray-8': '@text-color',
'@background-color-base': '#555',
'@skeleton-color': 'rgba(0,0,0,0.8)',
'@pro-header-box-shadow': '@site-header-box-shadow',
},
javascriptEnabled: true
}
}
]
}]
}

const oneOfRule = webpackConfig.module.rules.find(rule => (
typeof rule.oneOf !== 'undefined'
));
const appendTo = oneOfRule ? oneOfRule.oneOf : webpackConfig.module.rules;
appendTo.push(lessRules);

overrideWebpackConfig: ({ webpackConfig }) => {
webpackConfig.module.rules.push(makeMultipleWebworkersWork(webpackConfig))
return webpackConfig;
}
Expand Down
36 changes: 17 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,37 @@
"react-animate-height"
],
"dependencies": {
"@craco/craco": "^6.4.3",
"@craco/craco": "^7.0.0-alpha.3",
"@date-io/date-fns": "^1.3.13",
"@hot-loader/react-dom": "^16.14.0",
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.60",
"@material-ui/pickers": "^3.3.10",
"axios": "^0.25.0",
"babel-loader": "^8.2.3",
"babel-loader": "^8.2.4",
"babel-plugin-import": "^1.13.0",
"babel-polyfill": "^6.26.0",
"chart.js": "^2.9.4",
"clsx": "^1.0.4",
"css-loader": "^3.4.2",
"cytoscape": "^3.15.2",
"d3": "^7.3.0",
"css-loader": "^6.7.1",
"cytoscape": "^3.21.1",
"d3": "^7.4.3",
"date-fns": "^2.15.0",
"downsample": "^1.3.0",
"generate-password": "^1.7.0",
"generate-password-browser": "^1.1.0",
"history": "^4.7.2",
"http-proxy-middleware": "^2.0.4",
"interactjs": "^1.9.22",
"json-server": "^0.16.1",
"jspdf": "^2.5.0",
"leaflet": "^1.7.1",
"less": "^3.11.1",
"less-loader": "^5.0.0",
"less": "^4.1.2",
"less-loader": "^10.2.0",
"lodash": "^4.17.21",
"moment": "^2.29.1",
"moment-timezone": "^0.5.28",
"npm": "^8.6.0",
"prop-types": "^15.7.2",
"randomcolor": "^0.6.2",
"react": "^16.14.0",
Expand All @@ -49,7 +50,7 @@
"react-dual-listbox": "^2.2.0",
"react-ga": "^3.3.0",
"react-google-recaptcha": "^2.1.0",
"react-hot-loader": "^4.12.20",
"react-hot-loader": "^4.13.0",
"react-leaflet": "^2.8.0",
"react-leaflet-control": "^2.1.2",
"react-leaflet-curve": "^2.0.1",
Expand All @@ -61,9 +62,10 @@
"redux": "^4.0.1",
"redux-form": "^8.3.1",
"semantic-ui-css": "^2.4.1",
"semantic-ui-react": "^2.0.3",
"style-loader": "^1.1.3",
"semantic-ui-react": "^2.1.2",
"style-loader": "^3.3.1",
"typescript": "^3.9.3",
"util": "^0.12.4",
"uuid": "^8.3.2",
"xterm": "^4.16.0",
"xterm-addon-fit": "^0.5.0",
Expand All @@ -81,14 +83,13 @@
"enzyme-adapter-react-16": "^1.15.4",
"jest-enzyme": "^7.1.2",
"react-error-overlay": "^6.0.9",
"react-scripts": "4.0.3",
"react-scripts": "^5.0.0",
"source-map-explorer": "^2.4.2",
"terser-webpack-plugin": "^3.0.3",
"webpack": "4.43.0",
"worker-loader": "^3.0.5"
"terser-webpack-plugin": "^5.3.1",
"webpack": "^5.72.0",
"worker-loader": "^3.0.8"
},
"scripts": {
"preinstall": "npx npm-force-resolutions",
"start": "craco start",
"build": "craco --max-old-space-size=4096 build",
"test": "react-scripts test",
Expand All @@ -106,8 +107,5 @@
"rules": {
"no-unused-vars": "off"
}
},
"resolutions": {
"react-error-overlay": "6.0.9"
}
}
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getDarkTheme, getLightTheme, THEME_TYPE } from "./themeStyle";
import LogoSpinner from './hoc/loader/LogoSpinner';
import { componentLoader } from './hoc/loader/componentLoader';
import Policy from './pages/landing/policy/Policy';
import 'semantic-ui-css/semantic.min.css';
import './semanticcss/semantic.min.css';
import './app.css';
import './css/index.css';

Expand Down
1 change: 1 addition & 0 deletions src/helper/constant/perpetual.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const ACTION_REMOVE_ALLIANCE_ORG = 'RemoveAllianceOrg'
export const ACTION_SHARE_ZONES = 'ShareZones'
export const ACTION_UNSHARE_ZONES = 'UnShareZones'
export const ACTION_UPDATE_PARTNER = 'updatePartner'
export const ACTION_SET_API_KEY = 'setAPIKey'
export const ACTION_REGISTER_FEDERATION = 'RegisterFederation'
export const ACTION_DEREGISTER_FEDERATION = 'DeRegisterFederation'
export const ACTION_GENERATE_API_KEY = 'GenerateApiKey'
Expand Down
Loading

0 comments on commit e37ee3e

Please sign in to comment.