Copyright 2020 © VALVERDE, Marcelo Richard. All Rigths Reserved.

kodi2webos PRs Welcome Donate

A Kodi client for LG Smart TVs with webOS - using EnactJS, Moonstone

Donations to continue...


inspirations, tools, and more...

Kodi2Webos-reactTV (previous project using ReactTV)


EnactJS Samples

LG webOSTV Developer

LG webOSTV Enyo/Enact Guides

Install and run...

$ git clone

$ cd kodi2webos

$ yarn install

$ enact serve (browser)

To run on an emulator or smart tv, see:

Follow the steps in the article:

$ enact pack (to build project on /dist directory)

$ ares-package ./dist -o ./ipk (to create ipk file on ./ipk directory)

$ ares-install --device ./ (to deploy on DEVICE)

$ ares-install --device --remove (to remove)

$ ares-launch --device (to launch)

$ ares-inspect --device --app (to debug on DEVICE)


develop something that looks like this:

alt text


alt text


  • basic navigation
  • websocket/API-REST send/request communication
    • list movies/tvshows
    • works in browser
    • works in webos
  • Design interface
    • Sections: Movies | TV Shows | Settings
    • Horizontal List - Categories (Recently added, in progress, genres...)
    • Vertical List
    • Movies | TV Shows details
    • Background image
    • Create a Video Player
  • Test key navigation
  • Publish to LG Store
  • Documentation

This project was bootstrapped with @enact/cli.

Below you will find some information on how to perform common tasks. You can find the most recent version of this guide here. Additional documentation on @enact/cli can be found here.

Folder Structure

After creation, your project should look like this:


For the project to build, these files must exist with exact filenames:

  • package.json is the core package manifest for the project
  • src/index.js is the JavaScript entry point.

You can delete or rename the other files.

You can update the license entry in package.json to match the license of your choice. For more information on licenses, please see the npm documentation.

Available Scripts

In the project directory, you can run:

npm run serve

Builds and serves the app in the development mode.
Open http://localhost:8080 to view it in the browser.

The page will reload if you make edits.

npm run pack and npm run pack-p

Builds the project in the working directory. Specifically, pack builds in development mode with code un-minified and with debug code included, whereas pack-p builds in production mode, with everything minified and optimized for performance. Be sure to avoid shipping or performance testing on development mode builds.

npm run watch

Builds the project in development mode and keeps watch over the project directory. Whenever files are changed, added, or deleted, the project will automatically get rebuilt using an active shared cache to speed up the process. This is similar to the serve task, but without the http server.

npm run clean

Deletes previous build fragments from ./dist.

npm run lint

Runs the Enact configuration of Eslint on the project for syntax analysis.

npm run test and npm run test-watch

These tasks will execute all valid tests (files that end in -specs.js) that are within the project directory. The test is a standard single execution pass, while test-watch will set up a watcher to re-execute tests when files change.

Enact Build Options

The @enact/cli tool will check the project's package.json looking for an optional enact object for a few customization options:

  • template [string] - Filepath to an alternate HTML template to use with the Webpack html-webpack-plugin.
  • isomorphic [string] - Alternate filepath to a custom isomorphic-compatible entrypoint. Not needed if main entrypoint is already isomorphic-compatible.
  • title [string] - Title text that should be put within the HTML's <title></title> tags.
  • theme [object] - A simplified string name to extrapolate fontGenerator, ri, and screenTypes preset values from. For example, "moonstone"
  • fontGenerator [string] - Filepath to a commonjs fontGenerator module which will build locale-specific font CSS to inject into the HTML. By default will use any preset for a specified theme or fallback to moonstone.
  • ri [object] - Resolution independence options to be forwarded to the LESS plugin. By default will use any preset for a specified theme or fallback to moonstone
  • screenTypes [array|string] - Array of 1 or more screentype definitions to be used with prerender HTML initialization. Can alternatively reference a json filepath to read for screentype definitons. By default will use any preset for a specified theme or fallback to moonstone.
  • nodeBuiltins [object] - Configuration settings for polyfilling NodeJS built-ins. See node webpack option.
  • deep [string|array] - 1 or more javascript conditions that, when met, indicate deeplinking and any prerender should be discarded.
  • target [string|array] - A build-type generic preset string (see target webpack option) or alternatively a specific browserlist array of desired targets.
  • proxy [string] - Proxy target during project serve to be used within the http-proxy-middleware.

