Initial commit.

header/meta/side-by-side
Icedream 2018-07-13 11:11:16 +02:00
commit 692f10d361
Signed by: icedream
GPG Key ID: 1573F6D8EFE4D0CF
22 changed files with 8332 additions and 0 deletions

18
.babelrc Normal file
View File

@ -0,0 +1,18 @@
{
"presets": [
["babel-preset-env", {
"targets": {
"node": true,
"uglify": false
}
}]
],
"plugins": [
"babel-plugin-dynamic-import-node",
"babel-plugin-syntax-export-extensions",
"babel-plugin-transform-class-properties",
"babel-plugin-transform-export-extensions",
"babel-plugin-transform-object-rest-spread",
"babel-plugin-transform-runtime"
]
}

33
.eslintignore Normal file
View File

@ -0,0 +1,33 @@
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# Deployed apps should consider commenting this line out:
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
node_modules/**
!node_modules/.gitkeep
# Webpack/Babel output
/dist
/lib
# Intermediate build files (cache, etc.)
/build

38
.eslintrc.yml Normal file
View File

@ -0,0 +1,38 @@
extends: airbnb-base
parser: babel-eslint
plugins:
- babel
- json
env:
browser: true
node: true
es6: true
rules:
no-console: off
no-plusplus:
- error
- allowForLoopAfterthoughts: true
no-underscore-dangle: 'off'
overrides:
- files:
- "config/**"
- "devtools/**"
- "**/webpack.config*.js"
- "**/.babelrc*"
rules:
import/no-extraneous-dependencies:
- error
- devDependencies: true
- files:
- src/**/*
rules:
import/no-extraneous-dependencies:
- error
- devDependencies: true
no-console: error

28
.gitignore vendored Normal file
View File

@ -0,0 +1,28 @@
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# Deployed apps should consider commenting this line out:
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
node_modules
# webpack output
dist

3
.npmrc Normal file
View File

@ -0,0 +1,3 @@
ignore-engines=true
package-lock=false
prune=false

13
browserslist Normal file
View File

@ -0,0 +1,13 @@
> 0.75%
#unreleased versions # would throw error on invalid Safari versions
unreleased Chrome versions
unreleased Firefox versions
unreleased Edge versions
unreleased IE versions
last 3 major versions
last 2 years
Firefox ESR
IE >= 9
Android >= 4
iOS >= 6
not dead

4
config/.eslintrc.yml Normal file
View File

@ -0,0 +1,4 @@
rules:
import/no-extraneous-dependencies:
- error
- devDependencies: true

View File

@ -0,0 +1,137 @@
import postcssAutoprefixerPlugin from 'autoprefixer';
import postcssImportPlugin from 'postcss-import';
import postcssPresetEnvPlugin from 'postcss-preset-env';
export default class Environment {
constructor(options) {
this.development = true;
this.production = false;
this.server = false;
this.docker = false;
this.locales = ['de'];
if (options !== undefined && options !== null) {
this.input(options);
}
}
input(options) {
if (options) {
switch (true) {
case typeof (options) === 'string': // string
this.inputString(options);
break;
case Array.isArray(options): // array
options.forEach((arg) => { this.input(arg); });
break;
default: // object
Object.keys(options).forEach((k) => {
this[k] = options[k] || this[k];
});
break;
}
} else if (process.env.NODE_ENV) {
this.inputString(process.env.NODE_ENV);
}
}
inputString(env) {
switch (env.toLowerCase()) {
case 'development':
this.development = true;
this.production = false;
break;
case 'production':
this.development = false;
this.production = true;
break;
case 'server':
this.server = true;
break;
case 'docker':
this.docker = true;
break;
default:
console.warn('Unknown environment:', env);
break;
}
}
styleLoaders(...preprocessingLoaders) {
const {
production,
server,
// @HACK
// ExtractTextPlugin,
MiniCssExtractPlugin,
} = this;
// if (!ExtractTextPlugin) {
// throw new Error('Need a valid ExtractTextPlugin fed into the environment object.');
// }
if (!MiniCssExtractPlugin) {
throw new Error('Need a valid MiniCssExtractPlugin fed into the environment object.');
}
const cssLoaders = [
{
loader: 'css-loader',
options: {
importLoaders: 1,
sourceMap: true,
modules: false,
localIdentName: production
? '[name]__[local]--[hash:base64:5]'
: '[name]__[local]--[hash:base64:5]',
},
},
{
loader: 'postcss-loader',
options: {
ident: 'postcss',
plugins: [
postcssImportPlugin(),
postcssPresetEnvPlugin(),
postcssAutoprefixerPlugin(),
],
sourceMap: true,
},
},
].filter(loader => loader !== false);
if (preprocessingLoaders && preprocessingLoaders.length > 0) {
cssLoaders.push(
{
loader: 'resolve-url-loader',
options: {
fail: true,
silent: false,
},
},
...preprocessingLoaders.map(loader => Object.assign({}, loader, {
options: Object.assign({}, loader.options || {}, {
sourceMap: true,
}),
})),
);
}
if (!server) {
// const fallback = {
// loader: 'style-loader',
// };
// cssLoaders = ExtractTextPlugin.extract({
// fallback,
// use: cssLoaders,
// });
cssLoaders.unshift(MiniCssExtractPlugin.loader);
}
return cssLoaders;
}
}

