Removed react-css-modules

This commit is contained in:
Scott E. Graves
2019-04-09 12:18:57 -05:00
parent 177fd97c4b
commit 35a38977b6
46 changed files with 201 additions and 1395 deletions

View File

@@ -8,6 +8,7 @@
* Ubuntu 18.04 * Ubuntu 18.04
* Ubuntu 18.10 * Ubuntu 18.10
* Ubuntu 19.04 * Ubuntu 19.04
* Removed `react-css-modules` dependency
## 1.0.2 ## ## 1.0.2 ##
* Option to launch application hidden (notification icon only) * Option to launch application hidden (notification icon only)

View File

@@ -1,93 +0,0 @@
'use strict';
const fs = require('fs');
const path = require('path');
const paths = require('./paths');
// Make sure that including paths.js after env.js will read .env variables.
delete require.cache[require.resolve('./paths')];
const NODE_ENV = process.env.NODE_ENV;
if (!NODE_ENV) {
throw new Error(
'The NODE_ENV environment variable is required but was not specified.'
);
}
// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
var dotenvFiles = [
`${paths.dotenv}.${NODE_ENV}.local`,
`${paths.dotenv}.${NODE_ENV}`,
// Don't include `.env.local` for `test` environment
// since normally you expect tests to produce the same
// results for everyone
NODE_ENV !== 'test' && `${paths.dotenv}.local`,
paths.dotenv,
].filter(Boolean);
// Load environment variables from .env* files. Suppress warnings using silent
// if this file is missing. dotenv will never modify any environment variables
// that have already been set. Variable expansion is supported in .env files.
// https://github.com/motdotla/dotenv
// https://github.com/motdotla/dotenv-expand
dotenvFiles.forEach(dotenvFile => {
if (fs.existsSync(dotenvFile)) {
require('dotenv-expand')(
require('dotenv').config({
path: dotenvFile,
})
);
}
});
// We support resolving modules according to `NODE_PATH`.
// This lets you use absolute paths in imports inside large monorepos:
// https://github.com/facebookincubator/create-react-app/issues/253.
// It works similar to `NODE_PATH` in Node itself:
// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
// https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421
// We also resolve them to make sure all tools using them work consistently.
const appDirectory = fs.realpathSync(process.cwd());
process.env.NODE_PATH = (process.env.NODE_PATH || '')
.split(path.delimiter)
.filter(folder => folder && !path.isAbsolute(folder))
.map(folder => path.resolve(appDirectory, folder))
.join(path.delimiter);
// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
// injected into the application via DefinePlugin in Webpack configuration.
const REACT_APP = /^REACT_APP_/i;
function getClientEnvironment(publicUrl) {
const raw = Object.keys(process.env)
.filter(key => REACT_APP.test(key))
.reduce(
(env, key) => {
env[key] = process.env[key];
return env;
},
{
// Useful for determining whether were running in production mode.
// Most importantly, it switches React into the correct mode.
NODE_ENV: process.env.NODE_ENV || 'development',
// Useful for resolving the correct path to static assets in `public`.
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
// This should only be used as an escape hatch. Normally you would put
// images into the `src` and `import` them in code to get their paths.
PUBLIC_URL: publicUrl,
}
);
// Stringify all values so we can feed into Webpack DefinePlugin
const stringified = {
'process.env': Object.keys(raw).reduce((env, key) => {
env[key] = JSON.stringify(raw[key]);
return env;
}, {}),
};
return { raw, stringified };
}
module.exports = getClientEnvironment;

View File

@@ -1,14 +0,0 @@
'use strict';
// This is a custom Jest transformer turning style imports into empty objects.
// http://facebook.github.io/jest/docs/en/webpack.html
module.exports = {
process() {
return 'module.exports = {};';
},
getCacheKey() {
// The output is always the same.
return 'cssTransform';
},
};

View File

@@ -1,12 +0,0 @@
'use strict';
const path = require('path');
// This is a custom Jest transformer turning file imports into filenames.
// http://facebook.github.io/jest/docs/en/webpack.html
module.exports = {
process(src, filename) {
return `module.exports = ${JSON.stringify(path.basename(filename))};`;
},
};

View File

