mirror of
https://github.com/MichMich/MagicMirror.git
synced 2026-04-24 06:47:07 +00:00
node-ical 0.25.x added `expandRecurringEvent()` — a proper API for
expanding both recurring and non-recurring events, including EXDATE
filtering and RECURRENCE-ID overrides. This PR replaces our hand-rolled
equivalent with it.
`calendarfetcherutils.js` loses ~125 lines of code. What's left only
deals with MagicMirror-specific concerns: timezone conversion,
config-based filtering, and output formatting. The extra lines in the
diff come from new tests.
## What was removed
- `getMomentsFromRecurringEvent()` — manual rrule.js wrapping with
custom date extraction
- `isFullDayEvent()` — heuristic with multiple fallback checks
- `isFacebookBirthday` workaround — patched years < 1900 and
special-cased `@facebook.com` UIDs
- The `if (event.rrule) / else` split — all events now go through a
single code path
## Bugs fixed along the way
Both were subtle enough to go unnoticed before:
- **`[object Object]` in event titles/description/location** — node-ical
represents ICS properties with parameters (e.g.
`DESCRIPTION;LANGUAGE=de:Text`) as `{val, params}` objects. The old code
passed them straight through. Mainly affected multilingual Exchange/O365
setups. Fixed with `unwrapParameterValue()`.
- **`excludedEvents` with `until` never worked** —
`shouldEventBeExcluded()` returned `{ excluded, until }` but the caller
destructured it as `{ excluded, eventFilterUntil }`, so the until date
was always `undefined` and events were never hidden. Fixed by correcting
the destructuring key.
The expansion loop also gets error isolation: a single broken event is
logged and skipped instead of aborting the whole feed.
## Other clean-ups
- Replaced `this.shouldEventBeExcluded` with
`CalendarFetcherUtils.shouldEventBeExcluded` — avoids context-loss bugs
when the method is destructured or called indirectly.
- Replaced deprecated `substr()` with `slice()`.
- Replaced `now < filterUntil` (operator overloading) with
`now.isBefore(filterUntil)` — idiomatic Moment.js comparison.
- Fixed `@returns` JSDoc: `string[]` → `object[]`.
- Moved verbose `Log.debug("Processing entry...")` after the `VEVENT`
type guard to reduce log noise from non-event entries.
- Replaced `JSON.stringify(event)` debug log with a lightweight summary
to avoid unnecessary serialization cost.
- Added comment explaining the 0-duration → end-of-day fallback for
events without DTEND.
## Tests
24 unit tests, all passing (`npx vitest run
tests/unit/modules/default/calendar/`).
New coverage: `excludedEvents` with/without `until`, Facebook birthday
year expansion, output object shape, no-DTEND fallback, error isolation,
`unwrapParameterValue`, `getTitleFromEvent`, ParameterValue properties,
RECURRENCE-ID overrides, DURATION (single and recurring).
146 lines
4.3 KiB
JSON
146 lines
4.3 KiB
JSON
{
|
|
"name": "magicmirror",
|
|
"version": "2.35.0-develop",
|
|
"description": "The open source modular smart mirror platform.",
|
|
"keywords": [
|
|
"magic mirror",
|
|
"magicmirror",
|
|
"smart mirror",
|
|
"mirror UI",
|
|
"modular"
|
|
],
|
|
"homepage": "https://magicmirror.builders",
|
|
"bugs": {
|
|
"url": "https://github.com/MagicMirrorOrg/MagicMirror/issues"
|
|
},
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "https://github.com/MagicMirrorOrg/MagicMirror"
|
|
},
|
|
"license": "MIT",
|
|
"author": "Michael Teeuw",
|
|
"contributors": [
|
|
{
|
|
"name": "MagicMirror contributors",
|
|
"url": "https://github.com/MagicMirrorOrg/MagicMirror/graphs/contributors"
|
|
}
|
|
],
|
|
"type": "commonjs",
|
|
"imports": {
|
|
"#server_functions": {
|
|
"default": "./js/server_functions.js"
|
|
},
|
|
"#http_fetcher": {
|
|
"default": "./js/http_fetcher.js"
|
|
}
|
|
},
|
|
"main": "js/electron.js",
|
|
"exports": "./js/electron.js",
|
|
"files": [
|
|
"clientonly",
|
|
"css",
|
|
"defaultmodules",
|
|
"js",
|
|
"serveronly",
|
|
"translations",
|
|
"favicon.svg",
|
|
"index.html"
|
|
],
|
|
"sideEffects": true,
|
|
"scripts": {
|
|
"config:check": "node js/check_config.js",
|
|
"postinstall": "git clean -df fonts vendor modules/default",
|
|
"install-mm": "npm install --no-audit --no-fund --no-update-notifier --only=prod --omit=dev",
|
|
"install-mm:dev": "npm install --no-audit --no-fund --no-update-notifier && npx playwright install chromium",
|
|
"lint:css": "stylelint 'css/**/*.css' 'defaultmodules/**/*.css' --fix",
|
|
"lint:js": "eslint --fix",
|
|
"lint:markdown": "markdownlint-cli2 . --fix",
|
|
"lint:prettier": "prettier . --write",
|
|
"prepare": "[ -f node_modules/.bin/husky ] && husky || echo no husky installed.",
|
|
"server": "node ./serveronly",
|
|
"server:watch": "node ./serveronly/watcher.js",
|
|
"start": "node --run start:wayland",
|
|
"start:dev": "node --run start:wayland -- dev",
|
|
"start:wayland": "WAYLAND_DISPLAY=\"${WAYLAND_DISPLAY:=wayland-1}\" ./node_modules/.bin/electron js/electron.js --ozone-platform=wayland",
|
|
"start:wayland:dev": "node --run start:wayland -- dev",
|
|
"start:windows": ".\\node_modules\\.bin\\electron js\\electron.js",
|
|
"start:windows:dev": "node --run start:windows -- dev",
|
|
"start:x11": "DISPLAY=\"${DISPLAY:=:0}\" ./node_modules/.bin/electron js/electron.js",
|
|
"start:x11:dev": "node --run start:x11 -- dev",
|
|
"test": "vitest run",
|
|
"test:calendar": "node ./defaultmodules/calendar/debug.js",
|
|
"test:coverage": "vitest run --coverage",
|
|
"test:css": "stylelint 'css/**/*.css' 'defaultmodules/**/*.css'",
|
|
"test:e2e": "vitest run tests/e2e",
|
|
"test:electron": "vitest run tests/electron",
|
|
"test:js": "eslint",
|
|
"test:markdown": "markdownlint-cli2 .",
|
|
"test:prettier": "prettier . --check",
|
|
"test:spelling": "cspell . --gitignore",
|
|
"test:ui": "vitest --ui",
|
|
"test:unit": "vitest run tests/unit",
|
|
"test:watch": "vitest"
|
|
},
|
|
"lint-staged": {
|
|
"*": "prettier --ignore-unknown --write",
|
|
"*.js": "eslint --fix",
|
|
"*.css": "stylelint --fix"
|
|
},
|
|
"dependencies": {
|
|
"@fontsource/roboto": "^5.2.10",
|
|
"@fontsource/roboto-condensed": "^5.2.8",
|
|
"@fortawesome/fontawesome-free": "^7.2.0",
|
|
"ajv": "^8.18.0",
|
|
"animate.css": "^4.1.1",
|
|
"console-stamp": "^3.1.2",
|
|
"croner": "^10.0.1",
|
|
"eslint": "^9.39.3",
|
|
"express": "^5.2.1",
|
|
"feedme": "^2.0.2",
|
|
"helmet": "^8.1.0",
|
|
"html-to-text": "^9.0.5",
|
|
"iconv-lite": "^0.7.2",
|
|
"ipaddr.js": "^2.3.0",
|
|
"moment": "^2.30.1",
|
|
"moment-timezone": "^0.6.0",
|
|
"node-ical": "^0.25.4",
|
|
"nunjucks": "^3.2.4",
|
|
"pm2": "^6.0.14",
|
|
"socket.io": "^4.8.3",
|
|
"suncalc": "^1.9.0",
|
|
"systeminformation": "^5.31.1",
|
|
"undici": "^7.22.0",
|
|
"weathericons": "^2.1.0"
|
|
},
|
|
"devDependencies": {
|
|
"@stylistic/eslint-plugin": "^5.9.0",
|
|
"@vitest/coverage-v8": "^4.0.18",
|
|
"@vitest/eslint-plugin": "^1.6.9",
|
|
"@vitest/ui": "^4.0.18",
|
|
"cspell": "^9.7.0",
|
|
"eslint-plugin-import-x": "^4.16.1",
|
|
"eslint-plugin-jsdoc": "^62.7.1",
|
|
"eslint-plugin-package-json": "^0.89.2",
|
|
"eslint-plugin-playwright": "^2.8.0",
|
|
"express-basic-auth": "^1.2.1",
|
|
"husky": "^9.1.7",
|
|
"jsdom": "^28.1.0",
|
|
"lint-staged": "^16.3.0",
|
|
"markdownlint-cli2": "^0.21.0",
|
|
"msw": "^2.12.10",
|
|
"playwright": "^1.58.2",
|
|
"prettier": "^3.8.1",
|
|
"prettier-plugin-jinja-template": "^2.1.0",
|
|
"stylelint": "^17.4.0",
|
|
"stylelint-config-standard": "^40.0.0",
|
|
"stylelint-prettier": "^5.0.3",
|
|
"vitest": "^4.0.18"
|
|
},
|
|
"optionalDependencies": {
|
|
"electron": "^40.6.1"
|
|
},
|
|
"engines": {
|
|
"node": ">=22.21.1 <23 || >=24"
|
|
}
|
|
}
|