View File

@ -0,0 +1,8 @@
/* env { es6: false } */
if (process.env.NODE_ENV === 'production') {
process.exit(0);
}
require('babel-register');
require('./main');

View File

@ -0,0 +1,33 @@
/**
* Reads the newer one of package-lock.json or yarn.lock, converts it to its
* counterpart (package-lock.json => yarn.lock or vice versa) using synp.
*/
import { promisify } from 'util';
import { writeFile } from 'fs';
import { npmToYarn, yarnToNpm } from 'synp';
import { exit } from 'process';
import { basename } from 'path';
const writeFileAsync = promisify(writeFile);
const npmExecPath = process.env.npm_execpath || 'npm';
const isYarn = basename(npmExecPath).startsWith('yarn');
async function main() {
const libPath = process.cwd();
if (isYarn) {
console.info('Converting yarn.lock to package-lock.json...');
await writeFileAsync('package-lock.json', yarnToNpm(libPath));
} else {
console.info('Converting package-lock.json to yarn.lock...');
await writeFileAsync('yarn.lock', npmToYarn(libPath));
}
}
main()
.then(() => exit(0))
.catch((err) => {
console.error(err);
exit(1);
});

1
package-lock.json generated Normal file

File diff suppressed because one or more lines are too long

77
package.json Normal file
View File

@ -0,0 +1,77 @@
{
"name": "secret-keys.v2",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"build:development": "webpack --mode development",
"build:production": "webpack --mode production",
"build:watch": "run-s build:development -- --watch",
"build": "run-s build:development --",
"clean": "rimraf dist",
"lint": "eslint .",
"postinstall": "node ./devtools/lockfiles",
"prepublishOnly": "run-s build:production",
"start:webpack-dev-server": "nodemon --watch webpack.config.babel.js --watch config/webpack --watch browserslist --watch .browserslistrc --exec webpack-dev-server --mode development --env development --hot --inline",
"start": "run-p start:*"
},
"devDependencies": {
"autoprefixer": "^8.6.5",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.6",
"babel-loader": "^7.1.5",
"babel-plugin-dynamic-import-node": "^2.0.0",
"babel-plugin-dynamic-import-webpack": "^1.0.2",
"babel-plugin-syntax-export-extensions": "^6.13.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-export-extensions": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-register": "^6.26.0",
"better-npm-run": "^0.1.0",
"browserslist": "^4.0.0",
"case-sensitive-paths-webpack-plugin": "^2.1.2",
"chalk": "^2.4.1",
"css-loader": "^1.0.0",
"debug": "^3.1.0",
"eslint": "4",
"eslint-config-airbnb-base": "^13.0.0",
"eslint-plugin-babel": "^5.1.0",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-json": "^1.2.0",
"execa": "^0.10.0",
"file-loader": "^1.1.11",
"html-webpack-plugin": "^3.2.0",
"jimp": "^0.2.28",
"mini-css-extract-plugin": "^0.4.1",
"node-sass": "^4.9.2",
"nodemon": "^1.18.1",
"normalize-scss": "^7.0.1",
"npm-run-all": "^4.1.3",
"postcss-import": "^11.1.0",
"postcss-loader": "^2.1.6",
"postcss-preset-env": "^5.2.1",
"progress-bar-webpack-plugin": "^1.11.0",
"resolve-url-loader": "^2.3.0",
"responsive-loader": "^1.1.0",
"rimraf": "^2.6.2",
"sass-loader": "^7.0.3",
"slash": "^2.0.0",
"style-loader": "^0.21.0",
"synp": "^1.3.0",
"uglifyjs-webpack-plugin": "^1.2.7",
"url-loader": "^1.0.1",
"webfontloader": "^1.6.28",
"webpack": "^4.16.0",
"webpack-cli": "^3.0.8",
"webpack-dev-server": "^3.1.4",
"webpack-hot-middleware": "^2.22.2",
"webpack-merge": "^4.1.3"
},
"dependencies": {
"typeface-orbitron": "^0.0.54"
}
}

