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.
-
Navigate to the
MagicMirror/modules
directory and execute the following commandgit clone https://github.com/ismarslomic/MMM-Hello-World-Ts.git
-
Change into the
MMM-Hello-World-Ts
module folder and install runtime dependencies withcd MMM-Hello-World-Ts npm run install:dep
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!',
},
},
],
}
- Clone the repository
- Install the dependencies with
npm install
- Automatically recompile the TypeScript files when they are changed with
npm run dev:watch
or run explicitly withnpm 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.
npm run lint
npm run prettier
npm run test:unit
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
Add Repository secret in your Github repository with name CODECOV_TOKEN
and a
secret value from your codecov.io account.