Swap to using Webpack to decrease deployment size
This commit is contained in:
parent
4e48152ff7
commit
3263dd360c
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
vendor
|
||||
node_modules
|
||||
dist/bundle.js
|
||||
dist/bundle.js.LICENSE.txt
|
7
index.html → dist/index.html
vendored
7
index.html → dist/index.html
vendored
@ -7,14 +7,9 @@
|
||||
<meta name="description" content="Track current and historical gold prices for the World of Warcraft in game token, including the US, EU, TW, and KR regions. Prices updated every minute. Simple and easy info, no Ads ever.">
|
||||
<link rel="preconnect" href="https://data.wowtoken.app">
|
||||
<link rel="dns-prefetch" href="https://data.wowtoken.app">
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<link rel="preload" href="https://data.wowtoken.app/token/current.json" as="fetch" type="application/json" crossorigin="anonymous">
|
||||
<link rel="preload" href="https://data.wowtoken.app/token/history/us/72h.json" as="fetch" type="application/json" crossorigin="anonymous">
|
||||
<script src="vendor/chart.js@3.3.2/chart.min.js" integrity="sha256-qoN08nWXsFH+S9CtIq99e5yzYHioRHtNB9t2qy1MSmc="></script>
|
||||
<script src="vendor/luxon@1.27.0/luxon.min.js" integrity="sha256-cJnCTPRTD3OUjTD4Ml0WEMsmTiLl71arKaZ9DEZJk0o="></script>
|
||||
<script src="vendor/chartjs-adapter-luxon@1.0.0/chartjs-adapter-luxon.min.js" integrity="sha256-q8w2Mgq36OwAFKLLbdSi+aCHAb6WJhIswZ7N6k+xsf0="></script>
|
||||
<script src="vendor/cash-dom@8.1.0/cash.min.js" integrity="sha256-xb3jchN35UY4gwqlR0mSg/dtv25q4yWmXmIg/WscJYo="></script>
|
||||
<script src="js/token.js"></script>
|
||||
<script src="bundle.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="flex-container">
|
2844
package-lock.json
generated
Normal file
2844
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
21
package.json
Normal file
21
package.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "wowtoken.app",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"build": "webpack"
|
||||
},
|
||||
"devDependencies": {
|
||||
"css-loader": "^5.2.6",
|
||||
"style-loader": "^3.0.0",
|
||||
"webpack": "^5.41.1",
|
||||
"webpack-cli": "^4.7.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"cash-dom": "^8.1.0",
|
||||
"chart.js": "^3.4.0",
|
||||
"chartjs-adapter-luxon": "^1.0.0",
|
||||
"luxon": "^1.27.0"
|
||||
}
|
||||
}
|
@ -1,4 +1,31 @@
|
||||
var current_token_int = 0;
|
||||
import {
|
||||
Chart,
|
||||
LineElement,
|
||||
PointElement,
|
||||
LineController,
|
||||
LinearScale,
|
||||
TimeSeriesScale,
|
||||
Legend,
|
||||
Title,
|
||||
Tooltip
|
||||
} from 'chart.js';
|
||||
import $ from 'cash-dom';
|
||||
import { DateTime } from 'luxon';
|
||||
import 'chartjs-adapter-luxon';
|
||||
import './style.css';
|
||||
|
||||
|
||||
Chart.register(
|
||||
LineElement,
|
||||
PointElement,
|
||||
LineController,
|
||||
LinearScale,
|
||||
TimeSeriesScale,
|
||||
Legend,
|
||||
Title,
|
||||
Tooltip
|
||||
)
|
||||
|
||||
var current_region_selection = 'us'
|
||||
var current_time_selection = '72h'
|
||||
var current_price_hash = {
|
||||
@ -38,7 +65,7 @@ function populateChart() {
|
||||
|
||||
|
||||
async function callUpdateURL() {
|
||||
let resp = await fetch("https://data.wowtoken.app/token/current.json");
|
||||
let resp = await fetch("https://piwv24uske.execute-api.us-east-1.amazonaws.com/token/current.json");
|
||||
let data = await resp.json();
|
||||
updateTokens(data);
|
||||
}
|
||||
@ -77,11 +104,11 @@ function updateTimePreference(newTime) {
|
||||
}
|
||||
|
||||
async function pullChartData() {
|
||||
let resp = await fetch("https://data.wowtoken.app/token/history/" + current_region_selection + "/" + current_time_selection + ".json");
|
||||
let resp = await fetch("https://piwv24uske.execute-api.us-east-1.amazonaws.com/token/history/" + current_region_selection + "/" + current_time_selection + ".json");
|
||||
let chart_data = await resp.json();
|
||||
new_chart_js_data = []
|
||||
for (i = 0; i < chart_data.length; i++) {
|
||||
datum = {
|
||||
var new_chart_js_data = []
|
||||
for (var i = 0; i < chart_data.length; i++) {
|
||||
var datum = {
|
||||
x: chart_data[i]['time'],
|
||||
y: chart_data[i]['value']
|
||||
}
|
@ -21,7 +21,7 @@ audio,
|
||||
canvas,
|
||||
video {
|
||||
display: inline-block;
|
||||
width: 90%;
|
||||
width: 93s%;
|
||||
aspect-ratio: 2;
|
||||
}
|
||||
audio:not([controls]) {
|
17
webpack.config.js
Normal file
17
webpack.config.js
Normal file
@ -0,0 +1,17 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: './src/index.js',
|
||||
output: {
|
||||
filename: 'bundle.js',
|
||||
path: path.resolve(__dirname, 'dist')
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/i,
|
||||
use: ['style-loader', 'css-loader']
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
Loading…
Reference in New Issue
Block a user