-
-
Notifications
You must be signed in to change notification settings - Fork 779
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update documentation * Reverts #1436 * Update documentation --------- Co-authored-by: palisadoes <[email protected]> Co-authored-by: Peter Harrison <[email protected]>
- Loading branch information
1 parent
97994b9
commit fe63b6c
Showing
152 changed files
with
222 additions
and
657 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
require('dotenv').config(); | ||
const { spawn } = require('child_process'); | ||
|
||
//const react_script_start = 'npx react-scripts start'; | ||
const reactAppRewiredStart = | ||
'npx react-app-rewired start --config-overrides=scripts/config-overrides/'; | ||
const react_script_start = 'npx react-scripts start'; | ||
const react_app_rewired_start = 'npx react-app-rewired start --config-overrides=scripts/config-overrides'; | ||
|
||
if (process.env.ALLOW_LOGS === "YES") { | ||
// Execute the npm command | ||
spawn(react_app_rewired_start, { stdio: 'inherit', shell: true }); | ||
|
||
} | ||
else { | ||
// Execute the npm command | ||
spawn(react_script_start, { stdio: 'inherit', shell: true }); | ||
} | ||
|
||
spawn(reactAppRewiredStart, { stdio: 'inherit', shell: true }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,29 @@ | ||
const { | ||
override, | ||
addWebpackPlugin, | ||
overrideDevServer, | ||
} = require('customize-cra'); | ||
const { override, addWebpackPlugin } = require('customize-cra'); | ||
const webpack = require('webpack'); | ||
const fs = require('fs'); | ||
const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware'); | ||
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware'); | ||
const redirectServedPath = require('react-dev-utils/redirectServedPathMiddleware'); | ||
const paths = require('react-scripts/config/paths'); | ||
const isAllowLogEnabled = process.env.ALLOW_LOGS === 'YES'; | ||
module.exports = { | ||
webpack: override( | ||
// Add your new webpack plugin | ||
isAllowLogEnabled && | ||
(addWebpackPlugin( | ||
new webpack.ProgressPlugin({ | ||
activeModules: true, | ||
entries: true, | ||
handler: (percentage, message, ...args) => { | ||
// Log a custom progress message with active module and its count | ||
console.info( | ||
`<Webpack-Progress>: ${Math.floor(percentage * 100)}% ${message}` | ||
); | ||
}, | ||
modules: true, | ||
modulesCount: 5000, | ||
profile: false, | ||
dependencies: true, | ||
dependenciesCount: 10000, | ||
percentBy: null, | ||
}) | ||
), | ||
// Modify infrastructureLogging level | ||
(config) => { | ||
config.infrastructureLogging = { | ||
level: 'verbose', | ||
}; | ||
return config; | ||
}) | ||
), | ||
devServer: overrideDevServer((config) => { | ||
// Remove onAfterSetupMiddleware and onBeforeSetupMiddleware | ||
config.onAfterSetupMiddleware = undefined; | ||
config.onBeforeSetupMiddleware = undefined; | ||
|
||
// Add devServer.setupMiddlewares | ||
config.setupMiddlewares = (middlewares, devServer) => { | ||
if (!devServer) { | ||
throw new Error('webpack-dev-server is not defined'); | ||
} | ||
|
||
if (fs.existsSync(paths.proxySetup)) { | ||
require(paths.proxySetup)(devServer.app); | ||
} | ||
module.exports = override( | ||
// Add your new webpack plugin | ||
addWebpackPlugin(new webpack.ProgressPlugin({ | ||
activeModules: true, | ||
entries: true, | ||
handler: (percentage, message, ...args) => { | ||
// Log a custom progress message with active module and its count | ||
console.info(`<Webpack-Progress>: ${Math.floor(percentage * 100)}% ${message}`); | ||
}, | ||
modules: true, | ||
modulesCount: 5000, | ||
profile: false, | ||
dependencies: true, | ||
dependenciesCount: 10000, | ||
percentBy: null, | ||
})), | ||
|
||
middlewares.push( | ||
evalSourceMapMiddleware(devServer), | ||
redirectServedPath(paths.publicUrlOrPath), | ||
noopServiceWorkerMiddleware(paths.publicUrlOrPath) | ||
// Add your additional middlewares here if needed | ||
); | ||
|
||
return middlewares; | ||
// Modify infrastructureLogging level | ||
(config) => { | ||
config.infrastructureLogging = { | ||
level: 'verbose', | ||
}; | ||
}), | ||
}; | ||
return config; | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.