@@ -1,55 +0,0 @@
'use strict';
const path = require('path');
const fs = require('fs');
const url = require('url');
// Make sure any symlinks in the project folder are resolved:
// https://github.com/facebookincubator/create-react-app/issues/637
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
const envPublicUrl = process.env.PUBLIC_URL;
function ensureSlash(path, needsSlash) {
const hasSlash = path.endsWith('/');
if (hasSlash && !needsSlash) {
return path.substr(path, path.length - 1);
} else if (!hasSlash && needsSlash) {
return `${path}/`;
} else {
return path;
}
}
const getPublicUrl = appPackageJson =>
envPublicUrl || require(appPackageJson).homepage;
// We use `PUBLIC_URL` environment variable or "homepage" field to infer
// "public path" at which the app is served.
// Webpack needs to know it to put the right <script> hrefs into HTML even in
// single-page apps that may serve index.html for nested URLs like /todos/42.
// We can't use a relative path in HTML because we don't want to load something
// like /todos/42/static/js/bundle.7289d.js. We have to know the root.
function getServedPath(appPackageJson) {
const publicUrl = getPublicUrl(appPackageJson);
const servedUrl =
envPublicUrl || (publicUrl ? url.parse(publicUrl).pathname : '/');
return ensureSlash(servedUrl, true);
}
// config after eject: we're in ./config/
module.exports = {
dotenv: resolveApp('.env'),
appBuild: resolveApp('build'),
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appIndexJs: resolveApp('src/index.js'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src'),
yarnLockFile: resolveApp('yarn.lock'),
testsSetup: resolveApp('src/setupTests.js'),
appNodeModules: resolveApp('node_modules'),
publicUrl: getPublicUrl(resolveApp('package.json')),
servedPath: getServedPath(resolveApp('package.json')),
};

View File

@@ -1,22 +0,0 @@
'use strict';
if (typeof Promise === 'undefined') {
// Rejection tracking prevents a common issue where React gets into an
// inconsistent state due to an error, but it gets swallowed by a Promise,
// and the user has no idea what causes React's erratic future behavior.
require('promise/lib/rejection-tracking').enable();
window.Promise = require('promise/lib/es6-extensions.js');
}
// fetch() polyfill for making API calls.
require('whatwg-fetch');
// Object.assign() is commonly used with React.
// It will use the native implementation if it's present and isn't buggy.
Object.assign = require('object-assign');
// In tests, polyfill requestAnimationFrame since jsdom doesn't provide it yet.
// We don't polyfill it in the browser--this is user's responsibility.
if (process.env.NODE_ENV === 'test') {
require('raf').polyfill(global);
}

View File

@@ -1,251 +0,0 @@
'use strict';
const browserPlugin = require('webpack-browser-plugin');
const chromeUserDataDir = './chrome_data';
const autoprefixer = require('autoprefixer');
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
const eslintFormatter = require('react-dev-utils/eslintFormatter');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const getClientEnvironment = require('./env');
const paths = require('./paths');
// Webpack uses `publicPath` to determine where the app is being served from.
// In development, we always serve from the root. This makes config easier.
const publicPath = '/';
// `publicUrl` is just like `publicPath`, but we will provide it to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing slash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz.
const publicUrl = '';
// Get environment variables to inject into our app.
const env = getClientEnvironment(publicUrl);
// This is the development configuration.
// It is focused on developer experience and fast rebuilds.
// The production configuration is different and lives in a separate file.
module.exports = {
// You may want 'eval' instead if you prefer to see the compiled output in DevTools.
// See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.
devtool: 'cheap-module-source-map',
// These are the "entry points" to our application.
// This means they will be the "root" imports that are included in JS bundle.
// The first two entry points enable "hot" CSS and auto-refreshes for JS.
entry: [
// We ship a few polyfills by default:
require.resolve('./polyfills'),
// Include an alternative client for WebpackDevServer. A client's job is to
// connect to WebpackDevServer by a socket and get notified about changes.
// When you save a file, the client will either apply hot updates (in case
// of CSS changes), or refresh the page (in case of JS changes). When you
// make a syntax error, this client will display a syntax error overlay.
// Note: instead of the default WebpackDevServer client, we use a custom one
// to bring better experience for Create React App users. You can replace
// the line below with these two lines if you prefer the stock client:
// require.resolve('webpack-dev-server/client') + '?/',
// require.resolve('webpack/hot/dev-server'),
require.resolve('react-dev-utils/webpackHotDevClient'),
// Finally, this is your app's code:
paths.appIndexJs,
// We include the app code last so that if there is a runtime error during
// initialization, it doesn't blow up the WebpackDevServer client, and
// changing JS code would still trigger a refresh.
],
output: {
// Add /* filename */ comments to generated require()s in the output.
pathinfo: true,
// This does not produce a real file. It's just the virtual path that is
// served by WebpackDevServer in development. This is the JS bundle
// containing code from all our entry points, and the Webpack runtime.
filename: 'static/js/bundle.js',
// There are also additional JS chunk files if you use code splitting.
chunkFilename: 'static/js/[name].chunk.js',
// This is the URL that app is served from. We use "/" in development.
publicPath: publicPath,
// Point sourcemap entries to original disk location (format as URL on Windows)
devtoolModuleFilenameTemplate: info =>
path.resolve(info.absoluteResourcePath).replace(/\\/g, '/'),
},
resolve: {
// This allows you to set a fallback for where Webpack should look for modules.
// We placed these paths second because we want `node_modules` to "win"
// if there are any conflicts. This matches Node resolution mechanism.
// https://github.com/facebookincubator/create-react-app/issues/253
modules: ['node_modules', paths.appNodeModules].concat(
// It is guaranteed to exist because we tweak it in `env.js`
process.env.NODE_PATH.split(path.delimiter).filter(Boolean)
),
// These are the reasonable defaults supported by the Node ecosystem.
// We also include JSX as a common component filename extension to support
// some tools, although we do not recommend using it, see:
// https://github.com/facebookincubator/create-react-app/issues/290
// `web` extension prefixes have been added for better support
// for React Native Web.
extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx'],
alias: {
// Support React Native Web
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
'react-native': 'react-native-web',
},
plugins: [
// Prevents users from importing files from outside of src/ (or node_modules/).
// This often causes confusion because we only process files within src/ with babel.
// To fix this, we prevent you from importing files out of src/ -- if you'd like to,
// please link the files into your node_modules/ and let module-resolution kick in.
// Make sure your source files are compiled, as they will not be processed in any way.
new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]),
],
},
module: {
strictExportPresence: true,
rules: [
// TODO: Disable require.ensure as it's not a standard language feature.
// We are waiting for https://github.com/facebookincubator/create-react-app/issues/2176.
// { parser: { requireEnsure: false } },
// First, run the linter.
// It's important to do this before Babel processes the JS.
{
test: /\.(js|jsx|mjs)$/,
enforce: 'pre',
use: [
{
options: {
formatter: eslintFormatter,
eslintPath: require.resolve('eslint'),
},
loader: require.resolve('eslint-loader'),
},
],
include: paths.appSrc,
},
{
// "oneOf" will traverse all following loaders until one will
// match the requirements. When no loader matches it will fall
// back to the "file" loader at the end of the loader list.
oneOf: [
// "url" loader works like "file" loader except that it embeds assets
// smaller than specified limit in bytes as data URLs to avoid requests.
// A missing `test` is equivalent to a match.
{
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
loader: require.resolve('url-loader'),
options: {
limit: 10000,
name: 'static/media/[name].[hash:8].[ext]',
},
},
// Process JS with Babel.
{
test: /\.(js|jsx|mjs)$/,
include: paths.appSrc,
loader: require.resolve('babel-loader'),
options: {
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
// directory for faster rebuilds.
cacheDirectory: true,
},
},
// "postcss" loader applies autoprefixer to our CSS.
// "css" loader resolves paths in CSS and adds assets as dependencies.
// "style" loader turns CSS into JS modules that inject <style> tags.
// In production, we use a plugin to extract that CSS to a file, but
// in development "style" loader enables hot editing of CSS.
{
test: /\.css$/,
loaders: [
'style-loader?sourceMap',
'css-loader?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]'
]
},
// "file" loader makes sure those assets get served by WebpackDevServer.
// When you `import` an asset, you get its (virtual) filename.
// In production, they would get copied to the `build` folder.
// This loader doesn't use a "test" so it will catch all modules
// that fall through the other loaders.
{
// Exclude `js` files to keep "css" loader working as it injects
// its runtime that would otherwise processed through "file" loader.
// Also exclude `html` and `json` extensions so they get processed
// by webpacks internal loaders.
exclude: [/\.(js|jsx|mjs)$/, /\.html$/, /\.json$/],
loader: require.resolve('file-loader'),
options: {
name: 'static/media/[name].[hash:8].[ext]',
},
},
],
},
// ** STOP ** Are you adding a new loader?
// Make sure to add the new loader(s) before the "file" loader.
],
},
plugins: [
// Makes some environment variables available in index.html.
// The public URL is available as %PUBLIC_URL% in index.html, e.g.:
// <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
// In development, this will be an empty string.
new InterpolateHtmlPlugin(env.raw),
// Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin({
inject: true,
template: paths.appHtml,
}),
// Add module names to factory functions so they appear in browser profiler.
new webpack.NamedModulesPlugin(),
// Makes some environment variables available to the JS code, for example:
// if (process.env.NODE_ENV === 'development') { ... }. See `./env.js`.
new webpack.DefinePlugin(env.stringified),
// This is necessary to emit hot updates (currently CSS only):
new webpack.HotModuleReplacementPlugin(),
// Watcher doesn't work well if you mistype casing in a path so we use
// a plugin that prints an error when you attempt to do this.
// See https://github.com/facebookincubator/create-react-app/issues/240
new CaseSensitivePathsPlugin(),
// If you require a missing module and then `npm install` it, you still have
// to restart the development server for Webpack to discover it. This plugin
// makes the discovery automatic so you don't have to restart.
// See https://github.com/facebookincubator/create-react-app/issues/186
new WatchMissingNodeModulesPlugin(paths.appNodeModules),
// Moment.js is an extremely popular library that bundles large locale files
// by default due to how Webpack interprets its code. This is a practical
// solution that requires the user to opt into importing specific locales.
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
// You can remove this if you don't use Moment.js:
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new browserPlugin({
url: 'http://localhost',
port: 3000,
openOptions: {
app: [
process.platform === 'win32' ? 'chrome' : process.platform === 'darwin' ? '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' : 'google-chrome-stable',
'--disable-web-security',
'--user-data-dir=' + path.resolve(chromeUserDataDir)
]
}
})
],
// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.
node: {
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty',
},
// Turn off performance hints during development because we don't do any
// splitting or minification in interest of speed. These warnings become
// cumbersome.
performance: {
hints: false,
}
};

View File

