mirror of
https://github.com/netbymatt/ws4kp.git
synced 2026-04-14 07:39:29 -07:00
Add 'metar-taf-parser' npm dependency
- Adds METAR (Meteorological Aerodrome Report) parsing capabilities - metar-taf-parser has no dependencies, so impact is small
This commit is contained in:
@@ -58,6 +58,15 @@ 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())
|
||||
@@ -212,7 +221,7 @@ const buildPlaylist = async () => {
|
||||
return file('playlist.json', JSON.stringify(playlist)).pipe(dest('./dist'));
|
||||
};
|
||||
|
||||
const buildDist = series(clean, parallel(buildJs, buildWorkers, compressJsData, compressJsVendor, copyCss, compressHtml, copyOtherFiles, copyImageSources, buildPlaylist));
|
||||
const buildDist = series(clean, parallel(buildJs, buildWorkers, compressJsVendor, copyMetarVendor, copyCss, compressHtml, copyOtherFiles, 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
|
||||
|
||||
@@ -13,6 +13,12 @@ const vendorFiles = [
|
||||
'./node_modules/swiped-events/src/swiped-events.js',
|
||||
];
|
||||
|
||||
// Special handling for metar-taf-parser - only copy main file and English locale
|
||||
const metarFiles = [
|
||||
'./node_modules/metar-taf-parser/metar-taf-parser.js',
|
||||
'./node_modules/metar-taf-parser/locale/en.js',
|
||||
];
|
||||
|
||||
const copy = () => src(vendorFiles)
|
||||
.pipe(rename((path) => {
|
||||
path.dirname = path.dirname.toLowerCase();
|
||||
@@ -22,6 +28,14 @@ const copy = () => src(vendorFiles)
|
||||
}))
|
||||
.pipe(dest('./server/scripts/vendor/auto'));
|
||||
|
||||
const updateVendor = series(clean, copy);
|
||||
const copyMetar = () => src(metarFiles, { base: './node_modules/metar-taf-parser' })
|
||||
.pipe(rename((path) => {
|
||||
path.basename = path.basename.toLowerCase();
|
||||
path.extname = path.extname.toLowerCase();
|
||||
if (path.basename === 'metar-taf-parser') path.extname = '.mjs';
|
||||
}))
|
||||
.pipe(dest('./server/scripts/vendor/auto'));
|
||||
|
||||
const updateVendor = series(clean, copy, copyMetar);
|
||||
|
||||
export default updateVendor;
|
||||
|
||||
Reference in New Issue
Block a user