Skip to content

Commit

Permalink
refactor(webpack): simplify webpack config and index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
Chazz committed Dec 15, 2019
1 parent 6121398 commit 69b4f8b
Show file tree
Hide file tree
Showing 13 changed files with 302 additions and 489 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ package-lock.json
# vscode
.vscode/
tsconfig.json
jsconfig.json

#nvm
.nvmrc
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
},
"devDependencies": {
"babel-eslint": "^10.0.3",
"lerna": "^3.16.4",
"eslint": "^6.7.2"
"eslint": "^6.7.2",
"lerna": "^3.16.4"
},
"engines": {
"node": ">=0.11.0",
Expand Down
12 changes: 0 additions & 12 deletions packages/app/babel.config.js

This file was deleted.

115 changes: 19 additions & 96 deletions packages/app/index.html
Original file line number Diff line number Diff line change
@@ -1,99 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Nuclear Music Player</title>

<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.2/semantic.min.css"></link>
<style type="text/css">
body {
background: #282a36;
}

.loader-container {
position: absolute;
width: 100%;
height: 100%;
background: transparent;
display: flex;
justify-content: center;
align-items: center;
z-index: -1;
}

.nuclear-loader {
position: relative;
display: flex;
flex-flow: column;
background: linear-gradient(45deg, #43CBFF 0%, #9708CC 100%);
background-size: 200% 200%;
width: 15rem;
height: 15rem;
border-radius: 2rem;
box-shadow: 0 0 38px rgba(0,0,0,0.30), 0 0 12px rgba(0,0,0,0.22);
animation: gradient-anim 2s ease-in-out infinite;
}

@keyframes gradient-anim {
0%, 100% {
background-position: 50% 50%;
}

25% {
background-position: 0% 100%;
}

75% {
background-position: 100% 0%;
}
}

.nuclear-loader>span {
position: absolute;
width: 0;
height: 0;
border-top: 4rem solid #FAFAFA;
border-left: 3rem solid transparent;
border-right: 3rem solid transparent;
}

.nuclear-loader>span:nth-child(1) {
right: 4.5rem;
top: 3.5rem;
}

.nuclear-loader>span:nth-child(2) {
right: 7.5rem;
bottom: 3.5rem;

}

.nuclear-loader>span:nth-child(3) {
left: 7.5rem;
bottom: 3.5rem;
}

@keyframes loader-anim {
0%, 100% {
border-top: 4rem solid #FAFAFA;
}

50% {
border-top: 4rem solid transparent;
}
}
</style>
</head>
<body>
<div id="react-root">
<div class="loader-container">
<div class="nuclear-loader">
<span></span>
<span></span>
<span></span>
</div>
</div>
</div>
</body>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.2/semantic.min.css"></link>
<% if (htmlWebpackPlugin.options.production) { %>
<!-- Sentry.io error monitoring -->
<script src="https://cdn.ravenjs.com/3.26.4/raven.min.js" crossorigin="anonymous"></script>
<% } %>
<style>
body {
background: #282a36;
}
</style>
</head>
<body>
<div id="react-root">
<nuclear-loader />
</div>
</body>
</html>
30 changes: 0 additions & 30 deletions packages/app/index.prod.html

This file was deleted.

76 changes: 0 additions & 76 deletions packages/app/loader.css

This file was deleted.

12 changes: 5 additions & 7 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@
"description": "Nuclear - Electron app",
"scripts": {
"start": "npm-run-all --parallel watch electron:dev",
"electron:dev": "webpack --progress --colors --config=webpack.config.electron.js && electron ./bundle.electron.js",
"electron:prod:linux": "npm run build:electron:linux && electron ./dist/bundle.electron.js",
"electron:dev": "webpack --colors --env.NODE_ENV=development --config=webpack.config.electron.js && electron ./bundle.electron.js",
"electron:prod": "npm run build:electron && electron ./dist/bundle.electron.js",
"electron:docker": "docker run --rm --net=host --env=\"DISPLAY\" --volume=\"$HOME/.Xauthority:/root/.Xauthority:rw\" --device /dev/snd nuclear",
"watch": "webpack-dev-server --verbose --inline --progress --env=dev --verbose",
"build:dist": "webpack --progress --colors --env=prod && cp loader.css dist",
"build:dist:windows": "webpack --progress --colors --env=prod && copy loader.css dist",
"build:electron:linux": "webpack --progress --colors --env.LINUX=true --config=webpack.config.electron.prod.js",
"build:electron": "webpack --progress --colors --config=webpack.config.electron.prod.js",
"watch": "webpack-dev-server --verbose --inline --env.NODE_ENV=development",
"build:dist": "webpack --progress --colors --env.NODE_ENV=production",
"build:electron": "webpack --progress --colors --env.NODE_ENV=production --config=webpack.config.electron.js",
"build:docker": "docker build -t nuclear .",
"test": "mocha --require ./test/testHelper.js --require regenerator-runtime --timeout 10000 --prof --recursive",
"pack": "electron-builder --dir -c.extraMetadata.main=dist/bundle.electron.js",
Expand Down Expand Up @@ -46,6 +43,7 @@
"dependencies": {
"@nuclear/core": "0.5.1",
"@nuclear/ui": "0.5.1",
"awilix": "^4.2.3",
"billboard-top-100": "^2.0.8",
"bluebird": "3.5.3",
"body-parser": "^1.18.3",
Expand Down
87 changes: 87 additions & 0 deletions packages/app/preload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
const template = document.createElement('template');
template.innerHTML = `
<style>
@keyframes gradient-anim {
0%, 100% {
background-position: 50% 50%;
}
25% {
background-position: 0% 100%;
}
75% {
background-position: 100% 0%;
}
}
@keyframes loader-anim {
0%, 100% {
border-top: 4rem solid #FAFAFA;
}
50% {
border-top: 4rem solid transparent;
}
}
:host {
position: absolute;
width: 100%;
height: 100%;
background: transparent;
display: flex;
justify-content: center;
align-items: center;
z-index: -1;
}
.nuclear-loader {
position: relative;
display: flex;
flex-flow: column;
background: linear-gradient(45deg, #43CBFF 0%, #9708CC 100%);
background-size: 200% 200%;
width: 15rem;
height: 15rem;
border-radius: 2rem;
box-shadow: 0 0 38px rgba(0,0,0,0.30), 0 0 12px rgba(0,0,0,0.22);
animation: gradient-anim 2s ease-in-out infinite;
}
.nuclear-loader>span {
position: absolute;
width: 0;
height: 0;
border-top: 4rem solid #FAFAFA;
border-left: 3rem solid transparent;
border-right: 3rem solid transparent;
}
.nuclear-loader>span:nth-child(1) {
right: 4.5rem;
top: 3.5rem;
}
.nuclear-loader>span:nth-child(2) {
right: 7.5rem;
bottom: 3.5rem;
}
.nuclear-loader>span:nth-child(3) {
left: 7.5rem;
bottom: 3.5rem;
}
</style>
<div class="nuclear-loader">
<span></span>
<span></span>
<span></span>
</div>`;

class NuclearLoader extends HTMLElement {
constructor() {
super();
this.attachShadow({mode: 'open'});
this.shadowRoot.appendChild(template.content.cloneNode(true));
}
}

window.customElements.define('nuclear-loader', NuclearLoader);
Loading

0 comments on commit 69b4f8b

Please sign in to comment.