English
English
简体中文
Contact Us
Register
Log In

Initialize Project

Last Updated on : 2022-11-08 09:02:52download

Before panel development is started, you must initialize the project.

Prerequisites

Procedure

Step 1: Install CLI

The command-line interface (CLI) tuya-panel-cli is required during cloud development. To install it, run the following command:

  • MacOS & Linux

    curl -fsSL https://cdn.jsdelivr.net/gh/tuya/tuya-panel-cli/install.sh | sh
    

    If this is your first installation, set up the environment variable as per the instruction.

  • Windows PowerShell

    iwr https://cdn.jsdelivr.net/gh/tuya/tuya-panel-cli/install.ps1 -useb | iex
    

    The iwr command cannot run on early versions of PowerShell. To resolve this problem, see iwr cannot be recognized on Windows.

Run tuya-panel-cli help to see if all available commands are printed to determine whether the installation is successful.

The installation script might fail to be obtained due to network problems. In this case, follow the instructions in Manual installation or Mac/Linux manual installation to fix the problem.

Step 2: Initialize the template project

Perform the following steps:

  1. Create a project.

    $ tuya-panel-cli init [projectName]
    
  2. Select the target project template such as curtain, and press the Enter key.

  3. After the template is downloaded, sequentially run the following commands to install and start the template.

    $ cd [projectName]
    $ yarn && yarn start
    

    Initialize Project

For more information about the templates and usage, see Scaffold Templates.

Step 3: Update tuya-panel-cli

Update tuya-panel-cli to the latest version.

tuya-panel-cli upgrade