Merge branch 'develop' into issue_2192

This commit is contained in:
Michael Teeuw 2022-05-18 09:14:29 +02:00 committed by GitHub
commit b13414cab8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 1776 additions and 2035 deletions

View File

@ -16,7 +16,7 @@
}, },
"parserOptions": { "parserOptions": {
"sourceType": "module", "sourceType": "module",
"ecmaVersion": 2018, "ecmaVersion": 2020,
"ecmaFeatures": { "ecmaFeatures": {
"globalReturn": true "globalReturn": true
} }

View File

@ -15,10 +15,10 @@ jobs:
timeout-minutes: 30 timeout-minutes: 30
strategy: strategy:
matrix: matrix:
node-version: [14.x, 16.x, 17.x] node-version: [14.x, 16.x, 18.x]
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:

View File

@ -1,4 +1,5 @@
# This workflow runs the automated test and uploads the coverage results to codecov.io # This workflow runs the automated test and uploads the coverage results to codecov.io
# For more information see: https://github.com/codecov/codecov-action
name: "Run Codecov Tests" name: "Run Codecov Tests"
@ -14,7 +15,7 @@ jobs:
timeout-minutes: 30 timeout-minutes: 30
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Install dependencies and run coverage - name: Install dependencies and run coverage
run: | run: |
Xvfb :99 -screen 0 1024x768x16 & Xvfb :99 -screen 0 1024x768x16 &

View File

@ -1,4 +1,5 @@
# This workflow enforces the update of a changelog file on every pull request # This workflow enforces the update of a changelog file on every pull request
# For more information see: https://github.com/dangoslen/changelog-enforcer
name: "Enforce Changelog" name: "Enforce Changelog"
@ -11,10 +12,8 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Enforce changelog - name: Enforce changelog
uses: dangoslen/changelog-enforcer@v2 uses: dangoslen/changelog-enforcer@v3
with: with:
changeLogPath: "CHANGELOG.md" changeLogPath: "CHANGELOG.md"
skipLabels: "Skip Changelog" skipLabels: "Skip Changelog"

View File

@ -11,10 +11,14 @@ _This release is scheduled to be released on 2022-07-01._
### Added ### Added
- Show endDate for calendar events when dateHeader is enabled and showEnd is set to true (#2192) by @doubled136 - Show endDate for calendar events when dateHeader is enabled and showEnd is set to true (#2192)
- Added the notification emitting from the weather module on infromation updated.
### Updated ### Updated
- Use latest node 18 when running tests on github actions
- Update `electron` to v18 and other dependencies.
### Fixed ### Fixed
- Fix problems with non latin fonds caused by updating to fontsource (fixes #2835). - Fix problems with non latin fonds caused by updating to fontsource (fixes #2835).

View File

@ -8,7 +8,7 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@fontsource/roboto": "^4.5.5", "@fontsource/roboto": "^4.5.5",
"@fontsource/roboto-condensed": "^4.5.6" "@fontsource/roboto-condensed": "^4.5.8"
} }
}, },
"node_modules/@fontsource/roboto": { "node_modules/@fontsource/roboto": {
@ -17,9 +17,9 @@
"integrity": "sha512-Pe1p+gAO6K0aLxBXlLoJRHVx352tVc/v/7DOnvM3t+FYXb+KUga9aCD1NpnDfd0kKnWXqrZyAXguyyFWDDuphw==" "integrity": "sha512-Pe1p+gAO6K0aLxBXlLoJRHVx352tVc/v/7DOnvM3t+FYXb+KUga9aCD1NpnDfd0kKnWXqrZyAXguyyFWDDuphw=="
}, },
"node_modules/@fontsource/roboto-condensed": { "node_modules/@fontsource/roboto-condensed": {
"version": "4.5.6", "version": "4.5.8",
"resolved": "https://registry.npmjs.org/@fontsource/roboto-condensed/-/roboto-condensed-4.5.6.tgz", "resolved": "https://registry.npmjs.org/@fontsource/roboto-condensed/-/roboto-condensed-4.5.8.tgz",
"integrity": "sha512-WDN0RlwXa3ADUDJxrB9HEIhrwYdJFLTNw4YemEYSeIPURU5DAHSx2VFXFv69PbM7kV8At5yMTp8bQkL5TBUP3w==" "integrity": "sha512-HCuf1rVSOsXnl/KgHNRLCr8XS/Dunzn10BjhliJiEZ5qPynXCWH4RRBFupIODHamhj2Uyp/iZkSQp574luKp6A=="
} }
}, },
"dependencies": { "dependencies": {
@ -29,9 +29,9 @@
"integrity": "sha512-Pe1p+gAO6K0aLxBXlLoJRHVx352tVc/v/7DOnvM3t+FYXb+KUga9aCD1NpnDfd0kKnWXqrZyAXguyyFWDDuphw==" "integrity": "sha512-Pe1p+gAO6K0aLxBXlLoJRHVx352tVc/v/7DOnvM3t+FYXb+KUga9aCD1NpnDfd0kKnWXqrZyAXguyyFWDDuphw=="
}, },
"@fontsource/roboto-condensed": { "@fontsource/roboto-condensed": {
"version": "4.5.6", "version": "4.5.8",
"resolved": "https://registry.npmjs.org/@fontsource/roboto-condensed/-/roboto-condensed-4.5.6.tgz", "resolved": "https://registry.npmjs.org/@fontsource/roboto-condensed/-/roboto-condensed-4.5.8.tgz",
"integrity": "sha512-WDN0RlwXa3ADUDJxrB9HEIhrwYdJFLTNw4YemEYSeIPURU5DAHSx2VFXFv69PbM7kV8At5yMTp8bQkL5TBUP3w==" "integrity": "sha512-HCuf1rVSOsXnl/KgHNRLCr8XS/Dunzn10BjhliJiEZ5qPynXCWH4RRBFupIODHamhj2Uyp/iZkSQp574luKp6A=="
} }
} }
} }

