From 07eed1bf3e794384bc46634de80d7b693a6935db Mon Sep 17 00:00:00 2001 From: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com> Date: Tue, 25 Mar 2025 19:17:49 +0100 Subject: [PATCH] Add example config files --- README.md | 8 ++-- eslint.config.mjs | 2 + example_configs/config_class-name.js | 60 +++++++++++++++++++++++++++ example_configs/config_module-name.js | 57 +++++++++++++++++++++++++ 4 files changed, 123 insertions(+), 4 deletions(-) create mode 100644 example_configs/config_class-name.js create mode 100644 example_configs/config_module-name.js diff --git a/README.md b/README.md index c646b23..75905c8 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ To use this module, add a configuration to the modules array in the `config/conf There are two ways to configure this module: Using the module names or using class names. The module name based configuration is easier to use, but has the limitation that you can only use one instance of each module. So if you want to use multiple instances of the same module, you have to use the class based configuration. -*Note*: Some of the module names used in the following examples are fictitious. +*Note*: You can find complete configuration example files for both module name and class based configurations in the [example_configs](example_configs) directory. ### Module name based configuration @@ -87,11 +87,11 @@ The first element of the array is the first page, the second element is the seco hiddenPages: { // modules that are only shown on specific pages "screenSaver": [ "clock", - "MMM-SomeBackgroundImageModule" + "MMM-BackgroundSlideshow" ], "admin": [ - "MMM-ShowMeSystemStatsModule", - "MMM-AnOnScreenMenuModule" + "MMM-SystemMonitor", + "MMM-OnScreenMenu" ] } } diff --git a/eslint.config.mjs b/eslint.config.mjs index e476618..8c51921 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -13,11 +13,13 @@ const config = [ Log: 'readonly', MM: 'readonly', Module: 'readonly', + module: 'readonly', }, }, rules: { '@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }], '@stylistic/comma-dangle': ['error', 'only-multiline'], + '@stylistic/max-statements-per-line': ['error', { max: 2 }], '@stylistic/semi': ['error', 'always'], 'object-shorthand': ['error', 'always'] }, diff --git a/example_configs/config_class-name.js b/example_configs/config_class-name.js new file mode 100644 index 0000000..b76c849 --- /dev/null +++ b/example_configs/config_class-name.js @@ -0,0 +1,60 @@ +/* + * This is an example configuration file for the MMM-pages module. + * + * Since it uses only default modules besides MMM-pages, it is a good starting + * point for your configuration. You can add more modules if you want. + * + * It shows how to configure the module with class names. Checkout the + * "Class based configuration" section in the README. + * +*/ + +let config = { + modules: [ + { + module: 'MMM-pages', + config: { + timings: { + default: 5000, + 2: 20000 + }, + modules: [ + ['page0'], + ['page1'], + ['page2'], + ] + } + }, + { + module: 'compliments', + classes: 'page0 page1 page2', + position: 'top_bar', + config: { + compliments: { + anytime: ['Test MMM-pages: Class based configuration'], + } + } + }, + { + module: 'clock', + classes: 'page1', + position: 'bottom_bar' + }, + { + module: 'newsfeed', + classes: 'page2', + position: 'middle_center', + config: { + feeds: [ + { + title: 'New York Times', + url: 'https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml' + } + ] + } + }, + ] +}; + +/** ************* DO NOT EDIT THE LINE BELOW ***************/ +if (typeof module !== 'undefined') { module.exports = config; } diff --git a/example_configs/config_module-name.js b/example_configs/config_module-name.js new file mode 100644 index 0000000..36a7f7d --- /dev/null +++ b/example_configs/config_module-name.js @@ -0,0 +1,57 @@ +/* + * This is an example configuration file for the MMM-pages module. + * + * Since it uses only default modules besides MMM-pages, it is a good starting + * point for your configuration. You can add more modules if you want. + * + * It shows how to configure the module with module names. Checkout the + * "Module name based configuration" section in the README. + * +*/ + +let config = { + modules: [ + { + module: 'MMM-pages', + config: { + timings: { + default: 5000, + 2: 20000 + }, + modules: [ + ['compliments'], + ['clock'], + ['newsfeed'], + ] + } + }, + { + module: 'compliments', + position: 'top_bar', + config: { + compliments: { + anytime: ['Test MMM-pages: Module name based configuration'], + } + } + }, + { + module: 'clock', + position: 'top_bar' + }, + { + module: 'newsfeed', + position: 'middle_center', + config: { + feeds: [ + { + title: 'New York Times', + url: 'https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml' + } + ] + } + }, + ] +}; + +/** ************* DO NOT EDIT THE LINE BELOW ***************/ +if (typeof module !== 'undefined') { module.exports = config; }