mirror of
https://github.com/netbymatt/ws4kp.git
synced 2026-04-14 07:39:29 -07:00
Clean up build around metar parser and locale
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
import 'dotenv/config';
|
||||
import {
|
||||
src, dest, series, parallel,
|
||||
@@ -58,15 +57,6 @@ const jsVendorSources = [
|
||||
'server/scripts/vendor/auto/suncalc.js',
|
||||
];
|
||||
|
||||
// Copy metar-taf-parser separately since it's an ES module with locale dependencies
|
||||
const metarVendorSources = [
|
||||
'server/scripts/vendor/auto/metar-taf-parser.mjs',
|
||||
'server/scripts/vendor/auto/locale/en.js',
|
||||
];
|
||||
|
||||
const copyMetarVendor = () => src(metarVendorSources, { base: 'server/scripts/vendor/auto' })
|
||||
.pipe(dest(`${RESOURCES_PATH}/vendor/auto`));
|
||||
|
||||
const compressJsVendor = () => src(jsVendorSources)
|
||||
.pipe(concat('vendor.min.js'))
|
||||
.pipe(terser())
|
||||
@@ -210,7 +200,7 @@ const buildPlaylist = async () => {
|
||||
return file('playlist.json', JSON.stringify(playlist)).pipe(dest('./dist'));
|
||||
};
|
||||
|
||||
const buildDist = series(clean, parallel(buildJs, compressJsVendor, copyMetarVendor, copyCss, compressHtml, copyOtherFiles, copyDataFiles, copyImageSources, buildPlaylist));
|
||||
const buildDist = series(clean, parallel(buildJs, compressJsVendor, copyCss, compressHtml, copyOtherFiles, copyDataFiles, copyImageSources, buildPlaylist));
|
||||
|
||||
// upload_images could be in parallel with upload, but _images logs a lot and has little changes
|
||||
// by running upload last the majority of the changes will be at the bottom of the log for easy viewing
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
import { src, series, dest } from 'gulp';
|
||||
import { deleteAsync } from 'del';
|
||||
import rename from 'gulp-rename';
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
// METAR parsing utilities using metar-taf-parser library
|
||||
import { parseMetar } from '../../vendor/auto/metar-taf-parser.mjs';
|
||||
// eslint-disable-next-line import/extensions
|
||||
import en from '../../vendor/auto/locale/en.js';
|
||||
|
||||
/**
|
||||
* Augment observation data by parsing METAR when API fields are missing
|
||||
@@ -14,7 +16,7 @@ const augmentObservationWithMetar = (observation) => {
|
||||
const metar = { ...observation };
|
||||
|
||||
try {
|
||||
const metarData = parseMetar(observation.rawMessage);
|
||||
const metarData = parseMetar(observation.rawMessage, { locale: en });
|
||||
|
||||
if (observation.windSpeed?.value === null && metarData.wind?.speed !== undefined) {
|
||||
metar.windSpeed = {
|
||||
|
||||
@@ -44,7 +44,8 @@
|
||||
"mwood",
|
||||
"unmuted",
|
||||
"dumpio",
|
||||
"mesonet"
|
||||
"mesonet",
|
||||
"metar"
|
||||
],
|
||||
"cSpell.ignorePaths": [
|
||||
"**/package-lock.json",
|
||||
@@ -82,4 +83,4 @@
|
||||
"j69.ejs-beautify",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user