Skip to content

Hello world custom module for Magic Mirror written in TypeScript

License

Notifications You must be signed in to change notification settings

ismarslomic/MMM-Hello-World-Ts

Repository files navigation

Magic Mirror module: Hello world

CodeQL ESLint ESLint E2E tests Unit tests

Simple Magic Mirror module written in Typescript demonstrating use of the core module file ( frontend) and node helper (backend) in addition to using the nunjucks templates for rendering data.

The transpiled JavaScript files should work in the same way as the original JavaScript module MMM-Hello-World.

Example screenshot

Screenshot

Installing the module

  1. Navigate to the MagicMirror/modules directory and execute the following command

    git clone https://github.com/ismarslomic/MMM-Hello-World-Ts.git
  2. Change into the MMM-Hello-World-Ts module folder and install runtime dependencies with

    cd MMM-Hello-World-Ts
    npm run install:dep

Using the module

To use this module, add the following configuration block to the modules array in the config/config.js file:

var config = {
  modules: [
    {
      module: 'MMM-Hello-World-Ts',
      position: 'top_left',
      config: {
        text: 'Hello world Ismar!',
      },
    },
  ],
}

Development

  1. Clone the repository
  2. Install the dependencies with npm install
  3. Automatically recompile the TypeScript files when they are changed with npm run dev:watch or run explicitly with npm run build

Note! pre-commit hook is configured to run eslint, prettier and build before committing the changes to git, see lint-staged and husky pre-commit configuration files.

Linting and formatting

npm run lint
npm run prettier

Run unit tests locally

npm run test:unit

Run e2e tests locally

Make sure Magic Mirror server is running on http://localhost:8080 with config enabling this module before running the E2E tests!

npm run test:e2e

Codecov integration in Github actions

Add Repository secret in your Github repository with name CODECOV_TOKEN and a secret value from your codecov.io account.

About

Hello world custom module for Magic Mirror written in TypeScript

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published