24
src/.babelrc Normal file
View File

@ -0,0 +1,24 @@
{
"presets": [
["babel-preset-env", {
"targets": {
"browsers": ">1%",
"uglify": false
},
"modules": false
}],
"babel-preset-react"
],
"plugins": [
"babel-plugin-dynamic-import-node",
"babel-plugin-syntax-export-extensions",
"babel-plugin-transform-class-properties",
"babel-plugin-transform-export-extensions",
"babel-plugin-transform-react-constant-elements",
["babel-plugin-transform-runtime", {
"helpers": false,
"polyfill": false,
"regenerator": true
}]
]
}

19
src/_debug.sass Normal file
View File

@ -0,0 +1,19 @@
@if ($debug)
*
background-color: rgba(255, 0, 255, 0.1)
border: red 1px solid
box-sizing: border-box
position: relative
&:after
content: attr(class)
z-index: 99999
box-shadow: 0 0 10px black
position: absolute
left: 0
top: 0
background: white
border: black 1px solid
padding: 4px
font-size: 12px
font-weight: bold
font-family: monospace

7
src/_font.scss Normal file
View File

@ -0,0 +1,7 @@
// @import url('https://fonts.googleapis.com/css?family=Orbitron:400,700');
// @import '~typeface-orbitron';
@mixin icedream-font() {
font-family: 'Orbitron', sans-serif;
font-size: 2vmin;
}

15
src/_variables.scss Normal file
View File

@ -0,0 +1,15 @@
$debug: false !default;
$icedream-bg-color: #000 !default;
$icedream-text-color: #eee !default;
// extra features
$icedream-metadata-overlay: false !default;
$icedream-nav-tab-fix: false !default;
$icedream-nav-bg-fade: true !default;
$icedream-fog-bg: true !default;
$icedream-fog-bg-animated: true !default;
$icedream-fog-bg-animation-length: 5s !default;
$icedream-fog-bg-tab-offset: true !default;
$rekt-tab-count: 4;

150
src/icedream.scss Normal file
View File

@ -0,0 +1,150 @@
@charset "UTF-8";
@import './variables';
@import './font';
@import './debug';
// wrap all rules in body{} to increase css rule specificity, relatively safe overriding without !important
body {
// metadata overlay tweak
@if $icedream-metadata-overlay {
#meta {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
text-align: left;
padding: 1em;
margin: 0;
z-index: 900;
// copied from https://gist.github.com/Odepia/5790397
background: transparent;
background: linear-gradient(to right, #000 0%, transparent 100%);
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=#000, endColorstr=transparent);
}
.page:not(#page_EQ) {
height: calc(100% - 9vmin);
}
}
// push in some air between lines
#meta,
#nav {
line-height: 5vmin;
}
// use user font for all text it is seen to look good on
#meta,
#nav,
.page:not(#page_Chat) {
@include icedream-font();
}
// apply darker background and brighter text to content
#nav > .active,
.page,
.page.active {
background: $icedream-bg-color;
color: $icedream-text-color;
}
// stylization of text
//text-transform: lowercase;
// currently playing track metadata
#meta {
color: $icedream-text-color;
&:before {
content: '🎶 Now playing: ';
font-weight: 700;
}
}
.station .title {
font-weight: 700;
}
#nav > .active,
.page,
.page.active {
position: relative;
}
// just some nice fades
#nav {
> div {
@if $icedream-nav-bg-fade {
transition: background 0.6s ease-in-out, color 0.6s ease-in-out, border 0.25s ease-out;
}
@if $icedream-nav-tab-fix {
&:not(.active) {
border: 1px transparent solid;
border-bottom-color: #aaa;
&+div {
// rules here for all but first child that don't follow an active tab
&:hover {
border-left-color: #aaa;
}
}
}
&:not(:last-child) {
// rules here for all but last child
&:hover {
border-right-color: #aaa;
}
}
// rules here for all children
&:hover {
border-bottom-color: transparent;
border-top-color: #aaa;
}
}
}
}
// smoke effect
@if $icedream-fog-bg {
#main {
position: relative;
&::before {
opacity: 0.2;
background-image: url("whitefog.png");
background-attachment: fixed;
content: ' ';
position: absolute;
left: 0;
top: 0;
height: 100%;
@if not($icedream-fog-bg-animated) {
background-size: cover;
min-width: 100%;
width: 100%;
}
// animate it so it moves right to left slowly?
@if $icedream-fog-bg-animated {
background-repeat: repeat-x;
background-size: 100% 100%;
min-width: 200%;
width: 200%;
animation: icedream-bg-slide linear $icedream-fog-bg-animation-length infinite;
@keyframes icedream-bg-slide {
from {
transform: translateX(0);
}
to {
transform: translateX(-50%);
}
}
}
}
}
}
}

