-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:SUI-Components/sui into feat/bump…
…-karma-webpack-version
- Loading branch information
Showing
66 changed files
with
1,015 additions
and
312 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,38 @@ | ||
const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware') | ||
// @ts-check | ||
|
||
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware') | ||
const ignoredFiles = require('react-dev-utils/ignoredFiles') | ||
|
||
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http' | ||
const host = process.env.HOST || '0.0.0.0' | ||
const {HOST, HTTPS} = process.env | ||
const protocol = HTTPS === 'true' ? 'https' : 'http' | ||
const host = HOST || '0.0.0.0' | ||
|
||
module.exports = (config, allowedHost) => ({ | ||
// Enable gzip compression of generated files. | ||
compress: true, | ||
// Silence WebpackDevServer's own logs since they're generally not useful. | ||
// It will still show compile warnings and errors with this setting. | ||
clientLogLevel: 'none', | ||
// Tell the server where to serve content from. This is only necessary if you want to serve static files from this folder as normally they come from memory | ||
contentBase: 'public', | ||
// By default files from `contentBase` will not trigger a page reload. | ||
watchContentBase: true, | ||
// Enable hot reloading server. | ||
hot: true, | ||
// Use 'ws' instead of 'sockjs-node' on server since we're using native | ||
// websockets in `webpackHotDevClient`. | ||
transportMode: 'ws', | ||
// Prevent a WS client from getting injected as we're already including | ||
// `webpackHotDevClient`. | ||
injectClient: false, | ||
// Tell the server at what URL to serve devServer.contentBase static content. | ||
publicPath: config.output.publicPath, | ||
// WebpackDevServer is noisy by default so we emit custom message instead | ||
// by listening to the compiler events with `compiler.hooks[...].tap` calls above. | ||
quiet: true, | ||
// Reportedly, this avoids CPU overload on some systems. | ||
watchOptions: { | ||
ignored: ignoredFiles(config.context) | ||
module.exports = config => ({ | ||
allowedHosts: 'all', | ||
client: { | ||
logging: 'none', | ||
overlay: { | ||
errors: true, | ||
warnings: false | ||
}, | ||
progress: true | ||
}, | ||
static: { | ||
directory: 'public', | ||
watch: { | ||
ignored: ignoredFiles(config.context) | ||
} | ||
}, | ||
hot: true, | ||
https: protocol === 'https', | ||
host, | ||
overlay: false, | ||
historyApiFallback: { | ||
disableDotRule: true | ||
}, | ||
public: allowedHost, | ||
before(app) { | ||
// This lets us open files from the runtime error overlay. | ||
app.use(errorOverlayMiddleware()) | ||
}, | ||
after(app) { | ||
open: true, | ||
onAfterSetupMiddleware(devServer) { | ||
// This service worker file is effectively a 'no-op' that will reset any | ||
// previous service worker registered for the same host:port combination. | ||
app.use(noopServiceWorkerMiddleware(config.output.publicPath)) | ||
devServer.app.use(noopServiceWorkerMiddleware(config.output.publicPath)) | ||
} | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in https://github.com/facebook/create-react-app/blob/main/packages/react-dev-utils/LICENSE | ||
*/ | ||
|
||
const fs = require('fs') | ||
const path = require('path') | ||
|
||
function checkRequiredFiles(files) { | ||
let currentFilePath | ||
try { | ||
files.forEach(filePath => { | ||
currentFilePath = filePath | ||
fs.accessSync(filePath, fs.F_OK) | ||
}) | ||
return true | ||
} catch (err) { | ||
const dirName = path.dirname(currentFilePath) | ||
const fileName = path.basename(currentFilePath) | ||
|
||
console.log('Could not find a required file:') | ||
console.log(` Name: ${fileName}`) | ||
console.log(` Searched in: ${dirName}`) | ||
|
||
return false | ||
} | ||
} | ||
|
||
module.exports = checkRequiredFiles |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in https://github.com/facebook/create-react-app/blob/main/packages/react-dev-utils/LICENSE | ||
*/ | ||
|
||
function clearConsole() { | ||
process.stdout.write( | ||
process.platform === 'win32' ? '\x1B[2J\x1B[0f' : '\x1B[2J\x1B[3J\x1B[H' | ||
) | ||
} | ||
|
||
module.exports = clearConsole |
Oops, something went wrong.