@@ -1,291 +0,0 @@
'use strict';
const autoprefixer = require('autoprefixer');
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
const eslintFormatter = require('react-dev-utils/eslintFormatter');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const paths = require('./paths');
const getClientEnvironment = require('./env');
// Webpack uses `publicPath` to determine where the app is being served from.
// It requires a trailing slash, or the file assets will get an incorrect path.
const publicPath = paths.servedPath;
// Some apps do not use client-side routing with pushState.
// For these, "homepage" can be set to "." to enable relative asset paths.
const shouldUseRelativeAssetPaths = publicPath === './';
// Source maps are resource heavy and can cause out of memory issue for large source files.
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
// `publicUrl` is just like `publicPath`, but we will provide it to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
const publicUrl = publicPath.slice(0, -1);
// Get environment variables to inject into our app.
const env = getClientEnvironment(publicUrl);
// Assert this just to be safe.
// Development builds of React are slow and not intended for production.
if (env.stringified['process.env'].NODE_ENV !== '"production"') {
throw new Error('Production builds must have NODE_ENV=production.');
}
// This is the production configuration.
// It compiles slowly and is focused on producing a fast and minimal bundle.
// The development configuration is different and lives in a separate file.
module.exports = {
// Don't attempt to continue if there are any errors.
bail: true,
// We generate sourcemaps in production. This is slow but gives good results.
// You can exclude the *.map files from the build during deployment.
devtool: shouldUseSourceMap ? 'source-map' : false,
// In production, we only want to load the polyfills and the app code.
entry: [require.resolve('./polyfills'), paths.appIndexJs],
output: {
// The build folder.
path: paths.appBuild,
// Generated JS file names (with nested folders).
// There will be one main bundle, and one file per asynchronous chunk.
// We don't currently advertise code splitting but Webpack supports it.
filename: 'static/js/[name].[chunkhash:8].js',
chunkFilename: 'static/js/[name].[chunkhash:8].chunk.js',
// We inferred the "public path" (such as / or /my-project) from homepage.
publicPath: publicPath,
// Point sourcemap entries to original disk location (format as URL on Windows)
devtoolModuleFilenameTemplate: info =>
path
.relative(paths.appSrc, info.absoluteResourcePath)
.replace(/\\/g, '/'),
},
resolve: {
// This allows you to set a fallback for where Webpack should look for modules.
// We placed these paths second because we want `node_modules` to "win"
// if there are any conflicts. This matches Node resolution mechanism.
// https://github.com/facebookincubator/create-react-app/issues/253
modules: ['node_modules', paths.appNodeModules].concat(
// It is guaranteed to exist because we tweak it in `env.js`
process.env.NODE_PATH.split(path.delimiter).filter(Boolean)
),
// These are the reasonable defaults supported by the Node ecosystem.
// We also include JSX as a common component filename extension to support
// some tools, although we do not recommend using it, see:
// https://github.com/facebookincubator/create-react-app/issues/290
// `web` extension prefixes have been added for better support
// for React Native Web.
extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx'],
alias: {
// Support React Native Web
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
'react-native': 'react-native-web',
},
plugins: [
// Prevents users from importing files from outside of src/ (or node_modules/).
// This often causes confusion because we only process files within src/ with babel.
// To fix this, we prevent you from importing files out of src/ -- if you'd like to,
// please link the files into your node_modules/ and let module-resolution kick in.
// Make sure your source files are compiled, as they will not be processed in any way.
new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]),
],
},
module: {
strictExportPresence: true,
rules: [
// TODO: Disable require.ensure as it's not a standard language feature.
// We are waiting for https://github.com/facebookincubator/create-react-app/issues/2176.
// { parser: { requireEnsure: false } },
// First, run the linter.
// It's important to do this before Babel processes the JS.
{
test: /\.(js|jsx|mjs)$/,
enforce: 'pre',
use: [
{
options: {
formatter: eslintFormatter,
eslintPath: require.resolve('eslint'),
},
loader: require.resolve('eslint-loader'),
},
],
include: paths.appSrc,
},
{
// "oneOf" will traverse all following loaders until one will
// match the requirements. When no loader matches it will fall
// back to the "file" loader at the end of the loader list.
oneOf: [
// "url" loader works just like "file" loader but it also embeds
// assets smaller than specified size as data URLs to avoid requests.
{
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
loader: require.resolve('url-loader'),
options: {
limit: 10000,
name: 'static/media/[name].[hash:8].[ext]',
},
},
// Process JS with Babel.
{
test: /\.(js|jsx|mjs)$/,
include: paths.appSrc,
loader: require.resolve('babel-loader'),
options: {
compact: true,
},
},
// The notation here is somewhat confusing.
// "postcss" loader applies autoprefixer to our CSS.
// "css" loader resolves paths in CSS and adds assets as dependencies.
// "style" loader normally turns CSS into JS modules injecting <style>,
// but unlike in development configuration, we do something different.
// `ExtractTextPlugin` first applies the "postcss" and "css" loaders
// (second argument), then grabs the result CSS and puts it into a
// separate file in our build process. This way we actually ship
// a single CSS file in production instead of JS code injecting <style>
// tags. If you use code splitting, however, any async bundles will still
// use the "style" loader inside the async code so CSS from them won't be
// in the main CSS file.
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader?modules,localIdentName="[name]-[local]-[hash:base64:6]"'
}),
},
// "file" loader makes sure assets end up in the `build` folder.
// When you `import` an asset, you get its filename.
// This loader doesn't use a "test" so it will catch all modules
// that fall through the other loaders.
{
loader: require.resolve('file-loader'),
// Exclude `js` files to keep "css" loader working as it injects
// it's runtime that would otherwise processed through "file" loader.
// Also exclude `html` and `json` extensions so they get processed
// by webpacks internal loaders.
exclude: [/\.(js|jsx|mjs)$/, /\.html$/, /\.json$/],
options: {
name: 'static/media/[name].[hash:8].[ext]',
},
},
// ** STOP ** Are you adding a new loader?
// Make sure to add the new loader(s) before the "file" loader.
],
},
],
},
plugins: [
// Makes some environment variables available in index.html.
// The public URL is available as %PUBLIC_URL% in index.html, e.g.:
// <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
// In production, it will be an empty string unless you specify "homepage"
// in `package.json`, in which case it will be the pathname of that URL.
new InterpolateHtmlPlugin(env.raw),
// Generates an `index.html` file with the <script> injected.
new HtmlWebpackPlugin({
inject: true,
template: paths.appHtml,
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
},
}),
// Makes some environment variables available to the JS code, for example:
// if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
// It is absolutely essential that NODE_ENV was set to production here.
// Otherwise React will be compiled in the very slow development mode.
new webpack.DefinePlugin(env.stringified),
// Minify the code.
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
// Disabled because of an issue with Uglify breaking seemingly valid code:
// https://github.com/facebookincubator/create-react-app/issues/2376
// Pending further investigation:
// https://github.com/mishoo/UglifyJS2/issues/2011
comparisons: false,
},
mangle: {
safari10: true,
},
output: {
comments: false,
// Turned on because emoji and regex is not minified properly using default
// https://github.com/facebookincubator/create-react-app/issues/2488
ascii_only: true,
},
sourceMap: shouldUseSourceMap,
}),
// Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`.
new ExtractTextPlugin({
filename: 'app.css',
allChunks: true
}),
// Generate a manifest file which contains a mapping of all asset filenames
// to their corresponding output file so that tools can pick it up without
// having to parse `index.html`.
new ManifestPlugin({
fileName: 'asset-manifest.json',
}),
// Generate a service worker script that will precache, and keep up to date,
// the HTML & assets that are part of the Webpack build.
new SWPrecacheWebpackPlugin({
// By default, a cache-busting query parameter is appended to requests
// used to populate the caches, to ensure the responses are fresh.
// If a URL is already hashed by Webpack, then there is no concern
// about it being stale, and the cache-busting can be skipped.
dontCacheBustUrlsMatching: /\.\w{8}\./,
filename: 'service-worker.js',
logger(message) {
if (message.indexOf('Total precache size is') === 0) {
// This message occurs for every build and is a bit too noisy.
return;
}
if (message.indexOf('Skipping static resource') === 0) {
// This message obscures real errors so we ignore it.
// https://github.com/facebookincubator/create-react-app/issues/2612
return;
}
console.log(message);
},
minify: true,
// For unknown URLs, fallback to the index page
navigateFallback: publicUrl + '/index.html',
// Ignores URLs starting from /__ (useful for Firebase):
// https://github.com/facebookincubator/create-react-app/issues/2237#issuecomment-302693219
navigateFallbackWhitelist: [/^(?!\/__).*/],
// Don't precache sourcemaps (they're large) and build asset manifest:
staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/],
}),
// Moment.js is an extremely popular library that bundles large locale files
// by default due to how Webpack interprets its code. This is a practical
// solution that requires the user to opt into importing specific locales.
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
// You can remove this if you don't use Moment.js:
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
],
// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.
node: {
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty',
},
};

View File

@@ -1,95 +0,0 @@
'use strict';
const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
const ignoredFiles = require('react-dev-utils/ignoredFiles');
const config = require('./webpack.config.dev');
const paths = require('./paths');
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
const host = process.env.HOST || '0.0.0.0';
module.exports = function(proxy, allowedHost) {
return {
// WebpackDevServer 2.4.3 introduced a security fix that prevents remote
// websites from potentially accessing local content through DNS rebinding:
// https://github.com/webpack/webpack-dev-server/issues/887
// https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
// However, it made several existing use cases such as development in cloud
// environment or subdomains in development significantly more complicated:
// https://github.com/facebookincubator/create-react-app/issues/2271
// https://github.com/facebookincubator/create-react-app/issues/2233
// While we're investigating better solutions, for now we will take a
// compromise. Since our WDS configuration only serves files in the `public`
// folder we won't consider accessing them a vulnerability. However, if you
// use the `proxy` feature, it gets more dangerous because it can expose
// remote code execution vulnerabilities in backends like Django and Rails.
// So we will disable the host check normally, but enable it if you have
// specified the `proxy` setting. Finally, we let you override it if you
// really know what you're doing with a special environment variable.
disableHostCheck:
!proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true',
// 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',
// By default WebpackDevServer serves physical files from current directory
// in addition to all the virtual build products that it serves from memory.
// This is confusing because those files wont automatically be available in
// production build folder unless we copy them. However, copying the whole
// project directory is dangerous because we may expose sensitive files.
// Instead, we establish a convention that only files in `public` directory
// get served. Our build script will copy `public` into the `build` folder.
// In `index.html`, you can get URL of `public` folder with %PUBLIC_URL%:
// <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
// In JavaScript code, you can access it with `process.env.PUBLIC_URL`.
// Note that we only recommend to use `public` folder as an escape hatch
// for files like `favicon.ico`, `manifest.json`, and libraries that are
// for some reason broken when imported through Webpack. If you just want to
// use an image, put it in `src` and `import` it from JavaScript instead.
contentBase: paths.appPublic,
// By default files from `contentBase` will not trigger a page reload.
watchContentBase: true,
// Enable hot reloading server. It will provide /sockjs-node/ endpoint
// for the WebpackDevServer client so it can learn when the files were
// updated. The WebpackDevServer client is included as an entry point
// in the Webpack development configuration. Note that only changes
// to CSS are currently hot reloaded. JS changes will refresh the browser.
hot: true,
// It is important to tell WebpackDevServer to use the same "root" path
// as we specified in the config. In development, we always serve from /.
publicPath: config.output.publicPath,
// WebpackDevServer is noisy by default so we emit custom message instead
// by listening to the compiler events with `compiler.plugin` calls above.
quiet: true,
// Reportedly, this avoids CPU overload on some systems.
// https://github.com/facebookincubator/create-react-app/issues/293
// src/node_modules is not ignored to support absolute imports
// https://github.com/facebookincubator/create-react-app/issues/1065
watchOptions: {
ignored: ignoredFiles(paths.appSrc),
},
// Enable HTTPS if the HTTPS environment variable is set to 'true'
https: protocol === 'https',
host: host,
overlay: false,
historyApiFallback: {
// Paths with dots should still use the history fallback.
// See https://github.com/facebookincubator/create-react-app/issues/387.
disableDotRule: true,
},
public: allowedHost,
proxy,
before(app) {
// This lets us open files from the runtime error overlay.
app.use(errorOverlayMiddleware());
// This service worker file is effectively a 'no-op' that will reset any
// previous service worker registered for the same host:port combination.
// We do this in development to avoid hitting the production cache if
// it used the same host and port.
// https://github.com/facebookincubator/create-react-app/issues/2272#issuecomment-302832432
app.use(noopServiceWorkerMiddleware());
},
};
};

View File

