WebApp CLI

WebApp CLI is a command-line tool for managing and building Dart-based web applications

WebApp CLI - Documentation

The WebApp CLI is a command-line tool for managing and building Dart-based web applications. It provides several commands to create projects, manage packages, run applications, build executables, and perform unit tests.

Installing WebApp CLI

To install the WebApp CLI globally in Dart, use the following command:

dart pub global activate webapp

This command installs the WebApp CLI tool so it can be accessed from anywhere in your system. Once installed, you can verify the installation and check the version of the tool using the following command:

webapp -v

This will output the current version of the WebApp CLI that is installed.

Displaying Help Information

For a list of available commands and options, use the -h flag to show the help menu:

webapp -h

This command provides a quick reference to all the commands and options available in the WebApp CLI.

Commands

1. create

Create a new webapp project.

Usage:

webapp create [options]

Options:

  • --path, -p : Specifies the path where the project will be created.
  • --name, -n : Defines the name of the new project.
  • --docker, -d : Initializes the project with Docker support.

2. get

Fetch the necessary packages for the project (equivalent to dart pub get).

Usage:

webapp get

3. runner

Builds the project using the Dart build system (equivalent to dart pub run build_runner build).

Usage:

webapp runner

4. run

Run the project.

Usage:

webapp run [options]

Options:

  • --path, -p : Specifies the path of the Dart application file to run.

5. build

Compile the project into an executable (equivalent to dart compile exe).

Usage:

webapp build [options]

Options:

  • --appPath, -a : Path of the main application file.
  • --langPath, -l : Path to the language files directory.
  • --publicPath, -p : Path to the public assets directory.
  • --widgetPath, -w : Path to the widget components directory.
  • --envPath, -e : Path to the environment variables file (.env).
  • --output, -o : Destination path for the output (e.g., executable).
  • --type, -t : Specifies the build type (e.g., zip, exe).
  • --help, -h : Displays help for the build command.

6. test

Run unit tests for the project (equivalent to dart test).

Usage:

webapp test [options]

Options:

  • --reporter, -r : Sets how the test results will be printed (e.g., compact, expanded).
  • --help, -h : Displays help for the test command.

Global Options

These options can be used with any command:

  • --help, -h : Displays help information for the CLI.
  • --version, -v : Displays the current version of WebApp and Dart.
  • --update, -u : Updates the WebApp CLI tool to the latest version.