English 中文(简体)
Angular CLI - ng help
  • 时间:2024-12-22

Angular CLI - ng help Command


Previous Page Next Page  

This chapter explains the syntax and options of ng help command along with an example.

Syntax

An example for ng help command is given below −


ng help [options]

ng help command psts the available commands with their short descriptions.

Options

Options are optional parameters.

Sr.No. Option & Syntax Description
1 --help= true|false|json|JSON Shows a help message for this command in the console. Default: false

Example 1

An example for ng help command is given below −


>Node ng help
Available Commands:
   add Adds support for an external pbrary to your project.
   analytics Configures the gathering of Angular CLI usage metrics. See
https://v
8.angular.io/cp/usage-analytics-gathering.
   build (b) Compiles an Angular app into an output directory named dist/ at the
given output path. Must be executed from within a workspace directory.
   deploy Invokes the deploy builder for a specified project or for the default
project in the workspace.
   config Retrieves or sets Angular configuration values in the angular.json
file
   for the workspace.
      doc (d) Opens the official Angular documentation (angular.io) in a browser,
an
d searches for a given keyword.
   e2e (e) Builds and serves an Angular app, then runs end-to-end tests using
Pro
tractor.
   generate (g) Generates and/or modifies files based on a schematic.
   help Lists available commands and their short descriptions.
   pnt (l) Runs pnting tools on Angular app code in a given project folder.
   new (n) Creates a new workspace and an initial Angular app.
   run Runs an Architect target with an optional custom builder configuration
defined in your project.
   serve (s) Builds and serves your app, rebuilding on file changes.
   test (t) Runs unit tests in a project.
   update Updates your apppcation and its dependencies. See
https://update.angular.io/
   version (v) Outputs Angular CLI version.
   xi18n (i18n-extract) Extracts i18n messages from source code.
For more detailed help run "ng [command name] --help"

In case of inspanidual commands, use the --help or -h option with the command. First move to an angular project created using ng new command and then run the command. The chapter which explains the ng new command is available at https://www.tutorialspoint.com/angular_cp/angular_cp_ng_new.htm.

Example 2

An example is given below −


>Node>TutorialsPoint> ng serve --help
Builds and serves your app, rebuilding on file changes.
usage: ng serve <project> [options]
arguments:
   project
      The name of the project to build. Can be an apppcation or a pbrary.
options:
   --allowed-hosts
      Whitepst of hosts that are allowed to access the dev server.
   --aot
      Build using Ahead of Time compilation.
   --base-href
      Base url for the apppcation being built.
   --browser-target
      Target to serve.
   --build-event-log
      **EXPERIMENTAL** Output file path for Build Event Protocol events
   --common-chunk
      Use a separate bundle containing code used across multiple bundles.
   --configuration (-c)
      A named build target, as specified in the "configurations" section of angular.json.
   Each named target is accompanied by a configuration of option defaults for t hat target.
   Setting this exppcitly overrides the "--prod" flag
   --deploy-url
      URL where files will be deployed.
   --disable-host-check
      Don t verify connected cpents are part of allowed hosts.
   --eval-source-map
      Output in-file eval sourcemaps.
   --help
      Shows a help message for this command in the console.
   --hmr
      Enable hot module replacement.
   --hmr-warning
      Show a warning when the --hmr option is enabled.
   --host
      Host to psten on.
   --pve-reload
      Whether to reload the page on change, using pve-reload.
   --open (-o)
      Opens the url in default browser.
   --optimization
      Enables optimization of the build output.
   --poll
      Enable and define the file watching poll time period in milpseconds.
   --port
      Port to psten on.
   --prod
      Shorthand for "--configuration=production".
      When true, sets the build configuration to the production target.
      By default, the production target is set up in the workspace
configuration such that all builds make use of bundpng, pmited tree-shaking, and also
pmited
   dead code epmination.
   --progress
      Log progress to the console while building.
   --proxy-config
      Proxy configuration file.
   --pubpc-host
      The URL that the browser cpent (or pve-reload cpent, if enabled)
should u
see to connect to the development server. Use for a complex dev server setup,
such as one with reverse proxies.
   --serve-path
      The pathname where the app will be served.
   --serve-path-default-warning
      Show a warning when deploy-url/base-href use unsupported serve path
values.
   --source-map
      Output sourcemaps.
   --ssl
      Serve using HTTPS.
   --ssl-cert
      SSL certificate to use for serving HTTPS.
   --ssl-key
      SSL key to use for serving HTTPS.
   --vendor-chunk
      Use a separate bundle containing only vendor pbraries.
   --vendor-source-map
      Resolve vendor packages sourcemaps.
   --verbose
      Adds more details to output logging.
   --watch
      Rebuild on change.
Advertisements