@@ -4,69 +4,37 @@
"private": true, "private": true,
"author": "scott.e.graves@gmail.com", "author": "scott.e.graves@gmail.com",
"description": "GUI for Repertory - Repertory allows you to mount Hyperspace, Sia and/or SiaPrime blockchain storage solutions via FUSE on Linux/OS X or via WinFSP on Windows.", "description": "GUI for Repertory - Repertory allows you to mount Hyperspace, Sia and/or SiaPrime blockchain storage solutions via FUSE on Linux/OS X or via WinFSP on Windows.",
"license": "MIT",
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.10", "@fortawesome/fontawesome-svg-core": "^1.2.10",
"@fortawesome/free-solid-svg-icons": "^5.6.1", "@fortawesome/free-solid-svg-icons": "^5.6.1",
"@fortawesome/react-fontawesome": "^0.1.0", "@fortawesome/react-fontawesome": "^0.1.0",
"auto-launch": "^5.0.5", "auto-launch": "^5.0.5",
"autoprefixer": "7.1.6",
"axios": "^0.18.0", "axios": "^0.18.0",
"babel-core": "6.26.0", "electron-debug": "^2.2.0",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "7.1.2",
"babel-preset-react-app": "^3.1.1",
"babel-runtime": "6.26.0",
"case-sensitive-paths-webpack-plugin": "2.1.1",
"chalk": "1.1.3",
"color": "^3.1.0",
"color-string": "^1.5.2",
"css-loader": "0.28.7",
"dotenv": "4.0.0",
"dotenv-expand": "4.2.0",
"electron-debug": "^2.1.0",
"eslint": "4.10.0",
"eslint-config-react-app": "^2.1.0",
"eslint-loader": "1.9.0",
"eslint-plugin-flowtype": "2.39.1",
"eslint-plugin-import": "2.8.0",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "7.4.0",
"file-loader": "1.1.5",
"font-awesome": "^4.7.0", "font-awesome": "^4.7.0",
"fs-extra": "3.0.1",
"html-webpack-plugin": "2.29.0",
"jest": "20.0.4",
"node-schedule": "^1.3.1", "node-schedule": "^1.3.1",
"npm": "^6.6.0", "react": "^16.8.6",
"object-assign": "4.1.1", "react-dom": "^16.8.6",
"postcss-flexbugs-fixes": "3.2.0",
"postcss-loader": "2.0.8",
"promise": "8.0.1",
"raf": "3.4.0",
"react": "^16.6.1",
"react-css-modules": "^4.7.8",
"react-dev-utils": "^5.0.3",
"react-dom": "^16.6.1",
"react-loader-spinner": "^2.3.0", "react-loader-spinner": "^2.3.0",
"react-scripts": "2.1.8",
"react-tooltip": "^3.9.0", "react-tooltip": "^3.9.0",
"resolve": "1.6.0",
"style-loader": "0.19.0",
"sw-precache-webpack-plugin": "0.11.4",
"unzipper": "^0.9.6", "unzipper": "^0.9.6",
"url-loader": "0.6.2",
"webpack": "3.8.1",
"webpack-dev-server": "2.9.4",
"webpack-manifest-plugin": "1.3.2",
"whatwg-fetch": "2.0.3",
"winreg": "^1.2.4" "winreg": "^1.2.4"
}, },
"devDependencies": {
"cross-env": "^5.2.0",
"electron": "^4.1.0",
"electron-builder": "^20.38.5",
"extract-text-webpack-plugin": "^3.0.2",
"typescript": "^3.4.2",
"webpack-browser-plugin": "^1.0.20"
},
"scripts": { "scripts": {
"start": "node scripts/start.js", "start": "react-scripts start",
"build": "node scripts/build.js", "build": "react-scripts build",
"test": "node scripts/test.js --env=jsdom", "test": "react-scripts test",
"electron-dev": "cross-env ELECTRON_START_URL=http://localhost:3000 electron %NODE_DEBUG_OPTION% .", "eject": "react-scripts eject",
"electron-dev": "cross-env ELECTRON_START_URL=http://localhost:3000 electron .",
"electron-dev-unix": "cross-env ELECTRON_START_URL=http://localhost:3000 electron $NODE_DEBUG_OPTION .", "electron-dev-unix": "cross-env ELECTRON_START_URL=http://localhost:3000 electron $NODE_DEBUG_OPTION .",
"pack": "npm run build && electron-builder --dir --x64", "pack": "npm run build && electron-builder --dir --x64",
"dist": "npm run build && electron-builder --x64", "dist": "npm run build && electron-builder --x64",
@@ -76,55 +44,15 @@
"dist-win": "npm run build && electron-builder --x64 --win", "dist-win": "npm run build && electron-builder --x64 --win",
"postinstall": "electron-builder install-app-deps" "postinstall": "electron-builder install-app-deps"
}, },
"devDependencies": {
"cross-env": "^5.2.0",
"electron": "^4.1.0",
"electron-builder": "^20.38.5",
"extract-text-webpack-plugin": "^3.0.2",
"webpack-browser-plugin": "^1.0.20"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx,mjs}"
],
"setupFiles": [
"<rootDir>/config/polyfills.js"
],
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.{js,jsx,mjs}",
"<rootDir>/src/**/?(*.)(spec|test).{js,jsx,mjs}"
],
"testEnvironment": "node",
"testURL": "http://localhost",
"transform": {
"^.+\\.(js|jsx|mjs)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|mjs|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$"
],
"moduleNameMapper": {
"^react-native$": "react-native-web"
},
"moduleFileExtensions": [
"web.js",
"js",
"json",
"web.jsx",
"jsx",
"node",
"mjs"
]
},
"babel": {
"presets": [
"react-app"
]
},
"eslintConfig": { "eslintConfig": {
"extends": "react-app" "extends": "react-app"
}, },
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"main": "electron.js", "main": "electron.js",
"homepage": "./", "homepage": "./",
"build": { "build": {

View File

@@ -1,150 +0,0 @@
'use strict';
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'production';
process.env.NODE_ENV = 'production';
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
throw err;
});
// Ensure environment variables are read.
require('../config/env');
const path = require('path');
const chalk = require('chalk');
const fs = require('fs-extra');
const webpack = require('webpack');
const config = require('../config/webpack.config.prod');
const paths = require('../config/paths');
const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
const printHostingInstructions = require('react-dev-utils/printHostingInstructions');
const FileSizeReporter = require('react-dev-utils/FileSizeReporter');
const printBuildError = require('react-dev-utils/printBuildError');
const measureFileSizesBeforeBuild =
FileSizeReporter.measureFileSizesBeforeBuild;
const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild;
const useYarn = fs.existsSync(paths.yarnLockFile);
// These sizes are pretty large. We'll warn for bundles exceeding them.
const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;
const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024;
// Warn and crash if required files are missing
if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
process.exit(1);
}
// First, read the current file sizes in build directory.
// This lets us display how much they changed later.
measureFileSizesBeforeBuild(paths.appBuild)
.then(previousFileSizes => {
// Remove all content but keep the directory so that
// if you're in it, you don't end up in Trash
fs.emptyDirSync(paths.appBuild);
// Merge with the public folder
copyPublicFolder();
// Start the webpack build
return build(previousFileSizes);
})
.then(
({ stats, previousFileSizes, warnings }) => {
if (warnings.length) {
console.log(chalk.yellow('Compiled with warnings.\n'));
console.log(warnings.join('\n\n'));
console.log(
'\nSearch for the ' +
chalk.underline(chalk.yellow('keywords')) +
' to learn more about each warning.'
);
console.log(
'To ignore, add ' +
chalk.cyan('// eslint-disable-next-line') +
' to the line before.\n'
);
} else {
console.log(chalk.green('Compiled successfully.\n'));
}
console.log('File sizes after gzip:\n');
printFileSizesAfterBuild(
stats,
previousFileSizes,
paths.appBuild,
WARN_AFTER_BUNDLE_GZIP_SIZE,
WARN_AFTER_CHUNK_GZIP_SIZE
);
console.log();
const appPackage = require(paths.appPackageJson);
const publicUrl = paths.publicUrl;
const publicPath = config.output.publicPath;
const buildFolder = path.relative(process.cwd(), paths.appBuild);
printHostingInstructions(
appPackage,
publicUrl,
publicPath,
buildFolder,
useYarn
);
},
err => {
console.log(chalk.red('Failed to compile.\n'));
printBuildError(err);
process.exit(1);
}
);
// Create the production build and print the deployment instructions.
function build(previousFileSizes) {
console.log('Creating an optimized production build...');
let compiler = webpack(config);
return new Promise((resolve, reject) => {
compiler.run((err, stats) => {
if (err) {
return reject(err);
}
const messages = formatWebpackMessages(stats.toJson({}, true));
if (messages.errors.length) {
// Only keep the first error. Others are often indicative
// of the same problem, but confuse the reader with noise.
if (messages.errors.length > 1) {
messages.errors.length = 1;
}
return reject(new Error(messages.errors.join('\n\n')));
}
if (
process.env.CI &&
(typeof process.env.CI !== 'string' ||
process.env.CI.toLowerCase() !== 'false') &&
messages.warnings.length
) {
console.log(
chalk.yellow(
'\nTreating warnings as errors because process.env.CI = true.\n' +
'Most CI servers set it automatically.\n'
)
);
return reject(new Error(messages.warnings.join('\n\n')));
}
return resolve({
stats,
previousFileSizes,
warnings: messages.warnings,
});
});
});
}
function copyPublicFolder() {
fs.copySync(paths.appPublic, paths.appBuild, {
dereference: true,
filter: file => file !== paths.appHtml,
});
}

View File

