Files
MagicMirror/js/releasenotes.js

199 lines
5.7 KiB
JavaScript
Raw Permalink Normal View History

Release 2.34.0 (#3999) Thanks to: @Blackspirits, @Crazylegstoo, @jarnoml, @jboucly, @JHWelch, @khassel, @KristjanESPERANTO, @rejas, @sdetweil, @xsorifc28 ⚠️ This release needs nodejs version >=22.21.1 <23 || >=24 [Compare to previous Release v2.33.0](https://github.com/MagicMirrorOrg/MagicMirror/compare/v2.33.0...develop) [core] Prepare Release 2.34.0 (https://github.com/MagicMirrorOrg/MagicMirror/pull/3998) dependency update + adjust Playwright setup + fix linter issue (https://github.com/MagicMirrorOrg/MagicMirror/pull/3994) demo with gif (https://github.com/MagicMirrorOrg/MagicMirror/pull/3995) [core] fix: allow browser globals in config files (https://github.com/MagicMirrorOrg/MagicMirror/pull/3992) [core] fix: restore --ozone-platform=wayland flag for reliable Wayland support (https://github.com/MagicMirrorOrg/MagicMirror/pull/3989) [core] auto create release notes with every push on develop (https://github.com/MagicMirrorOrg/MagicMirror/pull/3985) [core] chore: simplify Wayland start script (https://github.com/MagicMirrorOrg/MagicMirror/pull/3974) [gitignore] restore the old Git behavior for the default modules (https://github.com/MagicMirrorOrg/MagicMirror/pull/3968) [core] configure cspell to check default modules only and fix typos (https://github.com/MagicMirrorOrg/MagicMirror/pull/3955) [gitignore] restoring the old Git behavior for the CSS directory (https://github.com/MagicMirrorOrg/MagicMirror/pull/3954) feat(core): add server:watch script with automatic restart on file changes (https://github.com/MagicMirrorOrg/MagicMirror/pull/3920) [check_config] refactor: improve error handling (https://github.com/MagicMirrorOrg/MagicMirror/pull/3927) refactor: replace express-ipfilter with lightweight custom middleware (https://github.com/MagicMirrorOrg/MagicMirror/pull/3917) refactor: replace module-alias dependency with internal alias resolver (https://github.com/MagicMirrorOrg/MagicMirror/pull/3893) [dependencies] [chore] update dependencies and min. node version (https://github.com/MagicMirrorOrg/MagicMirror/pull/3986) [core] bump dependencies into december (https://github.com/MagicMirrorOrg/MagicMirror/pull/3982) Bump actions/checkout from 5 to 6 (https://github.com/MagicMirrorOrg/MagicMirror/pull/3972) Update deps, unpin parse5 (https://github.com/MagicMirrorOrg/MagicMirror/pull/3934) [core] Update deps and pin jsdom to v27.0.0 (https://github.com/MagicMirrorOrg/MagicMirror/pull/3925) chore: update dependencies (https://github.com/MagicMirrorOrg/MagicMirror/pull/3921) update deps, exclude node v23 (https://github.com/MagicMirrorOrg/MagicMirror/pull/3916) remove eslint warnings, add npm publish process to Collaboration.md (https://github.com/MagicMirrorOrg/MagicMirror/pull/3913) feat: add ESlint rule no-sparse-arrays for config check (https://github.com/MagicMirrorOrg/MagicMirror/pull/3911) chore: bump dependencies into october (https://github.com/MagicMirrorOrg/MagicMirror/pull/3909) [logging] logger: add calling filename as prefix on server side (https://github.com/MagicMirrorOrg/MagicMirror/pull/3926) [logger] Add prefixes to most Log messages (https://github.com/MagicMirrorOrg/MagicMirror/pull/3923) [modules/alert] Add new pt and pt-BR translations for Alert module and update global PT strings (https://github.com/MagicMirrorOrg/MagicMirror/pull/3965) [modules/calendar] add checksum to test whether calendar event list changed (https://github.com/MagicMirrorOrg/MagicMirror/pull/3988) [calendar] fix: prevent excessive fetching on client reload and refactor calendarfetcherutils.js (https://github.com/MagicMirrorOrg/MagicMirror/pull/3976) [calendar] refactor: migrate CalendarFetcher to ES6 class and improve error handling (https://github.com/MagicMirrorOrg/MagicMirror/pull/3959) [calendar] Show repeatingCountTitle only if yearDiff > 0 (https://github.com/MagicMirrorOrg/MagicMirror/pull/3949) [tests] suppress debug logs in CI environment + improve calendar symbol test stability (https://github.com/MagicMirrorOrg/MagicMirror/pull/3941) [calendar] chore: remove requiresVersion: "2.1.0" (https://github.com/MagicMirrorOrg/MagicMirror/pull/3932) [calendar] test: remove "Recurring event per timezone" test (https://github.com/MagicMirrorOrg/MagicMirror/pull/3929) [modules/compliments] [compliments] refactor: optimize loadComplimentFile method and add unit tests (https://github.com/MagicMirrorOrg/MagicMirror/pull/3969) fix: set compliments remote file minimum delay to 15 minutes (https://github.com/MagicMirrorOrg/MagicMirror/pull/3970) [compliments] fix: duplicate query param "?" in compliments module refresh url (https://github.com/MagicMirrorOrg/MagicMirror/pull/3967) [modules/newsfeed] [newsfeed] fix header layout issue (https://github.com/MagicMirrorOrg/MagicMirror/pull/3946) [modules/weather] [weatherprovider] update subclass language use override (https://github.com/MagicMirrorOrg/MagicMirror/pull/3914) [weather] fix wind-icon not showing in pirateweather (https://github.com/MagicMirrorOrg/MagicMirror/pull/3957) [weather] add error handling to weather fetch functions, including cors (https://github.com/MagicMirrorOrg/MagicMirror/pull/3791) remove deprecated ukmetoffice datapoint provider, cleanup .gitignore (https://github.com/MagicMirrorOrg/MagicMirror/pull/3952) fixes problems with daylight-saving-time in weather provider openmeteo (https://github.com/MagicMirrorOrg/MagicMirror/pull/3931) Fix for envcanada Provider to use updated Env Canada URL (https://github.com/MagicMirrorOrg/MagicMirror/pull/3919) [weather] feat: add configurable forecast date format option (https://github.com/MagicMirrorOrg/MagicMirror/pull/3918) [testing] testing: update "Enforce Pull-Request Rules" workflow (https://github.com/MagicMirrorOrg/MagicMirror/pull/3987) [core] refactor: replace XMLHttpRequest with fetch and migrate e2e tests to Playwright (https://github.com/MagicMirrorOrg/MagicMirror/pull/3950) [test] replace node-libgpiod with serialport in electron-rebuild workflow (https://github.com/MagicMirrorOrg/MagicMirror/pull/3945) [ci] Add concurrency to automated tests workflow to cancel outdated runs (https://github.com/MagicMirrorOrg/MagicMirror/pull/3943) [tests] migrate from jest to vitest (https://github.com/MagicMirrorOrg/MagicMirror/pull/3940) --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Karsten Hassel <hassel@gmx.de> Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com> Co-authored-by: Ryan Williams <65094007+ryan-d-williams@users.noreply.github.com> Co-authored-by: Veeck <github@veeck.de> Co-authored-by: Bugsounet - Cédric <github@bugsounet.fr> Co-authored-by: Marc Landis <dirk.rettschlag@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: HeikoGr <20295490+HeikoGr@users.noreply.github.com> Co-authored-by: Pedro Lamas <pedrolamas@gmail.com> Co-authored-by: veeck <gitkraken@veeck.de> Co-authored-by: Magnus <34011212+MagMar94@users.noreply.github.com> Co-authored-by: Ikko Eltociear Ashimine <eltociear@gmail.com> Co-authored-by: DevIncomin <56730075+Developer-Incoming@users.noreply.github.com> Co-authored-by: Nathan <n8nyoung@gmail.com> Co-authored-by: mixasgr <mixasgr@users.noreply.github.com> Co-authored-by: Savvas Adamtziloglou <savvas-gr@greeklug.gr> Co-authored-by: Konstantinos <geraki@gmail.com> Co-authored-by: OWL4C <124401812+OWL4C@users.noreply.github.com> Co-authored-by: BugHaver <43462320+bughaver@users.noreply.github.com> Co-authored-by: BugHaver <43462320+lsaadeh@users.noreply.github.com> Co-authored-by: Koen Konst <koenspero@gmail.com> Co-authored-by: Koen Konst <c.h.konst@avisi.nl> Co-authored-by: dathbe <github@beffa.us> Co-authored-by: Marcel <m-idler@users.noreply.github.com> Co-authored-by: Kevin G. <crazylegstoo@gmail.com> Co-authored-by: Jboucly <33218155+jboucly@users.noreply.github.com> Co-authored-by: Jboucly <contact@jboucly.fr> Co-authored-by: Jarno <54169345+jarnoml@users.noreply.github.com> Co-authored-by: Jordan Welch <JordanHWelch@gmail.com> Co-authored-by: Blackspirits <blackspirits@gmail.com> Co-authored-by: Samed Ozdemir <samed@xsor.io>
2026-01-01 08:45:36 -06:00
/* eslint no-console: "off" */
const util = require("node:util");
const exec = util.promisify(require("node:child_process").exec);
const fs = require("node:fs");
const createReleaseNotes = async () => {
let repoName = "MagicMirrorOrg/MagicMirror";
if (process.env.GITHUB_REPOSITORY) {
repoName = process.env.GITHUB_REPOSITORY;
}
const baseUrl = `https://api.github.com/repos/${repoName}`;
const getOptions = (type) => {
if (process.env.GITHUB_TOKEN) {
return { method: `${type}`, headers: { Authorization: `Bearer ${process.env.GITHUB_TOKEN}` } };
} else {
return { method: `${type}` };
}
};
const execShell = async (command) => {
const { stdout = "", stderr = "" } = await exec(command);
if (stderr) console.error(`Error in execShell executing command ${command}: ${stderr}`);
return stdout;
};
// Check Draft Release
const draftReleases = [];
const jsonReleases = await fetch(`${baseUrl}/releases`, getOptions("GET")).then((res) => res.json());
for (const rel of jsonReleases) {
if (rel.draft && rel.tag_name === "" && rel.published_at === null && rel.name === "unreleased") draftReleases.push(rel);
}
let draftReleaseId = 0;
if (draftReleases.length > 1) {
throw new Error("More than one draft release found, exiting.");
} else {
if (draftReleases[0]) draftReleaseId = draftReleases[0].id;
}
// Get last Git Tag
const gitTag = await execShell("git describe --tags `git rev-list --tags --max-count=1`");
const lastTag = gitTag.toString().replaceAll("\n", "");
console.info(`latest tag is ${lastTag}`);
// Get Git Commits
const gitOut = await execShell(`git log develop --pretty=format:"%H --- %s" --after="$(git log -1 --format=%aI ${lastTag})"`);
console.info(gitOut);
const commits = gitOut.toString().split("\n");
// Get Node engine version from package.json
const nodeVersion = JSON.parse(fs.readFileSync("package.json")).engines.node;
// Search strings
const labelArr = ["alert", "calendar", "clock", "compliments", "helloworld", "newsfeed", "updatenotification", "weather", "envcanada", "openmeteo", "openweathermap", "smhi", "ukmetoffice", "yr", "eslint", "bump", "dependencies", "deps", "logg", "translation", "test", "ci"];
// Map search strings to categories
const getFirstLabel = (text) => {
let res;
labelArr.every((item) => {
const labelIncl = text.includes(item);
if (labelIncl) {
switch (item) {
case "ci":
case "test":
res = "testing";
break;
case "logg":
res = "logging";
break;
case "eslint":
case "bump":
case "deps":
res = "dependencies";
break;
case "envcanada":
case "openmeteo":
case "openweathermap":
case "smhi":
case "ukmetoffice":
case "yr":
case "weather":
res = "modules/weather";
break;
case "alert":
res = "modules/alert";
break;
case "calendar":
res = "modules/calendar";
break;
case "clock":
res = "modules/clock";
break;
case "compliments":
res = "modules/compliments";
break;
case "helloworld":
res = "modules/helloworld";
break;
case "newsfeed":
res = "modules/newsfeed";
break;
case "updatenotification":
res = "modules/updatenotification";
break;
default:
res = item;
break;
}
return false;
} else {
return true;
}
});
if (!res) res = "core";
return res;
};
const grouped = {};
const contrib = [];
const sha = [];
// Loop through each Commit
for (const item of commits) {
const cm = item.trim();
// ignore `prepare release` line
if (cm.length > 0 && !cm.match(/^.* --- prepare .*-develop$/gi)) {
const [ref, title] = cm.split(" --- ");
const groupTitle = getFirstLabel(title.toLowerCase());
if (!grouped[groupTitle]) {
grouped[groupTitle] = [];
}
grouped[groupTitle].push(`- ${title}`);
sha.push(ref);
}
}
// function to remove duplicates
const sortedArr = (arr) => {
return arr.filter((item,
index) => (arr.indexOf(item) === index && item !== "@dependabot[bot]")).sort(function (a, b) {
return a.toLowerCase().localeCompare(b.toLowerCase());
});
};
// Get Contributors logins
for (const ref of sha) {
const jsonRes = await fetch(`${baseUrl}/commits/${ref}`, getOptions("GET")).then((res) => res.json());
if (jsonRes && jsonRes.author && jsonRes.author.login) contrib.push(`@${jsonRes.author.login}`);
}
// Build Markdown content
let markdown = "## Release Notes\n";
markdown += `Thanks to: ${sortedArr(contrib).join(", ")}\n`;
markdown += `> ⚠️ This release needs nodejs version ${nodeVersion}\n`;
markdown += "\n";
markdown += `[Compare to previous Release ${lastTag}](https://github.com/${repoName}/compare/${lastTag}...develop)\n\n`;
const sorted = Object.keys(grouped)
.sort() // Sort the keys alphabetically
.reduce((obj, key) => {
obj[key] = grouped[key]; // Rebuild the object with sorted keys
return obj;
}, {});
for (const group in sorted) {
markdown += `\n### [${group}]\n`;
markdown += `${sorted[group].join("\n")}\n`;
}
console.info(markdown);
// Create Github Release
if (process.env.GITHUB_TOKEN) {
if (draftReleaseId > 0) {
// delete release
await fetch(`${baseUrl}/releases/${draftReleaseId}`, getOptions("DELETE"));
console.info(`Old Release with id ${draftReleaseId} deleted.`);
}
const relContent = getOptions("POST");
relContent.body = JSON.stringify(
{ tag_name: "", name: "unreleased", body: `${markdown}`, draft: true }
);
const createRelease = await fetch(`${baseUrl}/releases`, relContent).then((res) => res.json());
console.info(`New release created with id ${createRelease.id}, GitHub-Url: ${createRelease.html_url}`);
}
};
createReleaseNotes();