View File

@ -11,6 +11,6 @@
}, },
"dependencies": { "dependencies": {
"@fontsource/roboto": "^4.5.5", "@fontsource/roboto": "^4.5.5",
"@fontsource/roboto-condensed": "^4.5.6" "@fontsource/roboto-condensed": "^4.5.8"
} }
} }

View File

@ -154,6 +154,15 @@ Module.register("weather", {
if (this.weatherProvider.currentWeather()) { if (this.weatherProvider.currentWeather()) {
this.sendNotification("CURRENTWEATHER_TYPE", { type: this.weatherProvider.currentWeather().weatherType.replace("-", "_") }); this.sendNotification("CURRENTWEATHER_TYPE", { type: this.weatherProvider.currentWeather().weatherType.replace("-", "_") });
} }
const notificationPayload = {
currentWeather: this.weatherProvider?.currentWeatherObject?.simpleClone() ?? null,
forecastArray: this.weatherProvider?.weatherForecastArray?.map((ar) => ar.simpleClone()) ?? [],
hourlyArray: this.weatherProvider?.weatherHourlyArray?.map((ar) => ar.simpleClone()) ?? [],
locationName: this.weatherProvider?.fetchedLocationName,
providerName: this.weatherProvider.providerName
};
this.sendNotification("WEATHER_UPDATED", notificationPayload);
}, },
scheduleUpdate: function (delay = null) { scheduleUpdate: function (delay = null) {

View File

@ -146,6 +146,23 @@ class WeatherObject {
this.sunrise = moment(times.sunrise, "X"); this.sunrise = moment(times.sunrise, "X");
this.sunset = moment(times.sunset, "X"); this.sunset = moment(times.sunset, "X");
} }
/**
* Clone to simple object to prevent mutating and deprecation of legacy library.
*
* Before being handed to other modules, mutable values must be cloned safely.
* Especially 'moment' object is not immutable, so original 'date', 'sunrise', 'sunset' could be corrupted or changed by other modules.
*
* @returns {object} plained object clone of original weatherObject
*/
simpleClone() {
const toFlat = ["date", "sunrise", "sunset"];
let clone = { ...this };
for (const prop of toFlat) {
clone[prop] = clone?.[prop]?.valueOf() ?? clone?.[prop];
}
return clone;
}
} }
/*************** DO NOT EDIT THE LINE BELOW ***************/ /*************** DO NOT EDIT THE LINE BELOW ***************/