For example:

  "enact": {
    "theme": "moonstone",
    "nodeBuiltins": {
      fs: 'empty',
      net: 'empty',
      tls: 'empty'

Displaying Lint Output in the Editor

Some editors, including Sublime Text, Atom, and Visual Studio Code, provide plugins for ESLint.

They are not required for linting. You should see the linter output right in your terminal as well as the browser console. However, if you prefer the lint results to appear right in your editor, there are some extra steps you can do.

You would need to install an ESLint plugin for your editor first.

A note for Atom linter-eslint users

If you are using the Atom linter-eslint plugin, make sure that Use global ESLint installation option is checked:

Then, you will need to install some packages globally:

npm install -g eslint eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-babel babel-eslint eslint-plugin-jest eslint-plugin-enact eslint-config-enact

Installing a Dependency

The generated project includes Enact (and all its libraries). It also includes React and ReactDOM. For test writing, both Sinon and Enzyme are as development dependencies. You may install other dependencies with npm:

npm install --save <package-name>

Importing a Component

This project setup supports ES6 modules thanks to Babel. While you can still use require() and module.exports, we encourage you to use import and export instead.

For example:


import kind from '@enact/core/kind';

const Button = kind({
  render() {
    // ...

export default Button; // Don’t forget to use export default!


import kind from '@enact/core/kind';
import Button from './Button'; // Import a component from another file

const DangerButton = kind({
  render(props) {
    return <Button {...props} color="red" />;

export default DangerButton;

Be aware of the difference between default and named exports. It is a common source of mistakes.

We suggest that you stick to using default imports and exports when a module only exports a single thing (for example, a component). That’s what you get when you use export default Button and import Button from './Button'.

Named exports are useful for utility modules that export several functions. A module may have at most one default export and as many named exports as you like.

Learn more about ES6 modules:

Adding a LESS or CSS Stylesheet

This project setup uses Webpack for handling all assets. Webpack offers a custom way of “extending” the concept of import beyond JavaScript. To express that a JavaScript file depends on a LESS/CSS file, you need to import the CSS from the JavaScript file:


.button {
  padding: 20px;


import kind from '@enact/core/kind';
import styles './Button.css'; // Tell Webpack that Button.js uses these styles

const Button = kind({
  render() {
    // You can use them as regular CSS styles
    return <div className={styles['button']} />;

Upon importing a css/less files, the resulting object will be a mapping of class names from that document. This allows correct access to the class name string regardless how the build process mangles it up.

In development, expressing dependencies this way allows your styles to be reloaded on the fly as you edit them. In production, all CSS files will be concatenated into a single minified .css file in the build output.

Additionally, this system setup supports CSS module spec with allows for compositional CSS classes and inheritance of styles.

Adding Images and Custom Fonts

With Webpack, using static assets like images and fonts works similarly to CSS.

You can import an image right in a JavaScript module. This tells Webpack to include that image in the bundle. Unlike CSS imports, importing an image or a font gives you a string value. This value is the final image path you can reference in your code.

Here is an example:

import kind from '@enact/core/kind';
import logo from './logo.png'; // Tell Webpack this JS file uses this image

console.log(logo); // /logo.84287d09.png

const Header = kind({
  render: function() {
    // Import result is the URL of your image
    return <img src={logo} alt="Logo" />;

export default Header;

This is currently required for local images. This ensures that when the project is built, webpack will correctly move the images into the build folder, and provide us with correct paths.

This works in LESS/CSS too:

.logo {
  background-image: url(./logo.png);

Webpack finds all relative module references in CSS (they start with ./) and replaces them with the final paths from the compiled bundle. If you make a typo or accidentally delete an important file, you will see a compilation error, just like when you import a non-existent JavaScript module. The final filenames in the compiled bundle are generated by Webpack from content hashes.


A Kodi client for LG Smart TVs with webOS - using EnactJS - Moonstone

Kodi2webos Info

⭐ Stars 63
🔗 Source Code
🕒 Last Update 8 months ago
🕒 Created 2 years ago
🐞 Open Issues 5
➗ Star-Issue Ratio 13
😎 Author valverde-marcelo