@@ -1,107 +0,0 @@
'use strict';
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'development';
process.env.NODE_ENV = 'development';
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
throw err;
});
// Ensure environment variables are read.
require('../config/env');
const fs = require('fs');
const chalk = require('chalk');
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const clearConsole = require('react-dev-utils/clearConsole');
const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
const {
choosePort,
createCompiler,
prepareProxy,
prepareUrls,
} = require('react-dev-utils/WebpackDevServerUtils');
const openBrowser = require('react-dev-utils/openBrowser');
const paths = require('../config/paths');
const config = require('../config/webpack.config.dev');
const createDevServerConfig = require('../config/webpackDevServer.config');
const useYarn = fs.existsSync(paths.yarnLockFile);
const isInteractive = process.stdout.isTTY;
// Warn and crash if required files are missing
if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
process.exit(1);
}
// Tools like Cloud9 rely on this.
const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000;
const HOST = process.env.HOST || '0.0.0.0';
if (process.env.HOST) {
console.log(
chalk.cyan(
`Attempting to bind to HOST environment variable: ${chalk.yellow(
chalk.bold(process.env.HOST)
)}`
)
);
console.log(
`If this was unintentional, check that you haven't mistakenly set it in your shell.`
);
console.log(`Learn more here: ${chalk.yellow('http://bit.ly/2mwWSwH')}`);
console.log();
}
// We attempt to use the default port but if it is busy, we offer the user to
// run on a different port. `choosePort()` Promise resolves to the next free port.
choosePort(HOST, DEFAULT_PORT)
.then(port => {
if (port == null) {
// We have not found a port.
return;
}
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
const appName = require(paths.appPackageJson).name;
const urls = prepareUrls(protocol, HOST, port);
// Create a webpack compiler that is configured with custom messages.
const compiler = createCompiler(webpack, config, appName, urls, useYarn);
// Load proxy config
const proxySetting = require(paths.appPackageJson).proxy;
const proxyConfig = prepareProxy(proxySetting, paths.appPublic);
// Serve webpack assets generated by the compiler over a web sever.
const serverConfig = createDevServerConfig(
proxyConfig,
urls.lanUrlForConfig
);
const devServer = new WebpackDevServer(compiler, serverConfig);
// Launch WebpackDevServer.
devServer.listen(port, HOST, err => {
if (err) {
return console.log(err);
}
if (isInteractive) {
clearConsole();
}
console.log(chalk.cyan('Starting the development server...\n'));
//openBrowser(urls.localUrlForBrowser);
});
['SIGINT', 'SIGTERM'].forEach(function(sig) {
process.on(sig, function() {
devServer.close();
process.exit();
});
});
})
.catch(err => {
if (err && err.message) {
console.log(err.message);
}
process.exit(1);
});

View File

@@ -1,27 +0,0 @@
'use strict';
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'test';
process.env.NODE_ENV = 'test';
process.env.PUBLIC_URL = '';
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
throw err;
});
// Ensure environment variables are read.
require('../config/env');
const jest = require('jest');
let argv = process.argv.slice(2);
// Watch unless on CI or in coverage mode
if (!process.env.CI && argv.indexOf('--coverage') < 0) {
argv.push('--watch');
}
jest.run(argv);

View File

@@ -10,7 +10,7 @@
background-size: cover; background-size: cover;
} }
.Container { .AppContainer {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%; width: 100%;
@@ -18,13 +18,13 @@
box-sizing: border-box; box-sizing: border-box;
} }
.Header { .AppHeader {
height: 28px; height: 28px;
margin-bottom: 8px; margin-bottom: 8px;
box-sizing: border-box; box-sizing: border-box;
} }
.Content { .AppContent {
flex: 1; flex: 1;
box-sizing: border-box; box-sizing: border-box;
} }

View File

@@ -1,9 +1,8 @@
import React from 'react'; import React from 'react';
import axios from 'axios'; import axios from 'axios';
import styles from './App.css'; import './App.css';
import Box from './components/UI/Box/Box'; import Box from './components/UI/Box/Box';
import Configuration from './containers/Configuration/Configuration'; import Configuration from './containers/Configuration/Configuration';
import CSSModules from 'react-css-modules';
import DependencyList from './components/DependencyList/DependencyList'; import DependencyList from './components/DependencyList/DependencyList';
import DownloadProgress from './components/DownloadProgress/DownloadProgress'; import DownloadProgress from './components/DownloadProgress/DownloadProgress';
import ErrorDetails from './components/ErrorDetails/ErrorDetails'; import ErrorDetails from './components/ErrorDetails/ErrorDetails';
@@ -698,14 +697,14 @@ class App extends IPCContainer {
} }
return ( return (
<div styleName='App'> <div className={'App'}>
{errorDisplay} {errorDisplay}
{dependencyDisplay} {dependencyDisplay}
{upgradeDisplay} {upgradeDisplay}
{downloadDisplay} {downloadDisplay}
{configDisplay} {configDisplay}
<div styleName='Container'> <div className={'AppContainer'}>
<div styleName='Header'> <div className={'AppHeader'}>
<Box> <Box>
<Grid> <Grid>
<Text col={0} <Text col={0}
@@ -725,7 +724,7 @@ class App extends IPCContainer {
</Grid> </Grid>
</Box> </Box>
</div> </div>
<div styleName='Content'> <div className={'AppContent'}>
<Box dxStyle={{padding: '8px 8px 0px 8px'}}> <Box dxStyle={{padding: '8px 8px 0px 8px'}}>
{mainContent} {mainContent}
</Box> </Box>
@@ -736,4 +735,4 @@ class App extends IPCContainer {
} }
} }
export default CSSModules(App, styles, {allowMultiple: true}); export default App;

View File

