automate version updating
This commit is contained in:
parent
b003015e44
commit
52aa246f28
2
dist/index.html
vendored
2
dist/index.html
vendored
|
@ -1 +1 @@
|
|||
<!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><meta charset="utf-8"><link rel="preload" href="fonts/Star4000.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star 4 Radar.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Extended.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Large Compressed.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Large.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Small.woff" as="font" crossorigin="anonymous"><title>WeatherStar 4000+</title><meta name="description" content="Web based WeatherStar 4000 simulator that reports current and forecast weather conditions plus a few extras!"><meta name="keywords" content="WeatherStar 4000+"><meta name="author" content="Matt Walsh"><meta name="application-name" content="WeatherStar 4000+"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"><link rel="manifest" href="manifest.json"><link rel="icon" href="images/Logo192.png"><link rel="stylesheet" type="text/css" href="resources/ws.min.css?_=4.0.0"><script type="text/javascript" src="resources/data.min.js?_=4.0.0"></script><script type="text/javascript" src="resources/ws.min.js?_=4.0.0"></script></head><body><div id="divQuery"><form id="frmGetLatLng"><input id="txtAddress" type="text" value="" placeholder="Zip or City, State"><button id="btnGetGps" type="button" title="Get GPS Location"><img id="imgGetGps" src="images/nav/ic_gps_fixed_black_18dp_1x.png"></button> <input id="btnGetLatLng" type="submit" value="GO"> <input id="btnClearQuery" type="reset" value="Reset"></form><div id="divLat"></div><div id="divLng"></div></div><br><img id="imgPause1x" src="images/nav/ic_pause_white_24dp_1x.png"> <img id="imgPause2x" src="images/nav/ic_pause_white_24dp_2x.png"><div id="version" style="display:none">4.0.0</div><div id="divTwc"><div id="container"><div id="loading" width="640" height="480"><div><div class="title">WeatherStar 4000+</div><div class="instructions">Enter your location above to continue</div></div></div></div><div id="divTwcBottom"><div id="divTwcBottomLeft"><img id="NavigateMenu" class="navButton" src="images/nav/ic_menu_white_24dp_1x.png" title="Menu"> <img id="NavigatePrevious" class="navButton" src="images/nav/ic_skip_previous_white_24dp_1x.png" title="Previous"> <img id="NavigateNext" class="navButton" src="images/nav/ic_skip_next_white_24dp_1x.png" title="Next"> <img id="NavigatePlay" class="navButton" src="images/nav/ic_play_arrow_white_24dp_1x.png" title="Play"></div><div id="divTwcBottomMiddle"><img id="NavigateRefresh" class="navButton" src="images/nav/ic_refresh_white_24dp_1x.png" title="Refresh"></div><div id="divTwcBottomRight"><img id="ToggleFullScreen" class="navButton" src="images/nav/ic_fullscreen_exit_white_24dp_1x.png" title="Exit Fullscreen"></div></div></div><br><div class="info"><a href="https://github.com/netbymatt/ws4kp#weatherstar-4000">More information</a></div><div class="heading">Selected displays</div><div id="enabledDisplays"></div><div id="divInfo">Location: <span id="spanCity"></span> <span id="spanState"></span><br>Station Id: <span id="spanStationId"></span><br>Radar Id: <span id="spanRadarId"></span><br>Zone Id: <span id="spanZoneId"></span><br></div><div id="divRefresh">Last Update: <span id="spanLastRefresh">(None)</span><br><input id="chkAutoRefresh" name="chkAutoRefresh" type="checkbox"><label id="lblRefreshCountDown" for="chkAutoRefresh">Auto Refresh: <span id="spanRefreshCountDown">--:--</span></label></div><div id="divUnits">Units: <input id="radEnglish" name="radUnits" type="radio" value="ENGLISH"><label for="radEnglish">English</label> <input id="radMetric" name="radUnits" type="radio" value="METRIC"><label for="radMetric">Metric</label></div></body></html>
|
||||
<!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><meta charset="utf-8"><link rel="preload" href="fonts/Star4000.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star 4 Radar.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Extended.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Large Compressed.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Large.woff" as="font" crossorigin="anonymous"><link rel="preload" href="fonts/Star4000 Small.woff" as="font" crossorigin="anonymous"><title>WeatherStar 4000+</title><meta name="description" content="Web based WeatherStar 4000 simulator that reports current and forecast weather conditions plus a few extras!"><meta name="keywords" content="WeatherStar 4000+"><meta name="author" content="Matt Walsh"><meta name="application-name" content="WeatherStar 4000+"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"><link rel="manifest" href="manifest.json"><link rel="icon" href="images/Logo192.png"><link rel="stylesheet" type="text/css" href="resources/ws.min.css?_=4.1.0"><script type="text/javascript" src="resources/data.min.js?_=4.1.0"></script><script type="text/javascript" src="resources/ws.min.js?_=4.1.0"></script></head><body><div id="divQuery"><form id="frmGetLatLng"><input id="txtAddress" type="text" value="" placeholder="Zip or City, State"><button id="btnGetGps" type="button" title="Get GPS Location"><img id="imgGetGps" src="images/nav/ic_gps_fixed_black_18dp_1x.png"></button> <input id="btnGetLatLng" type="submit" value="GO"> <input id="btnClearQuery" type="reset" value="Reset"></form><div id="divLat"></div><div id="divLng"></div></div><br><img id="imgPause1x" src="images/nav/ic_pause_white_24dp_1x.png"> <img id="imgPause2x" src="images/nav/ic_pause_white_24dp_2x.png"><div id="version" style="display:none">4.1.0</div><div id="divTwc"><div id="container"><div id="loading" width="640" height="480"><div><div class="title">WeatherStar 4000+</div><div class="instructions">Enter your location above to continue</div></div></div></div><div id="divTwcBottom"><div id="divTwcBottomLeft"><img id="NavigateMenu" class="navButton" src="images/nav/ic_menu_white_24dp_1x.png" title="Menu"> <img id="NavigatePrevious" class="navButton" src="images/nav/ic_skip_previous_white_24dp_1x.png" title="Previous"> <img id="NavigateNext" class="navButton" src="images/nav/ic_skip_next_white_24dp_1x.png" title="Next"> <img id="NavigatePlay" class="navButton" src="images/nav/ic_play_arrow_white_24dp_1x.png" title="Play"></div><div id="divTwcBottomMiddle"><img id="NavigateRefresh" class="navButton" src="images/nav/ic_refresh_white_24dp_1x.png" title="Refresh"></div><div id="divTwcBottomRight"><img id="ToggleFullScreen" class="navButton" src="images/nav/ic_fullscreen_exit_white_24dp_1x.png" title="Exit Fullscreen"></div></div></div><br><div class="info"><a href="https://github.com/netbymatt/ws4kp#weatherstar-4000">More information</a></div><div class="heading">Selected displays</div><div id="enabledDisplays"></div><div id="divInfo">Location: <span id="spanCity"></span> <span id="spanState"></span><br>Station Id: <span id="spanStationId"></span><br>Radar Id: <span id="spanRadarId"></span><br>Zone Id: <span id="spanZoneId"></span><br></div><div id="divRefresh">Last Update: <span id="spanLastRefresh">(None)</span><br><input id="chkAutoRefresh" name="chkAutoRefresh" type="checkbox"><label id="lblRefreshCountDown" for="chkAutoRefresh">Auto Refresh: <span id="spanRefreshCountDown">--:--</span></label></div><div id="divUnits">Units: <input id="radEnglish" name="radUnits" type="radio" value="ENGLISH"><label for="radEnglish">English</label> <input id="radMetric" name="radUnits" type="radio" value="METRIC"><label for="radMetric">Metric</label></div></body></html>
|
2
dist/resources/ws.min.js
vendored
2
dist/resources/ws.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,5 @@
|
|||
const version = require('../version');
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
const fs = require('fs');
|
||||
|
||||
const gulp = require('gulp');
|
||||
const concat = require('gulp-concat');
|
||||
|
@ -10,23 +11,26 @@ const htmlmin = require('gulp-htmlmin');
|
|||
const del = require('del');
|
||||
const s3Upload = require('gulp-s3-upload');
|
||||
|
||||
const clean = () =>
|
||||
del(['./dist**']);
|
||||
const clean = () => del(['./dist**']);
|
||||
|
||||
const js_sources_data = [
|
||||
// get cloudfront
|
||||
const AWS = require('aws-sdk');
|
||||
|
||||
AWS.config.update({ region: 'us-east-1' });
|
||||
const cloudfront = new AWS.CloudFront({ apiVersion: '2020-01-01' });
|
||||
|
||||
const jsSourcesData = [
|
||||
'server/scripts/data/travelcities.js',
|
||||
'server/scripts/data/regionalcities.js',
|
||||
'server/scripts/data/stations.js',
|
||||
'server/scripts/data/states.js',
|
||||
];
|
||||
gulp.task('compress_js_data', () =>
|
||||
gulp.src(js_sources_data)
|
||||
gulp.task('compress_js_data', () => gulp.src(jsSourcesData)
|
||||
.pipe(concat('data.min.js'))
|
||||
.pipe(terser())
|
||||
.pipe(gulp.dest('./dist/resources')),
|
||||
);
|
||||
.pipe(gulp.dest('./dist/resources')));
|
||||
|
||||
const js_sources = [
|
||||
const jsSources = [
|
||||
'server/scripts/vendor/auto/jquery.js',
|
||||
'server/scripts/vendor/jquery.autocomplete.min.js',
|
||||
'server/scripts/vendor/auto/nosleep.js',
|
||||
|
@ -52,56 +56,50 @@ const js_sources = [
|
|||
'server/scripts/modules/progress.js',
|
||||
'server/scripts/modules/navigation.js',
|
||||
];
|
||||
gulp.task('compress_js', () =>
|
||||
gulp.src(js_sources)
|
||||
gulp.task('compress_js', () => gulp.src(jsSources)
|
||||
.pipe(concat('ws.min.js'))
|
||||
.pipe(terser())
|
||||
.pipe(gulp.dest('./dist/resources')),
|
||||
);
|
||||
.pipe(gulp.dest('./dist/resources')));
|
||||
|
||||
const css_sources = [
|
||||
const cssSources = [
|
||||
'server/styles/index.css',
|
||||
];
|
||||
gulp.task('compress_css', () =>
|
||||
gulp.src(css_sources)
|
||||
gulp.task('compress_css', () => gulp.src(cssSources)
|
||||
.pipe(concat('ws.min.css'))
|
||||
.pipe(cleanCSS())
|
||||
.pipe(gulp.dest('./dist/resources')),
|
||||
);
|
||||
.pipe(gulp.dest('./dist/resources')));
|
||||
|
||||
const html_sources = [
|
||||
const htmlSources = [
|
||||
'views/*.ejs',
|
||||
];
|
||||
gulp.task('compress_html', () =>
|
||||
gulp.src(html_sources)
|
||||
gulp.task('compress_html', () => {
|
||||
const { version } = JSON.parse(fs.readFileSync('./package.json'));
|
||||
return gulp.src(htmlSources)
|
||||
.pipe(ejs({
|
||||
production: version,
|
||||
version,
|
||||
}))
|
||||
.pipe(rename({ extname: '.html' }))
|
||||
.pipe(htmlmin({ collapseWhitespace: true }))
|
||||
.pipe(gulp.dest('./dist')),
|
||||
);
|
||||
.pipe(gulp.dest('./dist'));
|
||||
});
|
||||
|
||||
const other_files = [
|
||||
const otherFiles = [
|
||||
'server/robots.txt',
|
||||
'server/manifest.json',
|
||||
];
|
||||
gulp.task('copy_other_files', () =>
|
||||
gulp.src(other_files, {base: 'server/'})
|
||||
.pipe(gulp.dest('./dist')),
|
||||
);
|
||||
gulp.task('copy_other_files', () => gulp.src(otherFiles, { base: 'server/' })
|
||||
.pipe(gulp.dest('./dist')));
|
||||
|
||||
const s3 = s3Upload({
|
||||
useIAM: true,
|
||||
}, {
|
||||
region: 'us-east-1',
|
||||
});
|
||||
const upload_sources = [
|
||||
const uploadSources = [
|
||||
'dist/**',
|
||||
];
|
||||
gulp.task('upload', () =>
|
||||
gulp.src(upload_sources, {base: './dist'})
|
||||
gulp.task('upload', () => gulp.src(uploadSources, { base: './dist' })
|
||||
.pipe(s3({
|
||||
Bucket: 'weatherstar',
|
||||
StorageClass: 'STANDARD',
|
||||
|
@ -111,16 +109,9 @@ gulp.task('upload', () =>
|
|||
return 'max-age=2592000'; // 1 month
|
||||
},
|
||||
},
|
||||
})),
|
||||
);
|
||||
})));
|
||||
|
||||
gulp.task('invalidate', async () => {
|
||||
// get cloudfront
|
||||
const AWS = require('aws-sdk');
|
||||
AWS.config.update({region: 'us-east-1'});
|
||||
const cloudfront = new AWS.CloudFront({apiVersion: '2020-01-01'});
|
||||
|
||||
return cloudfront.createInvalidation({
|
||||
gulp.task('invalidate', async () => cloudfront.createInvalidation({
|
||||
DistributionId: 'E9171A4KV8KCW',
|
||||
InvalidationBatch: {
|
||||
CallerReference: (new Date()).toLocaleString(),
|
||||
|
@ -129,7 +120,6 @@ gulp.task('invalidate', async () => {
|
|||
Items: ['/*'],
|
||||
},
|
||||
},
|
||||
}).promise();
|
||||
});
|
||||
}).promise());
|
||||
|
||||
module.exports = gulp.series(clean, gulp.parallel('compress_js', 'compress_js_data', 'compress_css', 'compress_html', 'copy_other_files'), 'upload', 'invalidate');
|
13
gulpfile.js
13
gulpfile.js
|
@ -1,4 +1,17 @@
|
|||
const gulp = require('gulp');
|
||||
const bump = require('gulp-bump');
|
||||
|
||||
gulp.task('update-vendor', require('./gulp/update-vendor'));
|
||||
gulp.task('publish-frontend', require('./gulp/publish-frontend'));
|
||||
|
||||
gulp.task('bump_patch', () => gulp.src('./package.json')
|
||||
.pipe(bump())
|
||||
.pipe(gulp.dest('./')));
|
||||
|
||||
gulp.task('bump_minor', () => gulp.src('./package.json')
|
||||
.pipe(bump({ type: 'minor' }))
|
||||
.pipe(gulp.dest('./')));
|
||||
|
||||
gulp.task('bump_major', () => gulp.src('./package.json')
|
||||
.pipe(bump({ type: 'major' }))
|
||||
.pipe(gulp.dest('./')));
|
||||
|
|
4
index.js
4
index.js
|
@ -1,4 +1,5 @@
|
|||
// express
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
const express = require('express');
|
||||
|
||||
const app = express();
|
||||
|
@ -9,6 +10,7 @@ const path = require('path');
|
|||
app.set('view engine', 'ejs');
|
||||
|
||||
// cors pass through
|
||||
const fs = require('fs');
|
||||
const corsPassThru = require('./cors');
|
||||
const radarPassThru = require('./cors/radar');
|
||||
const outlookPassThru = require('./cors/outlook');
|
||||
|
@ -19,7 +21,7 @@ app.get('/Conus/*', radarPassThru);
|
|||
app.get('/products/*', outlookPassThru);
|
||||
|
||||
// version
|
||||
const version = require('./version');
|
||||
const { version } = JSON.parse(fs.readFileSync('package.json'));
|
||||
|
||||
const index = (req, res) => {
|
||||
res.render(path.join(__dirname, 'views/index'), {
|
||||
|
|
703
package-lock.json
generated
703
package-lock.json
generated
File diff suppressed because it is too large
Load diff
14
package.json
14
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ws4kp",
|
||||
"version": "1.0.0",
|
||||
"version": "4.1.0",
|
||||
"description": "Welcome to the WeatherStar 4000+ project page!",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -19,8 +19,8 @@
|
|||
"devDependencies": {
|
||||
"del": "^6.0.0",
|
||||
"ejs": "^3.1.5",
|
||||
"eslint": "^7.12.1",
|
||||
"eslint-config-airbnb-base": "^14.2.0",
|
||||
"eslint": "^7.17.0",
|
||||
"eslint-config-airbnb-base": "^14.2.1",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"express": "^4.17.1",
|
||||
"gulp": "^4.0.2",
|
||||
|
@ -30,13 +30,15 @@
|
|||
"gulp-htmlmin": "^5.0.1",
|
||||
"gulp-rename": "^2.0.0",
|
||||
"gulp-s3-upload": "^1.7.3",
|
||||
"gulp-terser": "^1.4.1",
|
||||
"gulp-terser": "^2.0.0",
|
||||
"jquery": "^3.5.1",
|
||||
"jquery-touchswipe": "^1.6.19",
|
||||
"luxon": "^1.25.0",
|
||||
"nosleep.js": "^0.11.0",
|
||||
"nosleep.js": "^0.12.0",
|
||||
"suncalc": "^1.8.0",
|
||||
"swiped-events": "^1.1.4"
|
||||
},
|
||||
"dependencies": {}
|
||||
"dependencies": {
|
||||
"gulp-bump": "^3.2.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ const icons = (() => {
|
|||
// grab everything after the last slash ending at any of these: ?&,
|
||||
const afterLastSlash = link.toLowerCase().match(/[^/]+$/)[0];
|
||||
let conditionName = afterLastSlash.match(/(.*?)[,?&.]/)[1];
|
||||
// using probability as a crude heavy/light indication where possible
|
||||
const value = +(link.match(/,(\d{2,3})/) ?? [0, 100])[1];
|
||||
|
||||
// if a 'DualImage' is captured, adjust to just the j parameter
|
||||
if (conditionName === 'dualimage') {
|
||||
|
@ -81,7 +83,8 @@ const icons = (() => {
|
|||
|
||||
case 'snow':
|
||||
case 'snow-n':
|
||||
return addPath('Heavy-Snow-1994-2.gif');
|
||||
if (value > 50) return addPath('Heavy-Snow-1994-2.gif');
|
||||
return addPath('Light-Snow.gif');
|
||||
|
||||
case 'rain_snow':
|
||||
return addPath('Rain-Snow-1992.gif');
|
||||
|
@ -146,6 +149,8 @@ const icons = (() => {
|
|||
// grab everything after the last slash ending at any of these: ?&,
|
||||
const afterLastSlash = link.toLowerCase().match(/[^/]+$/)[0];
|
||||
let conditionName = afterLastSlash.match(/(.*?)[,?&.]/)[1];
|
||||
// using probability as a crude heavy/light indication where possible
|
||||
const value = +(link.match(/,(\d{2,3})/) ?? [0, 100])[1];
|
||||
|
||||
// if a 'DualImage' is captured, adjust to just the j parameter
|
||||
if (conditionName === 'dualimage') {
|
||||
|
@ -214,7 +219,8 @@ const icons = (() => {
|
|||
|
||||
case 'snow':
|
||||
case 'snow-n':
|
||||
return addPath('CC_Snow.gif');
|
||||
if (value > 50) return addPath('CC_Snow.gif');
|
||||
return addPath('CC_SnowShowers.gif');
|
||||
|
||||
case 'rain_snow':
|
||||
return addPath('CC_RainSnow.gif');
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
module.exports = '4.0.0';
|
Loading…
Reference in a new issue