3707
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -48,44 +48,44 @@
"homepage": "https://magicmirror.builders", "homepage": "https://magicmirror.builders",
"devDependencies": { "devDependencies": {
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-plugin-jest": "^26.1.3", "eslint-plugin-jest": "^26.1.5",
"eslint-plugin-jsdoc": "^38.1.3", "eslint-plugin-jsdoc": "^38.1.6",
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^4.0.0",
"express-basic-auth": "^1.2.1", "express-basic-auth": "^1.2.1",
"husky": "^7.0.4", "husky": "^7.0.4",
"jest": "^27.5.1", "jest": "^28.0.3",
"jsdom": "^19.0.0", "jsdom": "^19.0.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"nyc": "^15.1.0", "nyc": "^15.1.0",
"playwright": "^1.20.1", "playwright": "^1.21.1",
"prettier": "^2.6.1", "prettier": "^2.6.2",
"pretty-quick": "^3.1.3", "pretty-quick": "^3.1.3",
"sinon": "^13.0.1", "sinon": "^13.0.2",
"stylelint": "^14.6.1", "stylelint": "^14.8.1",
"stylelint-config-prettier": "^9.0.3", "stylelint-config-prettier": "^9.0.3",
"stylelint-config-standard": "^25.0.0", "stylelint-config-standard": "^25.0.0",
"stylelint-prettier": "^2.0.0", "stylelint-prettier": "^2.0.0",
"suncalc": "^1.9.0" "suncalc": "^1.9.0"
}, },
"optionalDependencies": { "optionalDependencies": {
"electron": "^17.2.0" "electron": "^18.2.0"
}, },
"dependencies": { "dependencies": {
"colors": "^1.4.0", "colors": "^1.4.0",
"console-stamp": "^3.0.4", "console-stamp": "^3.0.4",
"digest-fetch": "^1.2.1", "digest-fetch": "^1.2.1",
"eslint": "^8.12.0", "eslint": "^8.14.0",
"express": "^4.17.3", "express": "^4.18.1",
"express-ipfilter": "^1.2.0", "express-ipfilter": "^1.2.0",
"feedme": "^2.0.2", "feedme": "^2.0.2",
"helmet": "^5.0.2", "helmet": "^5.0.2",
"iconv-lite": "^0.6.3", "iconv-lite": "^0.6.3",
"luxon": "^1.21.3", "luxon": "^1.28.0",
"module-alias": "^2.2.2", "module-alias": "^2.2.2",
"moment": "^2.29.1", "moment": "^2.29.3",
"node-fetch": "^2.6.7", "node-fetch": "^2.6.7",
"node-ical": "^0.15.1", "node-ical": "^0.15.1",
"socket.io": "^4.4.1" "socket.io": "^4.5.0"
}, },
"_moduleAliases": { "_moduleAliases": {
"node_helper": "js/node_helper.js", "node_helper": "js/node_helper.js",

14
vendor/package-lock.json generated vendored
View File

@ -8,7 +8,7 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "^6.1.1", "@fortawesome/fontawesome-free": "^6.1.1",
"moment": "^2.29.1", "moment": "^2.29.3",
"moment-timezone": "^0.5.34", "moment-timezone": "^0.5.34",
"nunjucks": "^3.2.3", "nunjucks": "^3.2.3",
"suncalc": "^1.9.0", "suncalc": "^1.9.0",
@ -43,9 +43,9 @@
} }
}, },
"node_modules/moment": { "node_modules/moment": {
"version": "2.29.1", "version": "2.29.3",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.3.tgz",
"integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==", "integrity": "sha512-c6YRvhEo//6T2Jz/vVtYzqBzwvPT95JBQ+smCytzf7c50oMZRsR/a4w88aD34I+/QVSfnoAnSBFPJHItlOMJVw==",
"engines": { "engines": {
"node": "*" "node": "*"
} }
@ -118,9 +118,9 @@
"integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==" "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg=="
}, },
"moment": { "moment": {
"version": "2.29.1", "version": "2.29.3",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.3.tgz",
"integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" "integrity": "sha512-c6YRvhEo//6T2Jz/vVtYzqBzwvPT95JBQ+smCytzf7c50oMZRsR/a4w88aD34I+/QVSfnoAnSBFPJHItlOMJVw=="
}, },
"moment-timezone": { "moment-timezone": {
"version": "0.5.34", "version": "0.5.34",

2
vendor/package.json vendored
View File

@ -11,7 +11,7 @@
}, },
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "^6.1.1", "@fortawesome/fontawesome-free": "^6.1.1",
"moment": "^2.29.1", "moment": "^2.29.3",
"moment-timezone": "^0.5.34", "moment-timezone": "^0.5.34",
"nunjucks": "^3.2.3", "nunjucks": "^3.2.3",
"suncalc": "^1.9.0", "suncalc": "^1.9.0",