@@ -3,7 +3,7 @@
padding: 0; padding: 0;
} }
input.Input { input.ConfigurationItemInput {
display: block; display: block;
margin: 0; margin: 0;
padding: 2px; padding: 2px;
@@ -16,7 +16,7 @@ input.Input {
box-sizing: border-box; box-sizing: border-box;
} }
.Select { .ConfigurationItemSelect {
display: block; display: block;
margin: 0; margin: 0;
padding: 2px; padding: 2px;
@@ -29,7 +29,7 @@ input.Input {
box-sizing: border-box; box-sizing: border-box;
} }
.Option { .ConfigurationItemOption {
background: rgba(10, 10, 15, 0.8); background: rgba(10, 10, 15, 0.8);
border-color: rgba(10, 10, 20, 0.9); border-color: rgba(10, 10, 20, 0.9);
color: var(--text_color); color: var(--text_color);

View File

@@ -1,8 +1,7 @@
import React from 'react'; import React from 'react';
import CSSModules from 'react-css-modules'; import './ConfigurationItem.css';
import styles from './ConfigurationItem.css';
export default CSSModules((props) => { export default props => {
const handleChanged = (e) => { const handleChanged = (e) => {
const target = e.target; const target = e.target;
if (target.type === 'checkbox') { if (target.type === 'checkbox') {
@@ -23,7 +22,7 @@ export default CSSModules((props) => {
data = <input min={0.0} data = <input min={0.0}
onChange={e=>handleChanged(e)} onChange={e=>handleChanged(e)}
step={"0.01"} step={"0.01"}
styleName='Input' className={'ConfigurationItemInput'}
type={'number'} type={'number'}
value={parseFloat(props.value).toFixed(2)}/>; value={parseFloat(props.value).toFixed(2)}/>;
break; break;
@@ -31,13 +30,13 @@ export default CSSModules((props) => {
case "list": case "list":
const options = props.items.map((s, i) => { const options = props.items.map((s, i) => {
return ( return (
<option styleName='Option' key={i} value={s}>{s}</option> <option className={'ConfigurationItemOption'} key={i} value={s}>{s}</option>
); );
}); });
data = ( data = (
<select onChange={e=>handleChanged(e)} <select onChange={e=>handleChanged(e)}
styleName='Select' className={'ConfigurationItemSelect'}
value={props.value}> value={props.value}>
{options} {options}
</select> </select>
@@ -46,7 +45,7 @@ export default CSSModules((props) => {
case "string": case "string":
data = <input onChange={e=>handleChanged(e)} data = <input onChange={e=>handleChanged(e)}
styleName='Input' className={'ConfigurationItemInput'}
type={'text'} type={'text'}
value={props.value}/>; value={props.value}/>;
break; break;
@@ -55,7 +54,7 @@ export default CSSModules((props) => {
data = <input max={255} data = <input max={255}
min={0} min={0}
onChange={e=>handleChanged(e)} onChange={e=>handleChanged(e)}
styleName='Input' className={'ConfigurationItemInput'}
type={'number'} type={'number'}
value={props.value}/>; value={props.value}/>;
break; break;
@@ -64,7 +63,7 @@ export default CSSModules((props) => {
data = <input max={65535} data = <input max={65535}
min={0} min={0}
onChange={e=>handleChanged(e)} onChange={e=>handleChanged(e)}
styleName='Input' className={'ConfigurationItemInput'}
type={'number'} type={'number'}
value={props.value}/>; value={props.value}/>;
break; break;
@@ -73,7 +72,7 @@ export default CSSModules((props) => {
data = <input max={4294967295} data = <input max={4294967295}
min={0} min={0}
onChange={e=>handleChanged(e)} onChange={e=>handleChanged(e)}
styleName='Input' className={'ConfigurationItemInput'}
type={'number'} type={'number'}
value={props.value}/>; value={props.value}/>;
break; break;
@@ -82,7 +81,7 @@ export default CSSModules((props) => {
data = <input max={18446744073709551615} data = <input max={18446744073709551615}
min={0} min={0}
onChange={e=>handleChanged(e)} onChange={e=>handleChanged(e)}
styleName='Input' className={'ConfigurationItemInput'}
type={'number'} type={'number'}
value={props.value}/>; value={props.value}/>;
break; break;
@@ -92,7 +91,7 @@ export default CSSModules((props) => {
} }
return ( return (
<div styleName='ConfigurationItem'> <div className={'ConfigurationItem'}>
<table cellPadding='2' <table cellPadding='2'
width='100%'> width='100%'>
<tbody> <tbody>
@@ -104,4 +103,4 @@ export default CSSModules((props) => {
</table> </table>
</div> </div>
); );
}, styles, {allowMultiple: true}); };

View File

@@ -4,6 +4,6 @@
width: 100%; width: 100%;
} }
.Link { .DependencyLink {
cursor: pointer; cursor: pointer;
} }

View File

@@ -1,10 +1,9 @@
import React from 'react'; import React from 'react';
import CSSModules from 'react-css-modules'; import './Dependency.css';
import styles from './Dependency.css';
export default CSSModules((props) => { export default props => {
return ( return (
<div styleName='Dependency'> <div className={'Dependency'}>
<table width="100%"> <table width="100%">
<tbody> <tbody>
<tr> <tr>
@@ -13,7 +12,7 @@ export default CSSModules((props) => {
</td> </td>
<td> <td>
{props.allowDownload ? {props.allowDownload ?
<a styleName='Link' href={void(0)} onClick={()=>{props.onDownload(props.download); return false;}}><u>Install</u></a> : <a href={void(0)} className={'DependencyLink'} onClick={()=>{props.onDownload(props.download); return false;}}><u>Install</u></a> :
'Installing...'} 'Installing...'}
</td> </td>
</tr> </tr>
@@ -21,5 +20,4 @@ export default CSSModules((props) => {
</table> </table>
</div> </div>
); );
};
}, styles, {allowMultiple: true});

View File

@@ -1,10 +1,9 @@
import React from 'react'; import React from 'react';
import CSSModules from 'react-css-modules'; import './DependencyList.css';
import styles from './DependencyList.css';
import Dependency from './Dependency/Dependency'; import Dependency from './Dependency/Dependency';
import Box from '../UI/Box/Box'; import Box from '../UI/Box/Box';
export default CSSModules((props) => { export default props => {
const items = props.dependencies.map((k, i)=> { const items = props.dependencies.map((k, i)=> {
return ( return (
<Dependency allowDownload={props.allowDownload} <Dependency allowDownload={props.allowDownload}
@@ -24,4 +23,4 @@ export default CSSModules((props) => {
</Box> </Box>
); );
}, styles, {allowMultiple: true}); };

View File

@@ -1,9 +1,8 @@
import Box from '../UI/Box/Box'; import Box from '../UI/Box/Box';
import React from 'react'; import React from 'react';
import CSSModules from 'react-css-modules'; import './DownloadProgress.css';
import styles from './DownloadProgress.css';
export default CSSModules((props) => { export default props => {
return ( return (
<Box dxStyle={{width: '380px', height: 'auto', padding: '5px'}}> <Box dxStyle={{width: '380px', height: 'auto', padding: '5px'}}>
@@ -14,4 +13,4 @@ export default CSSModules((props) => {
style={{width: '100%'}} style={{width: '100%'}}
value={props.progress}/> value={props.progress}/>
</Box>); </Box>);
}, styles, {allowMultiple: true}); };

View File

@@ -1,10 +1,10 @@
.Heading { .ErrorDetailsHeading {
color: var(--text_color_error); color: var(--text_color_error);
text-align: center; text-align: center;
margin-bottom: 4px; margin-bottom: 4px;
} }
.Content { .ErrorDetailsContent {
max-height: 60vh; max-height: 60vh;
overflow-y: auto; overflow-y: auto;
margin-bottom: 8px; margin-bottom: 8px;

View File

@@ -1,18 +1,16 @@
import React from 'react'; import React from 'react';
import Box from '../UI/Box/Box'; import Box from '../UI/Box/Box';
import Button from '../UI/Button/Button'; import Button from '../UI/Button/Button';
import CSSModules from 'react-css-modules'; import './ErrorDetails.css';
import styles from './ErrorDetails.css';
export default CSSModules((props) => { export default props => {
return ( return (
<Box dxStyle={{padding: '8px'}}> <Box dxStyle={{padding: '8px'}}>
<h1 styleName='Heading'>Application Error</h1> <h1 className={'ErrorDetailsHeading'}>Application Error</h1>
<div styleName='Content'> <div className={'ErrorDetailsContent'}>
<p>{props.error.toString()}</p> <p>{props.error.toString()}</p>
</div> </div>
<Button clicked={props.closed}>Dismiss</Button> <Button clicked={props.closed}>Dismiss</Button>
</Box> </Box>
); );
};
}, styles, {allowMultiple: true});

View File

@@ -1,4 +1,4 @@
input.Input { input.MountItemInput {
margin: 0; margin: 0;
padding: 3px; padding: 3px;
border-radius: var(--border_radius); border-radius: var(--border_radius);

View File

@@ -1,6 +1,5 @@
import React from 'react'; import React from 'react';
import CSSModules from 'react-css-modules'; import './MountItem.css';
import styles from './MountItem.css';
import DropDown from '../UI/DropDown/DropDown'; import DropDown from '../UI/DropDown/DropDown';
import Button from '../UI/Button/Button'; import Button from '../UI/Button/Button';
import Loader from 'react-loader-spinner'; import Loader from 'react-loader-spinner';
@@ -9,7 +8,7 @@ import Grid from '../UI/Grid/Grid';
import configureImage from '../../assets/images/configure.png'; import configureImage from '../../assets/images/configure.png';
import RootElem from '../../hoc/RootElem/RootElem'; import RootElem from '../../hoc/RootElem/RootElem';
export default CSSModules((props) => { export default props => {
let configButton = null; let configButton = null;
let secondRow = 6; let secondRow = 6;
if (props.allowConfig) { if (props.allowConfig) {
@@ -51,7 +50,7 @@ export default CSSModules((props) => {
maxLength={4096} maxLength={4096}
onChange={props.changed} onChange={props.changed}
size={4096} size={4096}
styleName={'Input'} className={'MountItemInput'}
type={'text'} type={'text'}
value={props.location}/> value={props.location}/>
</RootElem> </RootElem>
@@ -122,4 +121,4 @@ export default CSSModules((props) => {
{autoRestartControl} {autoRestartControl}
</Grid> </Grid>
); );
}, styles, {allowMultiple: true}); };

View File

@@ -1,13 +1,12 @@
import React from 'react'; import React from 'react';
import styles from './ReleaseVersionDisplay.css'; import './ReleaseVersionDisplay.css';
import CSSModules from 'react-css-modules';
import DropDown from '../UI/DropDown/DropDown'; import DropDown from '../UI/DropDown/DropDown';
import Grid from '../UI/Grid/Grid'; import Grid from '../UI/Grid/Grid';
import Text from '../UI/Text/Text'; import Text from '../UI/Text/Text';
import Button from '../UI/Button/Button'; import Button from '../UI/Button/Button';
import UpgradeIcon from '../UpgradeIcon/UpgradeIcon'; import UpgradeIcon from '../UpgradeIcon/UpgradeIcon';
export default CSSModules((props) => { export default props => {
let optionsDisplay = []; let optionsDisplay = [];
let key = 0; let key = 0;
if (props.releaseExtracting) { if (props.releaseExtracting) {
@@ -97,4 +96,4 @@ export default CSSModules((props) => {
{optionsDisplay} {optionsDisplay}
</Grid> </Grid>
); );
}, styles, {allowMultiple: true}); };

View File

@@ -15,12 +15,12 @@
} }
.Box.SlideOut { .Box.SlideOut {
animation: slide-out 0.5s forwards; animation: box-slide-out 0.5s forwards;
transform: translateX(-100%); transform: translateX(-100%);
} }
.Box.SlideOutTop { .Box.SlideOutTop {
animation: slide-out-top 0.5s forwards; animation: box-slide-out-top 0.5s forwards;
transform: translateY(-100%); transform: translateY(-100%);
} }
@@ -28,13 +28,13 @@
transition: 0.3s; transition: 0.3s;
} }
@keyframes slide-out { @keyframes box-slide-out {
100% { 100% {
transform: translateX(0%); transform: translateX(0%);
} }
} }
@keyframes slide-out-top { @keyframes box-slide-out-top {
100% { 100% {
transform: translateY(0%); transform: translateY(0%);
} }

View File

@@ -1,8 +1,7 @@
import React from 'react'; import React from 'react';
import CSSModules from 'react-css-modules'; import './Box.css';
import styles from './Box.css';
export default CSSModules((props) => { export default props => {
const styleList = []; const styleList = [];
styleList.push('Box'); styleList.push('Box');
if (props.dxDark) { if (props.dxDark) {
@@ -20,10 +19,10 @@ export default CSSModules((props) => {
return ( return (
<div <div
onClick={props.clicked} onClick={props.clicked}
styleName={styleList.join(' ')} className={styleList.join(' ')}
style={{...props.dxStyle}}> style={{...props.dxStyle}}>
{props.children} {props.children}
</div> </div>
); );
}, styles, {allowMultiple: true}); };

View File

@@ -1,13 +1,12 @@
import React from 'react'; import React from 'react';
import CSSModules from 'react-css-modules'; import './Button.css';
import styles from './Button.css';
export default CSSModules((props) => { export default props => {
return ( return (
<button disabled={props.disabled} <button disabled={props.disabled}
styleName={'Button'} className={'Button'}
style={props.buttonStyles} style={props.buttonStyles}
onClick={props.clicked}>{props.children}</button> onClick={props.clicked}>{props.children}</button>
); );
}, styles, {allowMultiple: true}); };

View File

@@ -6,7 +6,7 @@
padding: 0; padding: 0;
} }
.Select { .DropDownSelect {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: block; display: block;
@@ -19,21 +19,21 @@
box-sizing: border-box; box-sizing: border-box;
} }
.Option { .DropDownOption {
background: rgba(10, 10, 15, 0.8); background: rgba(10, 10, 15, 0.8);
border-color: rgba(10, 10, 20, 0.9); border-color: rgba(10, 10, 20, 0.9);
color: var(--text_color); color: var(--text_color);
} }
.Select:hover:enabled { .DropDownSelect:hover:enabled {
cursor: pointer; cursor: pointer;
} }
.Select:hover:disabled { .DropDownSelect:hover:disabled {
cursor: no-drop; cursor: no-drop;
} }
.Select:active, .DropDownSelect:active,
.Select.active { .DropDownSelect.active {
cursor: pointer; cursor: pointer;
} }

View File

@@ -1,20 +1,19 @@
import React from 'react'; import React from 'react';
import styles from './DropDown.css'; import './DropDown.css';
import CSSModules from 'react-css-modules';
export default CSSModules((props) => { export default props => {
const options = props.items.map((s, i) => { const options = props.items.map((s, i) => {
return ( return (
<option styleName='Option' key={i} value={i}>{s}</option> <option className={'DropDownOption'} key={i} value={i}>{s}</option>
); );
}); });
return ( return (
<div styleName='DropDown'> <div className={'DropDown'}>
<select styleName='Select' disabled={props.disabled} onChange={props.changed} value={props.selected}> <select className={'DropDownSelect'} disabled={props.disabled} onChange={props.changed} value={props.selected}>
{options} {options}
</select> </select>
</div> </div>
); );
}, styles, {allowMultiple: true}); };

View File

@@ -1,9 +1,8 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import CSSModules from 'react-css-modules'; import './Grid.css';
import styles from './Grid.css';
import GridComponent from './GridComponent/GridComponent'; import GridComponent from './GridComponent/GridComponent';
export default CSSModules(class extends Component { export default class extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
window.addEventListener("resize", this.updateSizeAsync); window.addEventListener("resize", this.updateSizeAsync);
@@ -58,11 +57,11 @@ export default CSSModules(class extends Component {
}); });
}; };
componentDidMount = () => { componentDidMount() {
this.updateSizeAsync(); this.updateSizeAsync();
}; }
componentWillUnmount = () => { componentWillUnmount() {
window.removeEventListener("resize", this.updateSizeAsync); window.removeEventListener("resize", this.updateSizeAsync);
clearInterval(this.checkSizeInterval); clearInterval(this.checkSizeInterval);
}; };
@@ -121,12 +120,11 @@ export default CSSModules(class extends Component {
return ( return (
<div <div
ref='GridOwner' ref='GridOwner'
styleName='GridOwner'> className={'GridOwner'}>
<div styleName='Grid' {...style}> <div className={'Grid'} {...style}>
{children} {children}
</div> </div>
</div> </div>
) )
}; };
};
}, styles, {allowMultiple: true});

View File

@@ -1,8 +1,7 @@
import React from 'react'; import React from 'react';
import CSSModules from 'react-css-modules'; import './GridComponent.css';
import styles from './GridComponent.css';
export default CSSModules((props) => { export default props => {
const style = { const style = {
style: { style: {
gridRowStart: Math.floor(props.row + 1), gridRowStart: Math.floor(props.row + 1),
@@ -13,9 +12,9 @@ export default CSSModules((props) => {
}; };
return ( return (
<div styleName='GridComponent' {...style}> <div className={'GridComponent'} {...style}>
{props.children} {props.children}
</div> </div>
); );
}, styles, {allowMultiple: true}); };

View File

@@ -6,7 +6,7 @@
box-sizing: border-box; box-sizing: border-box;
} }
.Content { .LoadingContent {
margin: 0; margin: 0;
padding: 0; padding: 0;
position: relative; position: relative;

View File

@@ -1,17 +1,16 @@
import React from 'react'; import React from 'react';
import CSSModules from 'react-css-modules'; import './Loading.css'
import styles from './Loading.css'
import Loader from 'react-loader-spinner'; import Loader from 'react-loader-spinner';
export default CSSModules((props) => { export default props => {
return ( return (
<div <div
styleName='Loading'> className={'Loading'}>
<div styleName='Content'> <div className={'LoadingContent'}>
<Loader color={'var(--heading_text_color)'} <Loader color={'var(--heading_text_color)'}
height='28px' height='28px'
width='28px' width='28px'
type='ThreeDots'/> type='ThreeDots'/>
</div> </div>
</div>); </div>);
}, styles, {allowMultiple: true}); };

View File

@@ -8,7 +8,7 @@
z-index: 2000; z-index: 2000;
} }
.Content { .ModalContent {
position: fixed; position: fixed;
width: auto; width: auto;
height: auto; height: auto;
@@ -22,6 +22,6 @@
z-index: 2100; z-index: 2100;
} }
.Content.Critical { .ModalContent.Critical {
z-index: 2101; z-index: 2101;
} }

View File

@@ -1,23 +1,22 @@
import React from 'react'; import React from 'react';
import CSSModules from 'react-css-modules'; import './Modal.css'
import styles from './Modal.css'
export default CSSModules((props) => { export default props => {
let modalStyles = []; let modalStyles = [];
let contentStyles = []; let contentStyles = [];
modalStyles.push('Modal'); modalStyles.push('Modal');
contentStyles.push('Content'); contentStyles.push('ModalContent');
if (props.critical) { if (props.critical) {
modalStyles.push('Critical'); modalStyles.push('ModalCritical');
contentStyles.push('Critical'); contentStyles.push('ModalCritical');
} }
return ( return (
<div <div
styleName={modalStyles.join(' ')} className={modalStyles.join(' ')}
onClick={props.clicked}> onClick={props.clicked}>
<div styleName={contentStyles.join(' ')}> <div className={contentStyles.join(' ')}>
{props.children} {props.children}
</div> </div>
</div>); </div>);
}, styles, {allowMultiple: true}); };

View File

@@ -19,21 +19,21 @@
color: var(--text_color); color: var(--text_color);
} }
.Heading1 { .TextHeading1 {
font-weight: bold; font-weight: bold;
color: var(--heading_text_color); color: var(--heading_text_color);
} }
.Heading2 { .TextHeading2 {
font-weight: bold; font-weight: bold;
color: var(--heading_other_text_color); color: var(--heading_other_text_color);
} }
.Heading3 { .TextHeading3 {
font-weight: bold; font-weight: bold;
color: var(--heading_other_text_color); color: var(--heading_other_text_color);
} }
.AltTextColor { .TextAltTextColor {
color: var(--heading_other_text_color); color: var(--heading_other_text_color);
} }

View File

@@ -1,12 +1,11 @@
import React from 'react'; import React from 'react';
import CSSModules from 'react-css-modules'; import './Text.css';
import styles from './Text.css';
export default CSSModules((props) => { export default props => {
const styleList = []; const styleList = [];
styleList.push('Text'); styleList.push('Text');
if (props.type) { if (props.type) {
styleList.push(props.type); styleList.push('Text' + props.type);
} }
let style = {...props.style}; let style = {...props.style};
@@ -16,13 +15,12 @@ export default CSSModules((props) => {
const text = ( const text = (
<div <div
styleName={styleList.join(' ')} className={styleList.join(' ')}
style={style}>{props.text} style={style}>{props.text}
</div>); </div>);
return props.noOwner ? text : ( return props.noOwner ? text : (
<div styleName={'TextOwner'}> <div className={'TextOwner'}>
{text} {text}
</div>); </div>);
};
}, styles, {allowMultiple: true});

View File

@@ -1,4 +1,4 @@
.Owner { .UpgradeIconOwner {
padding: 0; padding: 0;
margin: 0; margin: 0;
width: 100%; width: 100%;

View File

@@ -1,10 +1,9 @@
import React from 'react'; import React from 'react';
import CSSModules from 'react-css-modules'; import './UpgradeIcon.css';
import styles from './UpgradeIcon.css';
import availableImage from '../../assets/images/release_available.png'; import availableImage from '../../assets/images/release_available.png';
import ReactTooltip from 'react-tooltip'; import ReactTooltip from 'react-tooltip';
export default CSSModules((props) => { export default props => {
let placement = 'left'; let placement = 'left';
let toolTipText = 'UI Upgrade Available'; let toolTipText = 'UI Upgrade Available';
if (props.release) { if (props.release) {
@@ -15,15 +14,15 @@ export default CSSModules((props) => {
return props return props
.available ? .available ?
( (
<div styleName='Owner'> <div className={'UpgradeIconOwner'}>
<p data-tip='' data-for={placement}> <p data-tip='' data-for={placement}>
<img alt='' <img alt=''
onClick={props.clicked} onClick={props.clicked}
src={availableImage} src={availableImage}
styleName='UpgradeIcon'/> className={'UpgradeIcon'}/>
</p> </p>
<ReactTooltip id={placement} place={placement}>{toolTipText}</ReactTooltip> <ReactTooltip id={placement} place={placement}>{toolTipText}</ReactTooltip>
</div> </div>
) )
: null; : null;
}, styles, {allowMultiple: true}); };

View File

@@ -1,10 +1,9 @@
import Button from '../UI/Button/Button'; import Button from '../UI/Button/Button';
import Box from '../UI/Box/Box'; import Box from '../UI/Box/Box';
import React from 'react'; import React from 'react';
import CSSModules from 'react-css-modules'; import './UpgradeUI.css';
import styles from './UpgradeUI.css';
export default CSSModules((props) => { export default props => {
return ( return (
<Box dxStyle={{width: '180px', height: 'auto', padding: '5px'}}> <Box dxStyle={{width: '180px', height: 'auto', padding: '5px'}}>
<div style={{width: '100%', height: 'auto'}}> <div style={{width: '100%', height: 'auto'}}>
@@ -25,4 +24,4 @@ export default CSSModules((props) => {
</tbody> </tbody>
</table> </table>
</Box>); </Box>);
}, styles, {allowMultiple: true}); };

View File

@@ -1,9 +1,8 @@
import React, {Component} from 'react'; import React from 'react';
import styles from './Configuration.css'; import './Configuration.css';
import Box from '../../components/UI/Box/Box'; import Box from '../../components/UI/Box/Box';
import Button from '../../components/UI/Button/Button'; import Button from '../../components/UI/Button/Button';
import ConfigurationItem from '../../components/ConfigurationItem/ConfigurationItem'; import ConfigurationItem from '../../components/ConfigurationItem/ConfigurationItem';
import CSSModules from 'react-css-modules';
import Modal from '../../components/UI/Modal/Modal'; import Modal from '../../components/UI/Modal/Modal';
import IPCContainer from '../IPCContainer/IPCContainer'; import IPCContainer from '../IPCContainer/IPCContainer';
@@ -258,7 +257,7 @@ class Configuration extends IPCContainer {
} }
return ( return (
<div styleName='Configuration'> <div className={'Configuration'}>
{confirmSave} {confirmSave}
<Box dxDark dxStyle={{padding: '8px'}}> <Box dxDark dxStyle={{padding: '8px'}}>
<div style={{float: 'right', margin: 0, padding: 0, marginTop: '-4px', boxSizing: 'border-box', display: 'block'}}> <div style={{float: 'right', margin: 0, padding: 0, marginTop: '-4px', boxSizing: 'border-box', display: 'block'}}>
@@ -277,4 +276,4 @@ class Configuration extends IPCContainer {
} }
} }
export default CSSModules(Configuration, styles, {allowMultiple: true}); export default Configuration;

View File

@@ -1,8 +1,7 @@
import React from 'react'; import React from 'react';
import Box from '../../components/UI/Box/Box'; import Box from '../../components/UI/Box/Box';
import Button from '../../components/UI/Button/Button'; import Button from '../../components/UI/Button/Button';
import CSSModules from 'react-css-modules'; import './MountItems.css';
import styles from './MountItems.css';
import Modal from '../../components/UI/Modal/Modal'; import Modal from '../../components/UI/Modal/Modal';
import MountItem from '../../components/MountItem/MountItem'; import MountItem from '../../components/MountItem/MountItem';
import IPCContainer from '../IPCContainer/IPCContainer'; import IPCContainer from '../IPCContainer/IPCContainer';
@@ -304,11 +303,11 @@ class MountItems extends IPCContainer {
} }
return ( return (
<div styleName='MountItems'> <div className={'MountItems'}>
{retryDisplay} {retryDisplay}
{items} {items}
</div>); </div>);
} }
} }
export default CSSModules(MountItems, styles, {allowMultiple: true}); export default MountItems;

View File

@@ -2,8 +2,8 @@ import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import './index.css'; import './index.css';
import App from './App'; import App from './App';
import * as serviceWorker from './serviceWorker';
import packageJson from '../package.json'; import packageJson from '../package.json';
import registerServiceWorker from './registerServiceWorker';
const Constants = require('./constants'); const Constants = require('./constants');
@@ -17,7 +17,7 @@ if (!process.versions.hasOwnProperty('electron')) {
} }
ReactDOM.render(<App platform={arg.data} version={packageJson.version}/>, document.getElementById('root')); ReactDOM.render(<App platform={arg.data} version={packageJson.version}/>, document.getElementById('root'));
registerServiceWorker(); serviceWorker.unregister();
}); });
ipcRenderer.send(Constants.IPC_Get_Platform); ipcRenderer.send(Constants.IPC_Get_Platform);
} }

View File

@@ -1,31 +1,33 @@
// In production, we register a service worker to serve assets from local cache. // This optional code is used to register a service worker.
// register() is not called by default.
// This lets the app load faster on subsequent visits in production, and gives // This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users) // it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on the "N+1" visit to a page, since previously // will only see deployed updates on subsequent visits to a page, after all the
// cached resources are updated in the background. // existing tabs open on the page have been closed, since previously cached
// resources are updated in the background.
// To learn more about the benefits of this model, read https://goo.gl/KwvDNy. // To learn more about the benefits of this model and instructions on how to
// This link also includes instructions on opting out of this behavior. // opt-in, read https://bit.ly/CRA-PWA
const isLocalhost = Boolean( const isLocalhost = Boolean(
window.location.hostname === 'localhost' || window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address. // [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' || window.location.hostname === '[::1]' ||
// 127.0.0.1/8 is considered localhost for IPv4. // 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match( window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
) )
); );
export default function register() { export function register(config) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW. // The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(process.env.PUBLIC_URL, window.location); const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
if (publicUrl.origin !== window.location.origin) { if (publicUrl.origin !== window.location.origin) {
// Our service worker won't work if PUBLIC_URL is on a different origin // Our service worker won't work if PUBLIC_URL is on a different origin
// from what our page is served on. This might happen if a CDN is used to // from what our page is served on. This might happen if a CDN is used to
// serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374 // serve assets; see https://github.com/facebook/create-react-app/issues/2374
return; return;
} }
@@ -33,44 +35,59 @@ export default function register() {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
if (isLocalhost) { if (isLocalhost) {
// This is running on localhost. Lets check if a service worker still exists or not. // This is running on localhost. Let's check if a service worker still exists or not.
checkValidServiceWorker(swUrl); checkValidServiceWorker(swUrl, config);
// Add some additional logging to localhost, pointing developers to the // Add some additional logging to localhost, pointing developers to the
// service worker/PWA documentation. // service worker/PWA documentation.
navigator.serviceWorker.ready.then(() => { navigator.serviceWorker.ready.then(() => {
console.log( console.log(
'This web app is being served cache-first by a service ' + 'This web app is being served cache-first by a service ' +
'worker. To learn more, visit https://goo.gl/SC7cgQ' 'worker. To learn more, visit https://bit.ly/CRA-PWA'
); );
}); });
} else { } else {
// Is not local host. Just register service worker // Is not localhost. Just register service worker
registerValidSW(swUrl); registerValidSW(swUrl, config);
} }
}); });
} }
} }
function registerValidSW(swUrl) { function registerValidSW(swUrl, config) {
navigator.serviceWorker navigator.serviceWorker
.register(swUrl) .register(swUrl)
.then(registration => { .then(registration => {
registration.onupdatefound = () => { registration.onupdatefound = () => {
const installingWorker = registration.installing; const installingWorker = registration.installing;
if (installingWorker == null) {
return;
}
installingWorker.onstatechange = () => { installingWorker.onstatechange = () => {
if (installingWorker.state === 'installed') { if (installingWorker.state === 'installed') {
if (navigator.serviceWorker.controller) { if (navigator.serviceWorker.controller) {
// At this point, the old content will have been purged and // At this point, the updated precached content has been fetched,
// the fresh content will have been added to the cache. // but the previous service worker will still serve the older
// It's the perfect time to display a "New content is // content until all client tabs are closed.
// available; please refresh." message in your web app. console.log(
console.log('New content is available; please refresh.'); 'New content is available and will be used when all ' +
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
);
// Execute callback
if (config && config.onUpdate) {
config.onUpdate(registration);
}
} else { } else {
// At this point, everything has been precached. // At this point, everything has been precached.
// It's the perfect time to display a // It's the perfect time to display a
// "Content is cached for offline use." message. // "Content is cached for offline use." message.
console.log('Content is cached for offline use.'); console.log('Content is cached for offline use.');
// Execute callback
if (config && config.onSuccess) {
config.onSuccess(registration);
}
} }
} }
}; };
@@ -81,14 +98,15 @@ function registerValidSW(swUrl) {
}); });
} }
function checkValidServiceWorker(swUrl) { function checkValidServiceWorker(swUrl, config) {
// Check if the service worker can be found. If it can't reload the page. // Check if the service worker can be found. If it can't reload the page.
fetch(swUrl) fetch(swUrl)
.then(response => { .then(response => {
// Ensure service worker exists, and that we really are getting a JS file. // Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get('content-type');
if ( if (
response.status === 404 || response.status === 404 ||
response.headers.get('content-type').indexOf('javascript') === -1 (contentType != null && contentType.indexOf('javascript') === -1)
) { ) {
// No service worker found. Probably a different app. Reload the page. // No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => { navigator.serviceWorker.ready.then(registration => {
@@ -98,7 +116,7 @@ function checkValidServiceWorker(swUrl) {
}); });
} else { } else {
// Service worker found. Proceed as normal. // Service worker found. Proceed as normal.
registerValidSW(swUrl); registerValidSW(swUrl, config);
} }
}) })
.catch(() => { .catch(() => {