85
src/index.html Normal file
View File

@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Get REKT! - Rekt Network - 320kbps Post Apocalyptic Radio</title>
<meta name=viewport content="width=device-width, initial-scale=0.75" />
<meta charset="UTF-8">
<meta name="description" content="There are two choices left for you. Succumb to the mindset of the machine city? Or Get Rekt! On the Rekt Network's
320kbps post apocalyptic radio streams" />
<meta name="mobile-web-app-capable" content="yes">
<meta property="og:url" content="https://rekt.network" />
<meta property="og:site_name" content="https://rekt.network" />
<meta property="og:type" content="music.radio_station" />
<meta property="og:audio:url" content="https://stream.rekt.network/live.mp3" />
<meta property="og:title" content="Get REKT! - Rekt Network - 320kbps Post Apocalyptic Radio" />
<meta property="og:description" content="There are two choices left for you. Succumb to the mindset of the machine city? Or Get Rekt! On the Rekt Network's
320kbps post apocalyptic radio streams" />
<meta property="og:image" content="https://rekt.network/img/rekt_white.png" />
<meta property="fb:app_id" content="1000465486695949" />
<meta name="twitter:card" content="player" />
<meta name="twitter:title" content="Rekt Network" />
<meta name="twitter:description" content="There are two choices left for you. Succumb to the mindset of the machine city? Or Get Rekt! On the Rekt Network's
320kbps post apocalyptic radio streams" />
<meta name="twitter:player" content="https://rekt.network/player?station=live" />
<meta name="twitter:player:width" content="600" />
<meta name="twitter:player:height" content="100" />
<meta name="twitter:image" content="https://rekt.network/img/rekt_white.png" />
<meta name="twitter:player:stream" content="https://stream.rekt.network/live.mp3" />
<meta name="twitter:player:stream:content_type" content="audio/mpeg " />
<link rel="shortcut icon" href="https://rekt.network/static/img/favicon.png">
<link rel="manifest" href="https://rekt.network/manifest.json" />
<link rel="stylesheet" href="https://rekt.network/static/css/slider.css" type="text/css" />
<link rel="stylesheet" href="https://rekt.network/static/css/style.css" type="text/css" />
<link rel="stylesheet" href="https://rekt.network/static/css/irc.css" type="text/css" />
<link rel="stylesheet" href="https://rekt.network/static/theme/css/default.css" type="text/css" id="theme" />
</head>
<body class="table">
<header>
<div id="player">
<div id="player_play" class="player_button"></div>
<div id="player_stop" class="player_button" style="display:none;"></div>
</div>
<div id="meta">
Loading Track Information
</div>
<nav id="nav">
</nav>
</header>
<main id="main">
</main>
<script src="https://rekt.network/static/js/shaka.js"></script>
<script src="https://rekt.network/static/js/helper.js"></script>
<script src="https://rekt.network/static/js/slider.js"></script>
<script src="https://rekt.network/static/js/page.js"></script>
<script src="https://rekt.network/static/js/stream.js"></script>
<script src="https://rekt.network/static/js/eq.js"></script>
<script src="https://rekt.network/static/js/station.js"></script>
<script src="https://rekt.network/static/js/settings.js"></script>
<script src="https://rekt.network/static/js/fetch.js"></script>
<!-- <script src="https://rekt.network/static/js/meta_worker.js"></script> -->
<script src="https://rekt.network/static/js/meta.js"></script>
<script src="https://rekt.network/static/js/webrtc.js"></script>
<script src="https://rekt.network/static/js/irc.js"></script>
<script src="https://rekt.network/static/js/firebase-app.js"></script>
<script src="https://rekt.network/static/js/firebase-messaging.js"></script>
<script src="https://rekt.network/static/js/push.js"></script>
<script src="https://rekt.network/static/js/player.js"></script>
<script src="https://rekt.network/static/js/keybind.js"></script>
<script>
params = new URLSearchParams(location.search); // querystring parameters
</script>
</body>
</html>

