乐闻世界logo
搜索文章和话题

What is the Difference Between taro-cli and @tarojs/cli in Taro

2024年7月20日 14:50

In the Taro framework, taro-cli and @tarojs/cli typically refer to the same tool, which is the command-line interface (CLI) for Taro. taro-cli was the name used in earlier versions, while @tarojs/cli is the new naming convention adopted later to maintain consistency with other packages under the @tarojs namespace.

Main Responsibilities

  • Enables users to quickly generate new Taro project templates via the command line.
  • Supports unified development across multiple platforms, compiling code to various target platforms such as WeChat Mini Programs, Baidu Mini Programs, Web, and React Native.
  • Configures project compilation options and other settings by modifying the config/index.js file.
  • Allows adding or managing plugins used in Taro projects via the CLI.

Usage Example

For example, if you want to create a new Taro project, you can use the following command:

bash
taro init myApp

This command guides you through several steps to configure the new project, such as selecting a template and setting the project name.

Summary

Overall, although the naming convention has evolved, taro-cli and @tarojs/cli have no functional differences; both are designed to help developers use the Taro framework more efficiently. With Taro's ongoing updates, it is recommended to use the latest naming convention @tarojs/cli to maintain consistency with other components of the framework.

标签:Taro