Before the Enact framework can function on your computer, it is necessary to install some software. The most important piece is the Node JavaScript runtime version 18 or newer (you can check to see what version of Node is installed by typing node --version into your command prompt or terminal window). If needed, follow the instructions on the site to install it.
The Enact CLI provides a set of commands to ease creation, testing, maintenance, and packaging of your Enact-based apps. It can be installed globally on your system using npm:
Terminal window
npminstall-g@enact/cli
Once installed, run enact -v to see the Enact CLI version. You can run enact from anywhere to run a command.
We’ll cover some of the available commands below but the package README contains further detail.
The first command you’ll use is enact create [<directory>] to create a new application. The [<directory>] argument is optional and defaults to the current working directory. create creates the initial directory structure and configures the app.
Note: If you are developing an app for a webOS-based system (webOS TVs, webOS OSE, etc.) you can use the webostv template to create your application:
Your application is configured using the package.json file. We’ll only cover the fields you most likely want to change here and leave a more complete discussion of the package.json for further reading.
"name", "version", "description", "author", "license" - Application meta-data. These fields do not affect the build of your application but should be updated to reflect your application’s details.
"enact" - The Enact-specific configuration block. By default, it contains intelligent defaults for an Enact Sandstone application. You should add a "title" field within this block to specify your application’s title which will be included in the generated index.html during the build.
package.json
{
"name": "App",
"version": "1.0.0",
"description": "A general template for an Enact Sandstone application.",