3
src/index.js Normal file
View File

@ -0,0 +1,3 @@
import 'typeface-orbitron';
import './icedream.scss';

BIN
src/whitefog.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 KiB

334
webpack.config.babel.js Normal file
View File

@ -0,0 +1,334 @@
import {
DefinePlugin,
NamedModulesPlugin,
HashedModuleIdsPlugin,
LoaderOptionsPlugin,
HotModuleReplacementPlugin,
NoEmitOnErrorsPlugin,
ProvidePlugin,
optimize,
} from 'webpack';
import path from 'path';
import { isatty } from 'tty';
import chalk from 'chalk';
import _debug from 'debug';
// import slash from 'slash';
import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';
// import ExtractTextPlugin from 'extract-text-webpack-plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import HtmlPlugin from 'html-webpack-plugin';
import ProgressBarPlugin from 'progress-bar-webpack-plugin';
import UglifyJsPlugin from 'uglifyjs-webpack-plugin';
import Environment from './config/webpack/environment';
const debug = _debug('webpack:config');
debug.generated = _debug('webpack:config:generated');
debug.generated('filename:', __filename);
debug.generated('dirname:', __dirname);
const {
ModuleConcatenationPlugin,
} = optimize;
export default (options) => {
const environment = new Environment({
// @HACK
// ExtractTextPlugin,
MiniCssExtractPlugin,
});
environment.input(options);
debug.generated(environment);
const {
development,
production,
server,
docker,
} = environment;
const baseOutputFilename = development
? 'assets/dev/[name].dev.[ext]'
// Always use a hash (in production) to prevent files with the same name causing issues
: 'assets/prod/[chunkhash:2]/[name].[chunkhash:8].[ext]';
const webpackChunkFilename = baseOutputFilename
.replace(/\[ext(.*?)\]/g, 'js');
const webpackOutputFilename = webpackChunkFilename;
const assetOutputFilename = baseOutputFilename
.replace(/\[chunkhash(.*?)\]/g, '[hash$1]');
const cssOutputFileName = baseOutputFilename
.replace(/\[ext(.*?)\]/g, 'css');
// .replace(/\[chunkhash(.*?)\]/g, '[contenthash$1]');
const cssChunkOutputFileName = baseOutputFilename
.replace(/\[chunkhash(.*?)\]/g, '[id$1]')
.replace(/\[ext(.*?)\]/g, 'css');
// const cssOutputRebasePath = `${slash(path.relative(path.dirname(cssOutputFileName), ''))}/`;
const cssOutputRebasePath = '/';
// Default options for file-loader
const fileLoaderOptions = {
name: assetOutputFilename,
publicPath: cssOutputRebasePath,
};
// Default options for url-loader
const urlLoaderOptions = {
...fileLoaderOptions,
// limit: 1, // Don't inline anything (but empty files) by default
limit: 4 * 1024,
};
const config = {
name: 'frontend',
target: 'web',
devServer: {
// inline: true,
// contentBase: path.join(__dirname, 'public'),
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET',
},
historyApiFallback: {
index: '/',
},
hot: true,
https: !docker,
noInfo: false,
overlay: true,
publicPath: '',
quiet: false,
disableHostCheck: docker,
watchOptions: {
ignored: /node_modules/,
},
},
module: {
rules: [
{
test: /\.jsx?/i,
include: [
path.resolve(__dirname, 'src'),
],
use: [
{
loader: 'babel-loader',
options: {
// Look for babel configuration in project directory
babelrc: false,
// Cache transformations to the filesystem (in default temp dir)
cacheDirectory: true,
presets: [
['babel-preset-env', {
targets: {
browsers: {},
uglify: false,
},
// spec: true,
// debug: development,
useBuiltIns: true,
modules: false, // do not transpile modules, webpack 2+ does that
}],
],
plugins: [
'babel-plugin-transform-class-properties',
'babel-plugin-transform-object-rest-spread',
['babel-plugin-transform-runtime', {
helpers: false,
polyfill: false,
regenerator: true,
}],
'babel-plugin-dynamic-import-webpack',
],
},
},
],
},
...[
/\.(gif|png|webp)$/i, // graphics
/\.svg$/i, // svg
/\.jpe?g$/i, // jpeg
].map(test => ({
test,
loader: 'url-loader',
options: {
...urlLoaderOptions,
fallback: 'responsive-loader',
},
})),
...[
/\.(mp4|ogg|webm)$/i, // video
/\.(eot|otf|ttf|woff|woff2)$/i, // fonts
/\.(wav|mp3|m4a|aac|oga)$/i, // audio
].map(test => ({
test,
loader: 'url-loader',
options: urlLoaderOptions,
})),
{
test: /\.css$/,
use: environment.styleLoaders(),
},
{
test: /\.s[ac]ss$/,
use: environment.styleLoaders({
loader: 'sass-loader',
}),
},
// {
// test: /\.styl$/,
// use: environment.styleLoaders({
// loader: 'stylus-loader',
// }),
// },
],
strictExportPresence: true,
},
output: {
filename: webpackOutputFilename,
chunkFilename: webpackChunkFilename,
path: path.join(__dirname, 'dist'),
publicPath: '',
globalObject: 'this', // https://github.com/webpack-contrib/worker-loader/issues/142#issuecomment-385764803
},
plugins: [
// Show progress as a bar during build
isatty(1) && new ProgressBarPlugin({
complete: chalk.white('\u2588'),
incomplete: chalk.grey('\u2591'),
format: `:bar ${chalk.cyan.bold(':percent')} Webpack build: ${chalk.grey(':msg')}`,
}),
// Enforce case-sensitive import paths
new CaseSensitivePathsPlugin(),
// Replace specified expressions with values
new DefinePlugin({
'process.env.__DEV__': JSON.stringify(development),
'process.env.__PROD__': JSON.stringify(production),
'process.env.__SERVER__': JSON.stringify(server),
'process.env.NODE_ENV': JSON.stringify(production ? 'production' : 'development'),
}),
// Publish modules that are expected by other dependencies to be
// registered on `window` global in respective expected way.
new ProvidePlugin({
jQuery: 'jquery',
$: 'jquery',
jquery: 'jquery',
}),
// Dev server build
...[
// Hot module reloading
new HotModuleReplacementPlugin(),
new NoEmitOnErrorsPlugin(),
// Use paths as names when serving
new NamedModulesPlugin(),
].filter(() => server),
// If we're not serving, we're creating a static build
...[// Extract imported stylesheets out into .css files
new MiniCssExtractPlugin({
filename: cssOutputFileName,
chunkFileName: cssChunkOutputFileName,
}),
].filter(() => !server),
// If we're generating an HTML file, we must be building a web app, so
// configure deterministic hashing for long-term caching.
// Generate stable module ids instead of having Webpack assign integers.
// NamedModulesPlugin allows for easier debugging and
// HashedModuleIdsPlugin does this without adding too much to bundle
// size.
development
? new NamedModulesPlugin()
: new HashedModuleIdsPlugin(),
// Production builds
...[
// JavaScript minification
new LoaderOptionsPlugin({ debug: false, minimize: true }),
// Hoisting
new ModuleConcatenationPlugin(),
].filter(() => production),
new HtmlPlugin({
template: path.join(__dirname, 'src', 'index.html'),
filename: 'index.html',
hash: false,
inject: true,
compile: true,
favicon: false,
minify: production ? {
removeComments: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
useShortDoctype: true,
// includeAutoGeneratedTags: false,
collapseWhitespace: true,
// conservativeCollapse: true,
} : false,
cache: true,
showErrors: true,
chunks: 'all',
excludeChunks: [],
title: 'REKT Network',
xhtml: false,
chunksSortMode: 'dependency',
}),
].filter(plugin => plugin !== false),
resolve: {
extensions: [
'.js', '.jsx',
],
},
resolveLoader: {
modules: ['node_modules'],
},
optimization: {
minimize: production,
minimizer: [
new UglifyJsPlugin({
parallel: true,
uglifyOptions: {
compress: {
warnings: false,
},
output: {
comments: false,
},
},
sourceMap: true,
}),
],
},
devtool: server ? 'cheap-module-source-map' : 'source-map',
entry: {
app: [
path.join(__dirname, 'src'),
],
},
};
debug.generated(config);
return config;
};

7302
yarn.lock Normal file

File diff suppressed because it is too large Load Diff