gulp: Fixed changes task This fixes an issue in the changes task where removed languages were causing a property access on `undefined`.
diff --git a/gulpfile.js/changelog.js b/gulpfile.js/changelog.js
index 1fb9fe1..62b70e4 100644
--- a/gulpfile.js/changelog.js
+++ b/gulpfile.js/changelog.js
@@ -105,7 +105,7 @@ const revisionRanges = {
const strCompare = (a, b) => a.localeCompare(b, 'en');
async function changes() {
- const { languages, plugins } = require('../components');
+ const { languages, plugins } = require('../components.js');
const infos = await getLog(revisionRanges.nextRelease);
@@ -225,9 +225,12 @@ async function changes() {
const change = relevantChanges[0];
if (change.mode === 'A' && change.file.startsWith('components/prism-')) {
const lang = change.file.match(/prism-([\w-]+)\.js$/)[1];
- const titles = [languages[lang].title];
- if (languages[lang].aliasTitles) {
- titles.push(...Object.values(languages[lang].aliasTitles));
+ const entry = languages[lang] || {
+ title: "REMOVED LANGUAGE " + lang,
+ };
+ const titles = [entry.title];
+ if (entry.aliasTitles) {
+ titles.push(...Object.values(entry.aliasTitles));
}
addEntry('New components', `__${titles.join('__ & __')}__: ${infoToString(info)}`);
return true;