Skip to content

Commit fcf0934

Browse files
Dale KunceDale Kunce
authored andcommitted
Fix npm deprecation warnings and update dependencies
- Update ESLint from 8.x to 9.x to resolve deprecation warnings - Update glob from 7.x to 10.x for better performance and security - Update js-yaml from 3.x to 4.x for latest security patches - Update node-fetch from 2.x to 3.x with dynamic import support - Replace gulp-clean with modern 'del' package to avoid rimraf issues - Remove unused glob-all dependency - Fix unused error variables in events.js for ESLint compliance - Update fetch-events.cjs to work with node-fetch v3 ESM format All builds and linting now pass without warnings
1 parent 8cf9f27 commit fcf0934

5 files changed

Lines changed: 967 additions & 666 deletions

File tree

app/assets/scripts/events.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const buildEvents = (events) => {
108108
`;
109109

110110
eventList.appendChild(eventContainer);
111-
} catch (error) {
111+
} catch {
112112
// Extract event ID for join link even in error case
113113
const urlParts = event.url.split('/').filter(part => part.length > 0);
114114
const eventId = urlParts[urlParts.length - 1];
@@ -166,7 +166,7 @@ const showLastUpdated = (buildTime) => {
166166
eventList.parentNode.insertBefore(notice, eventList);
167167
}
168168
}
169-
} catch (error) {
169+
} catch {
170170
// Silently fail - no visual indicator needed for build time parsing errors
171171
}
172172
};
@@ -222,7 +222,7 @@ const fetchEvents = async () => {
222222
}
223223

224224
return events;
225-
} catch (error) {
225+
} catch {
226226
showEventsFallback();
227227
return [];
228228
}

fetch-events.cjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const fetch = require('node-fetch');
21
const fs = require('fs');
32
const path = require('path');
43

@@ -7,6 +6,9 @@ async function fetchMissingMapsEvents() {
76
try {
87
console.log('Fetching events from osmcal.org...');
98

9+
// Dynamic import for node-fetch v3 (ESM)
10+
const { default: fetch } = await import('node-fetch');
11+
1012
const response = await fetch('https://osmcal.org/api/v2/events/', {
1113
headers: {
1214
'Accept': 'application/json',

gulpfile.cjs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const gulp = require('gulp');
22

33
const autoprefixer = require('gulp-autoprefixer');
44
const browserSync = require('browser-sync');
5-
const cleaner = require('gulp-clean');
5+
const { deleteAsync } = require('del');
66
const concat = require('gulp-concat');
77
const cp = require('child_process');
88
const fs = require('fs');
@@ -23,16 +23,21 @@ async function grabEvents () {
2323
console.log('Successfully fetched events from osmcal.org');
2424
return;
2525
} catch (error) {
26-
console.error('Failed to fetch events from osmcal.org:', error.message);
26+
console.error('Error fetching events:', error);
2727
// Create empty events file on error
2828
const eventsFile = path.join(__dirname, 'app', 'assets', 'data', 'events.json');
29-
fs.writeFileSync(eventsFile, JSON.stringify([], null, 2));
29+
const emptyEvents = {
30+
events: [],
31+
build_time: new Date().toISOString(),
32+
total_events: 0
33+
};
34+
fs.writeFileSync(eventsFile, JSON.stringify(emptyEvents, null, 2));
35+
console.log('Created empty events file due to error');
3036
}
3137
}
3238

3339
function clean () {
34-
return gulp.src(['_site', '.tmp', 'app/_data/events', 'app/_posts'], {read: false, allowEmpty: true})
35-
.pipe(cleaner());
40+
return deleteAsync(['_site', '.tmp', 'app/_data/events', 'app/_posts']);
3641
}
3742
exports.clean = clean;
3843

0 commit comments

Comments
 (0)